junstyle / vscode-php-cs-fixer

PHP CS Fixer extension for VS Code

Home Page:https://marketplace.visualstudio.com/items?itemName=junstyle.php-cs-fixer

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

How to change rule stragegy?

RossTsachev opened this issue · comments

Hi,
I'm using @PhpCsFixer ruleset, but want to override the strategy of rule 'multiline_whitespace_before_semicolons' from 'new_line_for_chained_calls' to 'no_multi_line' : https://cs.symfony.com/doc/rules/semicolon/multiline_whitespace_before_semicolons.html
I can add .php-cs-fixer.php file to one of my projects, but want to make it global. Is there any way to do that within the configurations settings?

like this:

"php-cs-fixer.rules": { 	
  "@Symfony": true, 	
  "array_syntax": { "syntax": "short" }
}

json formatted value

If the --rules option is used rules from config files are ignored.

Worked like charm

"php-cs-fixer.rules": { 	
  "@PhpCsFixer": true, 	
  "multiline_whitespace_before_semicolons'": { "strategy": "no_multi_line" }
}

Thank you :)

@junstyle Would be nice if you could document how to adjust specific rules in the php-cs-fixer.rules setting.