Skip to content

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

Merged
GaryJones merged 1 commit intodevelopfrom
fix/469-restrictedfunctions-false-positive-class-instantiation
Jul 27, 2020
Merged

Functions/RestrictedFunctions: fix false positive on class instantiation#561
GaryJones merged 1 commit intodevelopfrom
fix/469-restrictedfunctions-false-positive-class-instantiation

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