Open
Description
Describe the bug
Mentioned fixable sniff breaks the PHP code as follows:
Code sample
match ($foo) {
'a' => [
'x' => 0,
'y' => 0,
],
default => 0
};
Custom ruleset
<?xml version="1.0"?>
<ruleset>
<rule ref="Squiz.Arrays.ArrayDeclaration.NoComma"/>
</ruleset>
To reproduce
Steps to reproduce the behavior:
- Create a file called
test.php
with the code sample above - Create
phpcs.xml
with the custom ruleset above - Run
phpcbf test.php
- See fix applied
match ($foo) {
'a' => [
'x' => 0,
'y' => 0,
,],
default => 0
};
Expected behavior
No file changes.
Versions
Operating System | ubuntu |
PHP version | PHP 8.3.13 |
PHP_CodeSniffer version | 3.10.1 |
Standard | Squiz |
Install type | composer |
Additional context
Version 3.10.0 does not contains this issue.
Please confirm
- I have searched the issue list and am not opening a duplicate issue.
- I have read the Contribution Guidelines and this is not a support question.
- I confirm that this bug is a bug in PHP_CodeSniffer and not in one of the external standards.
- I have verified the issue still exists in the
master
branch of PHP_CodeSniffer.