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

Generic/OpeningFunctionBrace*: check spacing before brace for empty functions #3869

Closed jrfnl closed 9 months ago

jrfnl commented 1 year ago

Description

Basically this is the same fix for both sniffs. The sniffs would return, instead of skip over a particular check, which meant that other checks after the check which needed to be skipped were not being run.

Generic/OpeningFunctionBraceKernighanRitchie: check spacing before brace for empty functions

As things were, when an empty function was detected, the sniff would bow out and not execute the "SpaceBeforeBrace" check.

Fixed now.

Includes tests.

Generic/OpeningFunctionBraceBsdAllman: check spacing before brace for empty functions

As things were, when an empty function was detected, the sniff would bow out and not execute the "BraceIndent" check.

Fixed now.

Includes tests.

Suggested changelog entry

Types of changes

jrfnl commented 9 months ago

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

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).