File tree Expand file tree Collapse file tree 3 files changed +30
-4
lines changed Expand file tree Collapse file tree 3 files changed +30
-4
lines changed Original file line number Diff line number Diff line change @@ -21,6 +21,9 @@ parameters:
21
21
- PHPUnit\Framework\Exception
22
22
- Nette\DI\MissingServiceException
23
23
methodThrowTypeDeclarations:
24
+ ReflectionMethod:
25
+ getPrototype:
26
+ - ReflectionException
24
27
PHPStan\Broker\Broker:
25
28
getClass:
26
29
- PHPStan\Broker\ClassNotFoundException
Original file line number Diff line number Diff line change @@ -130,9 +130,19 @@ private function getDocblock($reflection): ?string
130
130
{
131
131
if ($ reflection instanceof MethodReflection) {
132
132
$ declaringClass = $ reflection ->getDeclaringClass ();
133
- $ nativeClassReflection = $ declaringClass ->getNativeReflection ();
134
- $ nativeMethodReflection = $ nativeClassReflection ->getMethod ($ reflection ->getName ());
135
- $ docBlock = $ nativeMethodReflection ->getDocComment ();
133
+ $ classReflection = $ declaringClass ->getNativeReflection ();
134
+ $ methodReflection = $ classReflection ->getMethod ($ reflection ->getName ());
135
+ $ docBlock = $ methodReflection ->getDocComment ();
136
+
137
+ while ($ docBlock === false ) {
138
+ try {
139
+ $ methodReflection = $ methodReflection ->getPrototype ();
140
+ } catch (ReflectionException $ exception ) {
141
+ return null ;
142
+ }
143
+
144
+ $ docBlock = $ methodReflection ->getDocComment ();
145
+ }
136
146
137
147
return $ docBlock !== false ? $ docBlock : null ;
138
148
}
Original file line number Diff line number Diff line change @@ -57,9 +57,22 @@ function descriptiveAnnotationAlias(): void
57
57
throw new LogicException ();
58
58
}
59
59
60
- class UnusedThrows
60
+ interface Foo {
61
+
62
+ /**
63
+ * @throws LogicException Description.
64
+ */
65
+ public function uncheckedException (): void ;
66
+ }
67
+
68
+ class UnusedThrows implements Foo
61
69
{
62
70
71
+ public function uncheckedException () : void
72
+ {
73
+ throw new LogicException ();
74
+ }
75
+
63
76
/**
64
77
* @throws RuntimeException
65
78
* @throws RuntimeException Description.
You can’t perform that action at this time.
0 commit comments