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

False negative: New classes vs Anonymous classes #334

Closed
jrfnl opened this issue Jan 20, 2017 · 1 comment · Fixed by #432
Closed

False negative: New classes vs Anonymous classes #334

jrfnl opened this issue Jan 20, 2017 · 1 comment · Fixed by #432

Comments

@jrfnl
Copy link
Member

jrfnl commented Jan 20, 2017

While this is not (yet) a real issue as no new classes have been introduced into PHP since the introduction of anonymous classes, it will start to come into play once there are.
It will also come into play once a RemovedClasses sniff would be introduced.

PHPCS < 2.7.2.

$a = new class extends DateTime {}

Just wanted to make a note of this as a reminder.

Upstream this was fixed in PHPCS 2.7.2(alpha) by adding support for T_ANON_CLASS in the PHP_Codesniffer_File->findExtendedClassName() method.
squizlabs/PHP_CodeSniffer@0011d44

@jrfnl
Copy link
Member Author

jrfnl commented Apr 13, 2017

Additional note: This issue will currently not show up in the unit tests/travis run for #383 as the PR is tested against:

  • PHPCS 1.5.x where anonymous classes were still tokenized as T_CLASS and the findExtendedClassName() will function correctly.
  • PHPCS 2.8.1 and master which already contain the fix

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

Successfully merging a pull request may close this issue.

1 participant