Open
Description
Describe the bug
While working on expanding code coverage for the Generic.NamingConventions.UpperCaseConstantName
sniff, I noticed that it does not support named parameters resulting in false negatives.
Code sample
define(value: 'value', constant_name: 'constant');
To reproduce
Steps to reproduce the behavior:
- Create a file called
test.php
with the code sample above. - Run
phpcs test.php --standard=Generic --sniffs=Generic.NamingConventions.UpperCaseConstantName
- No error is displayed.
Expected behavior
The sniff should generate the following error:
-----------------------------------------------------------------------------------
FOUND 1 ERROR AFFECTING 1 LINE
-----------------------------------------------------------------------------------
3 | ERROR | Constants must be uppercase; expected 'CONSTANT' but found 'constant'
-----------------------------------------------------------------------------------
Versions (please complete the following information)
Operating System | Ubuntu 24.04 |
PHP version | 8.3 |
PHP_CodeSniffer version | master |
Standard | Generic |
Install type | git clone |
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.