Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Wrong keyword detection (v3.7.0) #3612

Closed
8kb opened this issue Jun 13, 2022 · 2 comments
Closed

Wrong keyword detection (v3.7.0) #3612

8kb opened this issue Jun 13, 2022 · 2 comments

Comments

@8kb
Copy link

8kb commented Jun 13, 2022

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:

  1. Create a file called Node.php with the code sample above...
  2. Run phpcs --standart=PSR12 Node.php
  3. 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
@jrfnl
Copy link
Contributor

jrfnl commented Jun 13, 2022

Duplicate of #3609 (and #3611), which has already been fixed via #3610.

@gsherwood
Copy link
Member

Confirmed fixed as stated above

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants