Skip to content

Sniff SlevomatCodingStandard.PHP.UselessParentheses with option enableCheckAroundNew should consider PHP version #1805

@stlrnz

Description

@stlrnz

In #1789 you added a great new option enableCheckAroundNew to the sniff SlevomatCodingStandard.PHP.UselessParentheses to check for useless parentheses around the new operator.

However, this feature is only available since PHP 8.4: https://wiki.php.net/rfc/new_without_parentheses
The sniff reports an error regardless of the used PHP version. This is an issue for coding standards supporting older versions of PHP. It effectively makes this feature unusable in this/my scenario.

Could you update the sniff and make the flag enableCheckAroundNew aware of the PHP version?

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