Universal/CommaSpacing: fix for PHPCSUtils 1.1.0#362
Merged
Conversation
As of PHPCS 4.x - and PHPCS cross-version as of PHPCSUtils 1.1.0, a closure `T_USE` token is now a parenthesis owner. This also means that when PHPCSUtils 1.1.0 is used, the `T_USE` will be recognized as a parentheses owner, which means the dedicated error code is broken as the logic will go into the switch and end up using the default error code and will never reach the fall-back logic for "unowned" parentheses, in which this was previously handled. The tests don't fail on this as the tests don't currently safeguard that the correct _error code_ is thrown, they just verify the number of errors and that was unchanged. Either way, fixed now. Includes minor inline doc clean-up.
wmfgerrit
pushed a commit
to wikimedia/mediawiki-tools-codesniffer
that referenced
this pull request
Jun 16, 2025
Due to a change in phpcsstandards/phpcsutils, this repo needs newer phpcsstandards/phpcsextra to pass tests. The indirect dependency phpcsstandards/phpcsutils is updated from 1.0.12 to 1.1.0 and sniff error codes changed as sniffs now detect errors outside the closure scope. This is fixed in the direct dependency phpcsstandards/phpcsextra via PHPCSStandards/PHPCSExtra#362 to report the previous sniff error codes. phpcsstandards/phpcsextra 1.3.0 requires phpcsstandards/phpcsutils with ^1.0.9, that allows update to 1.1.0 https://github.com/PHPCSStandards/PHPCSUtils/releases/tag/1.1.0 https://github.com/PHPCSStandards/PHPCSExtra/releases/tag/1.4.0 Change-Id: I82c21c8e28bb621830f44e38c8fa08d4eb3460c6
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
As of PHPCS 4.x - and PHPCS cross-version as of PHPCSUtils 1.1.0, a closure
T_USEtoken is now a parenthesis owner.This also means that when PHPCSUtils 1.1.0 is used, the
T_USEwill be recognized as a parentheses owner, which means the dedicated error code is broken as the logic will go into the switch and end up using the default error code and will never reach the fall-back logic for "unowned" parentheses, in which this was previously handled.The tests don't fail on this as the tests don't currently safeguard that the correct error code is thrown, they just verify the number of errors and that was unchanged.
Either way, fixed now.
Includes minor inline doc clean-up.