-
Notifications
You must be signed in to change notification settings - Fork 1.5k
Closed
Description
Describe the bug
phpcs parse const name as keyword, and expect its lowercase. But its legal const name not restricted by php or by standard.
Yep, in other context its keyword, but its allowed to use it as const name.
If in some reason you decide what its not allowed -> it will show relevant error, not about "lowercase'.
Code sample
namespace Brand\Ast;
class Node
{
public const AND = '&&';
public const NOT = '!';
public const EMPTY = 'empty';
}
To reproduce
Steps to reproduce the behavior:
- Create a file called
Node.php
with the code sample above... - Run
phpcs --standart=PSR12 Node.php
- See error message displayed
------------------------------------------------------------------------------------
FOUND 1 ERROR AFFECTING 1 LINE
------------------------------------------------------------------------------------
9 | ERROR | [x] PHP keywords must be lowercase; expected "empty" but found "EMPTY"
------------------------------------------------------------------------------------
PHPCBF CAN FIX THE 1 MARKED SNIFF VIOLATIONS AUTOMATICALLY
------------------------------------------------------------------------------------
Expected behavior
No error, or (if its restricted by standard) warning about reserved word
Versions:
- OS: Linux
- PHP: 7.1
- PHPCS: 3.7.0
- Standard: PSR12
Metadata
Metadata
Assignees
Labels
No labels