Skip to content

Conversation

jrfnl
Copy link
Member

@jrfnl jrfnl commented Jun 13, 2025

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.

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.
@jrfnl jrfnl added this to the 1.3.x Next milestone Jun 13, 2025
@jrfnl jrfnl merged commit dbd25d3 into develop Jun 13, 2025
62 checks passed
@jrfnl jrfnl deleted the feature/universal-commaspacing-bug-fix-phpcsutils-1.1.0 branch June 13, 2025 15:04
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
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