$ php -v):=>7.1.11
$ php-cs-fixer -V):=> 2.12.1
=> Using Sublime text (3.1.1) plugin php cs fixer
=> Also tried in visual studio code (1.24.1)
return PhpCsFixer\Config::create()
->setRules(array(
'@PSR2' => true,
'method_argument_space' => array('on_multiline' =>'ignore','keep_multiple_spaces_after_comma' => false),
))
->setIndent(" ")
->setLineEnding("\n")
->setUsingCache(false)
->setCacheFile(__DIR__.'\php_cs.cache')
;
same if i set on_multiline='ensure_fully_multiline'
if (true) {
if (true) {
(new stdClass())->asdf(
'text',
'text2'
);
}
}
if (true) {
if (true) {
(new stdClass())->asdf(
'text',
'text2'
);
}
}
if i run PHP CS Fixer again
if (true) {
if (true) {
(new stdClass())->asdf(
'text',
'text2'
);
}
}
Same here. Ths produces problems with arguments on multiple lines.
This seems to work as workaround:
return PhpCsFixer\Config::create()
->setUsingCache(false)
->setRules([
'@PSR1' => true,
'@PSR2' => true,
'indentation_type' => false
])
->setIndent(" ")
->setFinder($finder)
;
Running this multiple times changes it again.
Getting the same problems using 2.15.1 with 'php cs fixer' extension for VS Code.
It is not even idempotent, each time you format the same file it changes as multi-line arrays and function call arguments march left by 2 spaces each time like @amitbisht511's example.
.\php-cs-fixer.phar -V
PHP CS Fixer 2.15.1 Europe Round by Fabien Potencier and Dariusz Ruminski (2006451)
should be fixed by https://github.com/FriendsOfPHP/PHP-CS-Fixer/pull/4183 , please let us know if there is still an issue :+1:
Most helpful comment
Same here. Ths produces problems with arguments on multiple lines.
This seems to work as workaround:
Running this multiple times changes it again.