Skip to content

Conversation

JDGrimes
Copy link
Contributor

The $stackPtr was being used instead of $end, leading to the
comment opener being replaced with */. This would cause a syntax
error in the “fixed” PHP file.

The sniff did not have a test for the fixing component, which is why
this wasn’t caught sooner. I’ve added the .fixed file, but it is just
a copy of the .inc file, because I didn’t know for sure whether all
of the fixing behavior is correct. So currently the tests are
intentionally failing.

See
WordPress/WordPress-Coding-Standards#478

The `$stackPtr` was being used instead of `$end`, leading to the comment opener being replaced with `*/`. This would cause a syntax error in the “fixed” PHP file. The sniff did not have a test for the fixing component, which is why this wasn’t caught sooner. I’ve added the `.fixed` file, but it is just a copy of the `.inc` file, because I didn’t know for sure whether all of the fixing behavior is correct. So currently the tests are intentionally failing. See https://github.com/WordPress-Coding-Standards/WordPress-Coding-Standards squizlabs/issues/478
@gsherwood gsherwood changed the title Fix fixing for Squiz.Commenting.BlockComment.WrongEnd Auto fix for Squiz.Commenting.BlockComment.WrongEnd is incorrect Nov 1, 2015
@gsherwood gsherwood merged commit d9979d7 into squizlabs:master Nov 1, 2015
@gsherwood
Copy link
Member

Thanks a lot for finding and fixing that.

@JDGrimes JDGrimes deleted the bug/comment-close branch November 2, 2015 12:53
jrfnl added a commit to jrfnl/PHP_CodeSniffer that referenced this pull request Dec 7, 2024
…ion-short-list-bug Squiz/ArrayDeclaration: fixes false positive when handling short lists inside `foreach`
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

2 participants