From what we can determine, this is a typographical error / mistake. It seems that the intention here was to use the same error code for both sides of this if/else block.
Note that we are not fixing other inconsistencies in this sniff as doing so would have little return on investment.
Suggested changelog entry
Squiz.ControlStructures.ForEachLoopDeclaration: change error code from SpacingAfterOpen to SpaceAfterOpen. The latter is an existing code and the former seems to have been a typographical error.
Related issues/external references
152
Types of changes
[x] 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
PR checklist
[x] I have checked there is no other PR open for the same change.
Description
From what we can determine, this is a typographical error / mistake. It seems that the intention here was to use the same error code for both sides of this if/else block.
This inconsistency was detected as part of reviewing a fixer conflict with the PSR12 standard and the
src/Standards/Squiz/Tests/ControlStructures/ForEachLoopDeclarationUnitTest.inc
test file. See https://github.com/PHPCSStandards/PHP_CodeSniffer/issues/152#issuecomment-2227504202 for full details on this conflict and https://github.com/PHPCSStandards/PHP_CodeSniffer/issues/152#issuecomment-2255751041 for a decision on how to move forward / resolve the inconsistency.Note that we are not fixing other inconsistencies in this sniff as doing so would have little return on investment.
Suggested changelog entry
Squiz.ControlStructures.ForEachLoopDeclaration: change error code from
SpacingAfterOpen
toSpaceAfterOpen
. The latter is an existing code and the former seems to have been a typographical error.Related issues/external references
152
Types of changes
PR checklist