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

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

Closed
1 task done
irshadahmad21 opened this issue Jan 26, 2023 · 3 comments
Closed
1 task done

Comments

@irshadahmad21
Copy link

irshadahmad21 commented Jan 26, 2023

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.
@dingo-d
Copy link
Member

dingo-d commented Jan 26, 2023

I could reproduce this on the develop branch, I think this is a bug. Thanks for reporting it 👍🏼

@jrfnl
Copy link
Member

jrfnl commented Jan 26, 2023

Related to/duplicate of #1101. Function declaration statements are currently checked by a sniff which is not suitable for this and which needs to be replaced.

Note: the two PRs referenced by the OP are not directly related to the actual issue.

@dingo-d
Copy link
Member

dingo-d commented Jan 26, 2023

Ok, closing as a duplicate of #1101

@dingo-d dingo-d closed this as not planned Won't fix, can't repro, duplicate, stale Jan 26, 2023
@jrfnl jrfnl added this to the 3.0.0 milestone Aug 9, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

4 participants