Skip to content

Rules for space indentation instead of tabs, specifically in multiline arrays #2449

Answered by jrfnl
pdewouters asked this question in Q&A
Discussion options

You must be logged in to vote

@pdewouters Okay, so this is not an issue with the sniff, but related to a quirk in PHPCS (which will be fixed/changed in PHPCS 4.0).

Basically, a "config" setting, like tab-width, cannot be easily overruled from within a custom ruleset.

In other words, even with the config you posted, the tab-width is still set to 4 as it is inherited from WPCS, which is why the sniff behaves as it does.

There are two options to get round this for now (until PHPCS 4.0 has been released):

  1. Set the tab-width on the command line. Command line overrules all, so running PHPCS like so phpcs --tab-width=2 will work and pick up your custom ruleset for everything else.
    You can encodify this in a Composer script i…

Replies: 6 comments 1 reply

Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
1 reply
@pdewouters
Comment options

Answer selected by pdewouters
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
3 participants
Converted from issue

This discussion was converted from issue #2448 on June 05, 2024 10:59.