You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Originally posted by adam-nielsen March 15, 2024
I have a bunch of poorly formatted code, but I can't figure out how to get basic stuff like the indenting fixed. For example this file:
if (!$a) {
if ($b) {
// Single line comment indented too far.$a = $b;
}
else {
/* Comment indented too far. */$x = true;
/* Another comment indented incorrectly. */$y = true;
}
}
When I run it, it says:
$ php phpcbf.phar --standard=PSR12 test.php
PHPCBF RESULT SUMMARY
----------------------------------------
FILE FIXED REMAINING
----------------------------------------
test.php 4 0
----------------------------------------
A TOTAL OF 4 ERRORS WERE FIXED IN 1 FILE
----------------------------------------
Time: 65ms; Memory: 8MB
But all it has done is put that else back on the same line, it hasn't fixed the indenting of any statements or of the comments inside the curly braces.
What am I doing wrong?
The text was updated successfully, but these errors were encountered:
Closing issue - per the linked discussion, the issue was that unlike linters in other languages, the default rules in phpcs don't enforce any indenting rules. Manually turning them on makes it work as expected.
Discussed in #399
Converting to an issue as requested.
Originally posted by adam-nielsen March 15, 2024
I have a bunch of poorly formatted code, but I can't figure out how to get basic stuff like the indenting fixed. For example this file:
When I run it, it says:
But all it has done is put that
else
back on the same line, it hasn't fixed the indenting of any statements or of the comments inside the curly braces.What am I doing wrong?
The text was updated successfully, but these errors were encountered: