Skip to content

Generic.PHP.LowerCaseKeyword: cases and constants named empty or isset identified as PHP keywords in 3.7.0 #3611

@janedbal

Description

@janedbal

Describe the bug
Following symbols are identified as keywords:

Code sample

class SomeClass
{
    public const EMPTY = 0; // PHP keywords must be lowercase; expected "empty" but found "EMPTY" (Generic.PHP.LowerCaseKeyword.Found)
    public const ISSET = 1; // PHP keywords must be lowercase; expected "isset" but found "ISSET" (Generic.PHP.LowerCaseKeyword.Found)
}
enum MyEnum: string
{
    case Empty = 'empty'; // PHP keywords must be lowercase; expected "empty" but found "Empty" (Generic.PHP.LowerCaseKeyword.Found)
    case Isset = 'isset'; // PHP keywords must be lowercase; expected "isset" but found "Isset" (Generic.PHP.LowerCaseKeyword.Found)
}

Expected behavior
No errors

Versions (please complete the following information):

  • PHP: 8.1
  • PHPCS: 3.7.0

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions