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

Squiz.Scope.MethodScope misses visibility keyword on previous line #3575

Conversation

jrfnl
Copy link
Contributor

@jrfnl jrfnl commented Mar 31, 2022

The Squiz.Scope.MethodScope sniff is intended to check whether each method has visibility declared, but would in actual fact also enforce that the visibility should be on the same line as the function keyword as it stopped searching for the visibility keyword once it reached the start of the line.

Fixed now by using the File::getMethodProperties() method for determining visibility instead of searching with sniff specific logic.

Includes unit test.

The `Squiz.Scope.MethodScope` sniff is intended to check whether each method has visibility declared, but would in actual fact also enforce that the visibility should be on the same line as the `function` keyword as it stopped searching for the visibility keyword once it reached the start of the line.

Fixed now by using the `File::getMethodProperties()` method for determining visibility instead of searching with sniff specific logic.

Includes unit test.
@gsherwood gsherwood added this to the 3.7.0 milestone Apr 18, 2022
@gsherwood gsherwood changed the title Squiz/MethodScope: bugfix for unconventional spacing Squiz.Scope.MethodScope misses visibility keyword on previous line Jun 13, 2022
gsherwood added a commit that referenced this pull request Jun 13, 2022
@gsherwood gsherwood merged commit 89a588a into squizlabs:master Jun 13, 2022
@gsherwood
Copy link
Member

A nice clean fix to the problem. Thanks for fixing it.

@jrfnl jrfnl deleted the feature/squiz-methodscope-handle-unconventional-spacing branch June 13, 2022 06:18
@jrfnl
Copy link
Contributor Author

jrfnl commented Jun 13, 2022

Happy to help.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants