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

Functions/RestrictedFunctions: fix false positive on class instantiation #561

Conversation

jrfnl
Copy link
Collaborator

@jrfnl jrfnl commented Jul 27, 2020

Quick fix for false positives on class instantiation.

First new unit test was already ok, second unit test would previously fail.

Fixes #469

Notes:

  • I've pointedly ignored everything else which could be improved in this sniff and just focused on getting this particular issue fixed for now.
  • The parent is_targetted_token() method has diverged quite a bit from what is in the method in this class.
    Rather than address this now, I propose to address this once the improved/namespace and use context aware abstracts in PHPCSUtils are available as this sniff would benefit from switching over to such abstract.

Quick fix for false positives on class instantiation.

First new unit test was already ok, second unit test would previously fail.

Fixes 469
@jrfnl jrfnl added this to the 2.2.0 milestone Jul 27, 2020
@jrfnl jrfnl requested a review from a team as a code owner July 27, 2020 21:46
@GaryJones GaryJones merged commit 84605b5 into develop Jul 27, 2020
@GaryJones GaryJones deleted the fix/469-restrictedfunctions-false-positive-class-instantiation branch July 27, 2020 22:40
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.

RestrictedFunctions sniff incorrectly captures class instantiations
2 participants