Skip to content

Conversation

jrfnl
Copy link
Member

@jrfnl jrfnl commented Nov 11, 2023

Description

Recreation of upstream PR squizlabs/PHP_CodeSniffer#3869:

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

  • Generic/OpeningFunctionBraceKernighanRitchie: spacing before opening brace will now also be checked for empty functions
  • Generic/OpeningFunctionBraceBsdAllman: brace indent will now also be checked for empty functions

Types of changes

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to change)
    • This change is only breaking for integrators, not for external standards or end-users.
  • Documentation improvement

jrfnl added 2 commits December 5, 2023 15:36
…ace 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.
… 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.
@jrfnl jrfnl force-pushed the feature/generic-openingfunctionbrace-check-space-before-brace branch from 8f06255 to 1c10cba Compare December 5, 2023 14:36
@jrfnl jrfnl merged commit c0e4cfb into master Dec 5, 2023
@jrfnl jrfnl deleted the feature/generic-openingfunctionbrace-check-space-before-brace branch December 5, 2023 14:50
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant