Hello,
I'm using the latest version of code standard fixer (2.1.1) to make code compliant with PSR2. I have a problem with braces fixer. The fixer seems to be more concerned about my blank lines than about braces. I use blank lines to visually separate code. AFAIK PSR2 does not put any constraints on blank lines besides namespace and use declarations. Therefore I would suggest making this behavior configurable or move it to a separate fixer.
Example diff of my file:
---------- begin diff ----------
--- Original
+++ New
@@ @@
return;
-
@@ @@
if ($skipChecksRequested && $this->isImpersonated($token)) {
-
@@ @@
));
-
@@ @@
return true;
-
@@ @@
$session->remove('redirectTo'); // prevent infinite loops and unexpected redirects
-
@@ @@
}
-
}
----------- end diff -----------
Hi!
Can you provide the configuration file (if you use any) and the cli command, it would help to scope down the issue.
Thanks for quick reaction! ;)
Here is the command, no additional configuration:
bin/php-cs-fixer fix ./file.php --rules=braces --diff --verbose
Also an example with code:
<?php
if (true) {
if (true) {
exit;
}
}
And diff:
---------- begin diff ----------
--- Original
+++ New
@@ @@
<?php
if (true) {
-
if (true) {
-
exit;
-
}
-
}
----------- end diff -----------
Yes, please fix this. I also have the same issue
@blexxed , this project is community driven and maintained.
We cannot fix/implement all requests at the same time. If you want to see this issue fixed sooner, any help would be appreciated ! :)
Most helpful comment
@blexxed , this project is community driven and maintained.
We cannot fix/implement all requests at the same time. If you want to see this issue fixed sooner, any help would be appreciated ! :)