File tree Expand file tree Collapse file tree 2 files changed +16
-2
lines changed Expand file tree Collapse file tree 2 files changed +16
-2
lines changed Original file line number Diff line number Diff line change @@ -985,7 +985,11 @@ protected function scan()
985
985
case T_STRING :
986
986
switch ($ classContext ) {
987
987
case T_EXTENDS :
988
- $ this ->shortParentClass .= $ tokenContent ;
988
+ if ($ this ->isInterface ) {
989
+ $ this ->shortInterfaces [$ classInterfaceIndex ] .= $ tokenContent ;
990
+ } else {
991
+ $ this ->shortParentClass .= $ tokenContent ;
992
+ }
989
993
break ;
990
994
case T_IMPLEMENTS :
991
995
$ this ->shortInterfaces [$ classInterfaceIndex ] .= $ tokenContent ;
@@ -1006,7 +1010,8 @@ protected function scan()
1006
1010
// goto no break needed
1007
1011
1008
1012
case null :
1009
- if ($ classContext == T_IMPLEMENTS && $ tokenContent == ', ' ) {
1013
+ if (($ classContext == T_IMPLEMENTS && $ tokenContent == ', ' )
1014
+ || ($ classContext == T_EXTENDS && $ tokenContent == ', ' && $ this ->isInterface )) {
1010
1015
$ classInterfaceIndex ++;
1011
1016
$ this ->shortInterfaces [$ classInterfaceIndex ] = '' ;
1012
1017
}
Original file line number Diff line number Diff line change @@ -307,4 +307,13 @@ public function testTraitIsNotInstantiable()
307
307
$ this ->assertTrue ($ class ->isTrait ());
308
308
$ this ->assertFalse ($ class ->isInstantiable ());
309
309
}
310
+
311
+ public function testGetInterfacesFromInterface ()
312
+ {
313
+ $ file = new FileScanner (__DIR__ . '/../TestAsset/FooInterface.php ' );
314
+ $ class = $ file ->getClass ('ZendTest\Code\TestAsset\FooInterface ' );
315
+ $ this ->assertTrue ($ class ->isInterface ());
316
+ $ this ->assertEquals (1 , count ($ class ->getInterfaces ()));
317
+ $ this ->assertEquals ('ArrayAccess ' , $ class ->getInterfaces ()[0 ]);
318
+ }
310
319
}
You can’t perform that action at this time.
0 commit comments