File tree Expand file tree Collapse file tree 3 files changed +54
-1
lines changed
tests/PHPStan/Rules/Methods Expand file tree Collapse file tree 3 files changed +54
-1
lines changed Original file line number Diff line number Diff line change 2121"nette/utils" : " ^3.1.1" ,
2222"nikic/php-parser" : " ^4.5.0" ,
2323"ondram/ci-detector" : " ^3.1" ,
24- "ondrejmirtes/better-reflection" : " ^4.3.5 " ,
24+ "ondrejmirtes/better-reflection" : " ^4.3.6 " ,
2525"phpdocumentor/type-resolver" : " 1.0.1" ,
2626"phpstan/phpdoc-parser" : " ^0.4.7" ,
2727"react/child-process" : " ^0.6.1" ,
Original file line number Diff line number Diff line change 22
33namespace PHPStan \Rules \Methods ;
44
5+ use Bug3406 \AbstractFoo ;
6+ use Bug3406 \ClassFoo ;
57use PHPStan \Rules \Rule ;
68use PHPStan \Testing \RuleTestCase ;
79
@@ -38,4 +40,18 @@ public function testTraitProblem(): void
3840$ this ->analyse ([__DIR__ . '/data/trait-method-problem.php ' ], []);
3941}
4042
43+ public function testBug3406 (): void
44+ {
45+ $ this ->analyse ([__DIR__ . '/data/bug-3406.php ' ], []);
46+ }
47+
48+ public function testBug3406ReflectionCheck (): void
49+ {
50+ $ this ->createBroker ();
51+ $ reflectionProvider = $ this ->createReflectionProvider ();
52+ $ reflection = $ reflectionProvider ->getClass (ClassFoo::class);
53+ $ this ->assertSame (AbstractFoo::class, $ reflection ->getNativeMethod ('myFoo ' )->getDeclaringClass ()->getName ());
54+ $ this ->assertSame (ClassFoo::class, $ reflection ->getNativeMethod ('myBar ' )->getDeclaringClass ()->getName ());
55+ }
56+
4157}
Original file line number Diff line number Diff line change 1+ <?php
2+
3+ namespace Bug3406 ;
4+
5+ abstract class AbstractFoo
6+ {
7+
8+ public function myFoo (): void
9+ {
10+
11+ }
12+
13+ public function myBar (): void
14+ {
15+
16+ }
17+
18+ }
19+
20+ trait TraitFoo
21+ {
22+
23+ abstract public function myFoo (): void ;
24+
25+ public function myBar (): void
26+ {
27+
28+ }
29+
30+ }
31+
32+ final class ClassFoo extends AbstractFoo
33+ {
34+
35+ use TraitFoo;
36+
37+ }
You can’t perform that action at this time.
0 commit comments