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

Add rule for PHP's @ operator #496

Merged
merged 8 commits into from Apr 29, 2020
Merged

Add rule for PHP's @ operator #496

merged 8 commits into from Apr 29, 2020

Conversation

eeree
Copy link
Contributor

@eeree eeree commented Jun 14, 2017

Closes #62

@ravage84 ravage84 self-assigned this Jun 15, 2017
@ravage84 ravage84 self-requested a review June 15, 2017 09:49
@ravage84 ravage84 added this to the 2.7.0 milestone Jun 15, 2017
Copy link
Member

@ravage84 ravage84 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice!
Needs docs & rule declaration and we are good to 🚢

@eeree
Copy link
Contributor Author

eeree commented Jun 15, 2017

Rebased and squashed.

Copy link
Member

@ravage84 ravage84 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If the rule also works in the globall namespace, outside of functions or classes, then the documentation and the tests should reflect that.
If not, we should make it so.

src/main/resources/rulesets/cleancode.xml Outdated Show resolved Hide resolved
src/main/resources/rulesets/cleancode.xml Show resolved Hide resolved
@eeree
Copy link
Contributor Author

eeree commented Jun 20, 2017

@ravage84
I've just checked multiple times, but it looks like making it work in global context is impossible without some radical changed. IMO it's ready for a final review.

@ravage84
Copy link
Member

No worries. Unfortunately I'm busy as f***k. I get back at you as soon as I can. Thanks!

@gskema
Copy link

gskema commented Aug 17, 2018

Any progress on this? That's a really good check we'd like to see. In our use case, we would catch a lot of suppressed array access errors, e.g. @$array['key_not_exists'], which can be replaced with $array['key_not_exists'] ?? null in PHP 7+. Maybe it should be mentioned in the docs.

kylekatarnls
kylekatarnls previously approved these changes Jun 25, 2019
@ravage84 ravage84 modified the milestones: 2.7.0, 2.8.0 Jul 9, 2019
@kylekatarnls kylekatarnls modified the milestones: 2.8.0, 2.9.0 Oct 19, 2019
Even though there is a tendency, we shouldn't be too specific as the performance hit can and does vary between PHP versions:

https://3v4l.org/EStsR
@kylekatarnls kylekatarnls merged commit ac1dd52 into phpmd:master Apr 29, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Development

Successfully merging this pull request may close these issues.

Add rule for PHP's @ operator
5 participants