Skip to content

Commit

Permalink
ValidFunctionName: Add additional unit test for interfaces extending …
Browse files Browse the repository at this point in the history
…multiple interfaces

Interfaces can extend multiple other interfaces. Looking at the sniff code, no changes are needed in the sniff to account for this, however, adding an additional unit test to warrant against sniff changes in the future which may not take this into account.

N.B.: I've verified all other usages of the `T_INTERFACE` token in the whole of WPCS and this was the only one which looked at `extends/implements`, so the only one for which interfaces extending multiple other interfaces could be problematic.

See:
* http://php.net/manual/en/language.oop5.interfaces.php#example-208

Loosely related to:
* squizlabs/PHP_CodeSniffer#2128
  • Loading branch information
jrfnl committed Dec 16, 2018
1 parent 383df4f commit c72baef
Showing 1 changed file with 5 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -104,3 +104,8 @@ class My_Soap extends somethingElse {
}

function __MyTemplateTags() {} // Bad x 2.

// Verify that interfaces which extend multiple other interfaces do not throw unnecessary errors.
interface MyInterface extends InterfaceA, InterfaceB {
function __MyTemplateTags(); // OK.
}

0 comments on commit c72baef

Please sign in to comment.