Skip to content

Creating a new Anonymous class require Parenthesis. #1721

Closed
@LC43

Description

@LC43

Bug Description

Creating a new Anonymous class require Parenthesis but it shouldn't ( i think )

Minimal Code Snippet

return new class implements SomeInterface {}

vs

return new class() implements SomeInterface {}

Error Code

WordPress.Classes.ClassInstantiation.MissingParenthesis

Environment

Question Answer
PHP version 7.2.17
PHP_CodeSniffer version 3.4.2
WPCS version 2.1.1
WPCS install type Composer project local
IDE (if relevant) VSCode 1.34.0

Additional Context (optional)

Tested Against develop branch?

  • I have verified the issue still exists in the develop branch of WPCS.

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