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

Improve DeprecatedPHP4StyleConstructors sniff (code review). #167

Merged

Conversation

jrfnl
Copy link
Member

@jrfnl jrfnl commented Aug 14, 2016

  • Bow out early when PHP7 does not have to be supported.
  • Defer to PHPCS native methods for determining the class and function names.
  • Don't trigger error for namespaced classes with a method with the same name as the class.

As of PHP 5.3.3, methods with the same name as the last element of a namespaced class name will no longer be treated as constructor. This change doesn't affect non-namespaced classes.

Ref: http://php.net/manual/en/language.oop5.decon.php

Includes unit test for namespaced class with same name method.
Includes additional unit tests verifying the noViolation cases.

* Bow out early when PHP7 does not have to be supported.
* Defer to PHPCS native methods for determining the class and function names.
* Don't trigger error for namespaced classes with a method with the same name as the class.

> As of PHP 5.3.3, methods with the same name as the last element of a namespaced class name will no longer be treated as constructor. This change doesn't affect non-namespaced classes.

Ref: http://php.net/manual/en/language.oop5.decon.php

Includes unit test for namespaced class with same name method.
Includes additional unit tests verifying the `noViolation` cases.
@wimg wimg merged commit a61d87c into PHPCompatibility:master Aug 14, 2016
@jrfnl jrfnl deleted the feature/improve-deprecated-constructors branch August 14, 2016 13:50
@jrfnl jrfnl added this to the 7.0.3 milestone Apr 30, 2017
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.

None yet

2 participants