squizlabs / PHP_CodeSniffer

PHP_CodeSniffer tokenizes PHP files and detects violations of a defined set of coding standards.
BSD 3-Clause "New" or "Revised" License
10.67k stars 1.48k forks source link

PSR12/AnonClassDeclaration: prevent fixer creating parse error #3791

Closed jrfnl closed 11 months ago

jrfnl commented 1 year ago

This fix prevents the fixer from removing the opening brace when there is no whitespace between the last character of the name of an interface and the open brace.

With this fix in place, all other symptoms reported are also gone as they were a side-effect of the parse error being created.

Includes unit test.

Fixes #3790

jrfnl commented 11 months ago

Closing as replaced by https://github.com/PHPCSStandards/PHP_CodeSniffer/pull/56

jrfnl commented 10 months ago

FYI: this fix is included in today's PHP_CodeSniffer 3.8.0 release.

As per #3932, development on PHP_CodeSniffer will continue in the PHPCSStandards/PHP_CodeSniffer repository. If you want to stay informed, you may want to start "watching" that repo (or watching releases from that repo).