File tree Expand file tree Collapse file tree 4 files changed +58
-14
lines changed Expand file tree Collapse file tree 4 files changed +58
-14
lines changed Original file line number Diff line number Diff line change @@ -465,9 +465,7 @@ private function findDefinerMemberKey(
465
465
}
466
466
467
467
if ($ includeParentLookup ) {
468
- $ parentNames = $ memberType === MemberType::CONSTANT
469
- ? $ this ->getAncestorNames ($ className ) // constants can be declared in interfaces
470
- : $ this ->getParentNames ($ className );
468
+ $ parentNames = $ this ->getAncestorNames ($ className );
471
469
472
470
// search for definition in parents (and its traits)
473
471
foreach ($ parentNames as $ parentName ) {
@@ -522,9 +520,7 @@ private function getPossibleDefinerMemberKeys(
522
520
}
523
521
524
522
if ($ includeParentLookup ) {
525
- $ parentNames = $ memberType === MemberType::CONSTANT
526
- ? $ this ->getAncestorNames ($ className ) // constants can be declared in interfaces
527
- : $ this ->getParentNames ($ className );
523
+ $ parentNames = $ this ->getAncestorNames ($ className );
528
524
529
525
// search for definition in parents (and its traits)
530
526
foreach ($ parentNames as $ parentName ) {
@@ -740,14 +736,6 @@ private function buildError(array $blackMembersGroup): IdentifierRuleError
740
736
return $ builder ->build ();
741
737
}
742
738
743
- /**
744
- * @return list<string>
745
- */
746
- private function getParentNames (string $ typeName ): array
747
- {
748
- return array_keys ($ this ->typeDefinitions [$ typeName ]['parents ' ] ?? []);
749
- }
750
-
751
739
/**
752
740
* @return list<string>
753
741
*/
Original file line number Diff line number Diff line change @@ -713,6 +713,7 @@ public static function provideFiles(): Traversable
713
713
yield 'method-indirect-interface-6 ' => [__DIR__ . '/data/methods/indirect-interface-6.php ' ];
714
714
yield 'method-indirect-interface-7 ' => [__DIR__ . '/data/methods/indirect-interface-7.php ' ];
715
715
yield 'method-indirect-interface-8 ' => [__DIR__ . '/data/methods/indirect-interface-8.php ' ];
716
+ yield 'method-indirect-interface-9 ' => [__DIR__ . '/data/methods/indirect-interface-9.php ' ];
716
717
yield 'method-parent-call-1 ' => [__DIR__ . '/data/methods/parent-call-1.php ' ];
717
718
yield 'method-parent-call-2 ' => [__DIR__ . '/data/methods/parent-call-2.php ' ];
718
719
yield 'method-parent-call-3 ' => [__DIR__ . '/data/methods/parent-call-3.php ' ];
@@ -777,6 +778,7 @@ public static function provideFiles(): Traversable
777
778
yield 'mixed-member-indirect-6 ' => [__DIR__ . '/data/mixed-member/indirect-interface-6.php ' ];
778
779
yield 'mixed-member-indirect-7 ' => [__DIR__ . '/data/mixed-member/indirect-interface-7.php ' ];
779
780
yield 'mixed-member-indirect-8 ' => [__DIR__ . '/data/mixed-member/indirect-interface-8.php ' ];
781
+ yield 'mixed-member-indirect-9 ' => [__DIR__ . '/data/mixed-member/indirect-interface-9.php ' ];
780
782
yield 'mixed-member-overwriting-1 ' => [__DIR__ . '/data/mixed-member/overwriting-methods-1.php ' ];
781
783
yield 'mixed-member-overwriting-2 ' => [__DIR__ . '/data/mixed-member/overwriting-methods-2.php ' ];
782
784
yield 'mixed-member-overwriting-3 ' => [__DIR__ . '/data/mixed-member/overwriting-methods-3.php ' ];
Original file line number Diff line number Diff line change
1
+ <?php declare (strict_types = 1 );
2
+
3
+ namespace DeadIndirect9 ;
4
+
5
+ interface Root
6
+ {
7
+ public function getFoo (): string ;
8
+ }
9
+
10
+ interface Intermediate extends Root
11
+ {
12
+
13
+ }
14
+
15
+ class Baz implements Intermediate
16
+ {
17
+ public function getFoo (): string
18
+ {
19
+ return 'Foo ' ;
20
+ }
21
+
22
+ }
23
+
24
+ function foobar (Intermediate $ intermediate ): void
25
+ {
26
+ echo $ intermediate ->getFoo ();
27
+ }
Original file line number Diff line number Diff line change
1
+ <?php declare (strict_types = 1 );
2
+
3
+ namespace MixedMemberIndirect9 ;
4
+
5
+ interface Root
6
+ {
7
+ public function getFoo (): string ;
8
+ }
9
+
10
+ interface Intermediate extends Root
11
+ {
12
+
13
+ }
14
+
15
+ class Baz implements Intermediate
16
+ {
17
+ public function getFoo (): string
18
+ {
19
+ return 'Foo ' ;
20
+ }
21
+
22
+ }
23
+
24
+ function foobar (Intermediate $ intermediate , string $ method ): void
25
+ {
26
+ echo $ intermediate ->$ method ();
27
+ }
You can’t perform that action at this time.
0 commit comments