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

NewInterfaces/Classes: add recognition of return type declarations #578

Merged
merged 3 commits into from Feb 1, 2018

Conversation

jrfnl
Copy link
Member

@jrfnl jrfnl commented Jan 21, 2018

Verification whether interfaces/classes added in newer PHP versions were being used as return type declarations was missing from the sniffs.
This fixes that.

Uses the new Sniff::getReturnTypeHintName() method which has been added to the Sniff class in a separate commit.

Includes unit tests.

@jrfnl jrfnl added this to the 8.1.1 milestone Jan 21, 2018
@jrfnl jrfnl requested a review from wimg January 21, 2018 01:44
For single token return type declarations, the existing `Sniff::getReturnTypeHintToken()` method is sufficient to figure out whether a return type is used and what it is.

However for class and interface based return declarations which may be preceeded by a namespace with namespace separators, just having access to the classname is not sufficient.

This new method allows to retrieve the full name of the return type declaration in a manner which is PHPCS cross-version compatible.
…declaration

Verification whether interfaces added in newer PHP versions were being used as return type declarations was missing from the sniff.
This fixes that.

Uses the new `Sniff::getReturnTypeHintName()` method.

Includes unit tests.
…ations

Verification whether classes added in newer PHP versions were being used as return type declarations was missing from the sniff.
This fixes that.

Uses the new `Sniff::getReturnTypeHintName()` method.

Includes unit tests.
@wimg wimg merged commit 27f42e3 into master Feb 1, 2018
@wimg wimg deleted the feature/new-interfaces-classes-as-returntype branch February 1, 2018 17:08
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