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.66k stars 1.48k forks source link

PSR12.Traits.UseDeclaration: check spacing after use keyword for multi-line statements + fix typo #3856

Closed jrfnl closed 9 months ago

jrfnl commented 1 year ago

Description

PSR12.Traits.UseDeclaration: fix typo in error code

The processUseStatement() method checking single-line trait use statements checks the spacing after the use keyword, but the error did not have the correct error code.

PSR12.Traits.UseDeclaration: check spacing after use keyword for multi-line statements

While the processUseStatement() method checking single-line trait use statements would check the spacing after the use keyword, the processUseGroup() method checking multi-line trait use statements did not execute that same check, while the rule applies to both single- as well as multi-line use statements.

By moving the check for the spacing after the use keyword to the process() method, it will now be executed for both situations.

Tested by adjusting a pre-existing test.

Suggested changelog entry

Types of changes

jrfnl commented 9 months ago

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

jrfnl commented 8 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).