Skip to content

"NoSpaceBeforeCloseParenthesis" not fired for function declarations in interfaces. #2204

@irshadahmad21

Description

@irshadahmad21

The bug, first introduced in #617 and then in #1262 disables the "NoSpaceBeforeCloseParenthesis" error for function declarations in interfaces.

Bug Description

Not having a space before closing parenthesis shows an error for class methods and functions, but it does not do so for the function declarations in interfaces.

Minimal Code Snippet

The issue happens when running this command:

phpcs ...

... over a file containing this code:

interface SomeInterface { /**  * Does something  */ public function some_method( $arg1); // See no space before ) ^^ }

There is no warning about no space before closing parenthesis, while I expect the error to be something like this:

ERROR | [x] Expected 1 space before closing parenthesis; 0 found 

Error Code

Custom ruleset

<?xml version="1.0"?> <ruleset name="My Custom Standard"> <rule ref="WordPress-Extra" /> </ruleset>

Environment

Question Answer
PHP version 7.4
PHP_CodeSniffer version 3.7.1
WPCS version 2.3.0
WPCS install type Composer
IDE (if relevant) VS Code 1.74.3

Tested Against develop branch?

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

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions