Skip to content

Dynamic call to static method #4

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

Closed
lookyman opened this issue Dec 27, 2017 · 6 comments
Closed

Dynamic call to static method #4

lookyman opened this issue Dec 27, 2017 · 6 comments

Comments

@lookyman
Copy link
Contributor

Hi. Would there be interest in a new rule that checks that static methods are called with :: and not with ->? I see that fairly regulary in the wild (mainly with PHPUnit's asserts) and it's driving me crazy.

@ondrejmirtes
Copy link
Member

ondrejmirtes commented Dec 27, 2017 via email

@mhujer
Copy link

mhujer commented Dec 27, 2017

See Static vs. Non-Static Usage of Assertion Methods (PHPUnit docs).

Maybe the rule should be somehow configurable to allow this special case?

@lookyman
Copy link
Contributor Author

@mhujer I have read that and I agree with the statement that there is no 'right' way. But since this package contains opinionated rules, I am trying to choose the right way. If the method is declared static, it should be called statically..

As for the configurable part, I could hardcode in some check for PHPUnit and allow a parameter to control it's behavior, but it seems to defeat the purpose..

@ondrejmirtes
Copy link
Member

@mhujer I think that you can simply ignore the errors using ignoreErrors for PHPUnit asserts :)

@ondrejmirtes
Copy link
Member

PR merged :)

@github-actions
Copy link

github-actions bot commented May 1, 2021

This thread has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs.

@github-actions github-actions bot locked as resolved and limited conversation to collaborators May 1, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants