@@ -106,27 +106,27 @@ class Cat implements AnInterface
106
106
public function test_it_should_parse_extends_class (): void
107
107
{
108
108
$ code = <<< 'EOF'
109
- <?php
109
+ <?php
110
110
111
- namespace Root\Animals;
111
+ namespace Root\Animals;
112
112
113
- class Animal
114
- {
115
- }
113
+ class Animal
114
+ {
115
+ }
116
116
117
- class Cat extends Animal
118
- {
117
+ class Cat extends Animal
118
+ {
119
119
120
- }
121
- EOF;
120
+ }
121
+ EOF;
122
122
123
123
/** @var FileParser $fp */
124
124
$ fp = FileParserFactory::createFileParser (TargetPhpVersion::create ('7.4 ' ));
125
125
$ fp ->parse ($ code , 'relativePathName ' );
126
126
127
127
$ cd = $ fp ->getClassDescriptions ()[1 ];
128
128
129
- $ this ->assertEquals ('Root\Animals\Animal ' , $ cd ->getExtends ()->toString ());
129
+ $ this ->assertEquals ('Root\Animals\Animal ' , $ cd ->getExtends ()[ 0 ] ->toString ());
130
130
}
131
131
132
132
public function test_it_should_not_parse_extends_from_insider_anonymousclass (): void
@@ -155,7 +155,7 @@ public function methodWithAnonymous(): void
155
155
156
156
$ cd = $ fp ->getClassDescriptions ()[1 ];
157
157
158
- $ this ->assertEquals ('Root\Animals\Animal ' , $ cd ->getExtends ()->toString ());
158
+ $ this ->assertEquals ('Root\Animals\Animal ' , $ cd ->getExtends ()[ 0 ] ->toString ());
159
159
}
160
160
161
161
public function test_should_depends_on_these_namespaces (): void
@@ -882,6 +882,40 @@ public function getBookList(): QueryBuilder;
882
882
$ this ->assertCount (1 , $ violations );
883
883
}
884
884
885
+ public function test_it_parse_interface_extends (): void
886
+ {
887
+ $ code = <<< 'EOF'
888
+ <?php
889
+ namespace MyProject\AppBundle\Application;
890
+
891
+ interface FooAble
892
+ {
893
+ public function foo();
894
+ }
895
+ +
896
+ interface BarAble
897
+ {
898
+ public function bar();
899
+ }
900
+
901
+
902
+ interface ForBarAble extends FooAble, BarAble
903
+ {
904
+ public function foobar();
905
+ }
906
+ EOF;
907
+
908
+ /** @var FileParser $fp */
909
+ $ fp = FileParserFactory::createFileParser (TargetPhpVersion::create ('8.1 ' ));
910
+ $ fp ->parse ($ code , 'relativePathName ' );
911
+
912
+ $ cd = $ fp ->getClassDescriptions ();
913
+
914
+ $ this ->assertCount (3 , $ cd );
915
+ $ this ->assertEquals ('MyProject\AppBundle\Application\FooAble ' , $ cd [2 ]->getExtends ()[0 ]->toString ());
916
+ $ this ->assertEquals ('MyProject\AppBundle\Application\BarAble ' , $ cd [2 ]->getExtends ()[1 ]->toString ());
917
+ }
918
+
885
919
public function test_it_handles_return_types (): void
886
920
{
887
921
$ code = <<< 'EOF'
0 commit comments