Skip to content

Commit 84fa07a

Browse files
committed
ValidFunctionName: Add additional unit test for interfaces extending 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
1 parent 872d1c9 commit 84fa07a

File tree

1 file changed

+5
-0
lines changed

1 file changed

+5
-0
lines changed

WordPress/Tests/NamingConventions/ValidFunctionNameUnitTest.inc

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -104,3 +104,8 @@ class My_Soap extends somethingElse {
104104
}
105105

106106
function __MyTemplateTags() {} // Bad x 2.
107+
108+
// Verify that interfaces which extend multiple other interfaces do not throw unnecessary errors.
109+
interface MyInterface extends InterfaceA, InterfaceB {
110+
function __MyTemplateTags(); // OK.
111+
}

0 commit comments

Comments
 (0)