Closed MadCoder253 closed 7 years ago
I have the same problem.
This plugin does not affect the sniffs in any way. This means that if you have false positives this means that something changed in phpcs. I think this kind of problem should be reported to https://github.com/squizlabs/PHP_CodeSniffer/issues directly
Cool, thanks ikappas!
Hi,
PHPCS is working great for me, very handy to update code as I work on it or making sure new code is formatted correctly.
It appears that the indenting check for the case may be off. If I have a switch statement inside a function, it is indented and then the case statement has an additional indent. However, the PHPCS shows the indentation is wrong, that it was expecting 4 spaces, but found 8. I think the check may not be taking into account the indent for being inside a function.
I double checked the standard. http://www.php-fig.org/psr/psr-2/#5-2-switch-case
Here's my truncated sample code. There is an error message for each case line and the default line.
function createWebsiteImage($orig_name, $new_name, $path, $w, $h, $img) { switch($img) { **case 1:** $nw = 150; $nh = 205; break; **case 2:** $nw = 205; $nh = 150; break; **default:** $nw = 220; $nh = 220; break; } }