Skip to content

Conversation

@jrfnl
Copy link
Member

@jrfnl jrfnl commented Jan 22, 2020

Interfaces can extend more than one interface (in contrast to classes) and both the PHPCS native, as well as the Util\ObjectDeclarations findExtendedClassName() method does not allow for that.
See: http://php.net/manual/en/language.oop5.interfaces.php#example-208

To allow for this from within the existing findExtendedClassName() method would change the function signature from @return string|false to @return string|array|false, thus breaking the API.

So, instead, a new ObjectDeclarations::findExtendedInterfaceNames() method has been added and it is now explicitly recommended in the documentation of the findExtendedClassName() method to use the new method when examining interface declarations.

Includes dedicated unit tests for the new method.

This commit supersedes upstream PR squizlabs/PHP_CodeSniffer#2128.

Interfaces can extend more than one interface (in contrast to classes) and both the PHPCS native, as well as  the `Util\ObjectDeclarations` `findExtendedClassName()` method does not allow for that.
See: http://php.net/manual/en/language.oop5.interfaces.php#example-208

To allow for this from within the existing `findExtendedClassName()` method would change the function signature from `@return string|false` to `@return string|array|false`, thus breaking the API.

So, instead, a new `ObjectDeclarations::findExtendedInterfaceNames()` method has been added and it is now explicitly recommended in the documentation of the `findExtendedClassName()` method to use the new method when examining interface declarations.

Includes dedicated unit tests for the new method.

This commit supersedes upstream PR 2128.
@jrfnl jrfnl added this to the 1.0.0 milestone Jan 22, 2020
@jrfnl jrfnl merged commit bcd9262 into develop Jan 22, 2020
@jrfnl jrfnl deleted the feature/new-objectdecl-findextendedinterfacenames-method branch January 22, 2020 14:59
@jrfnl jrfnl modified the milestones: 1.0.0, 1.0.0-alpha1 May 1, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Development

Successfully merging this pull request may close these issues.

2 participants