File tree Expand file tree Collapse file tree 2 files changed +10
-3
lines changed Expand file tree Collapse file tree 2 files changed +10
-3
lines changed Original file line number Diff line number Diff line change @@ -370,13 +370,13 @@ private function processFunctionEnd(Scope $scope): array
370
370
$ usedThrowsAnnotations = $ this ->throwsScope ->exitFromThrowsAnnotationBlock ();
371
371
$ usedThrowsAnnotations = $ this ->checkedExceptionService ->filterCheckedExceptions ($ usedThrowsAnnotations );
372
372
373
- $ classReflection = $ scope ->getClassReflection ();
374
373
$ methodReflection = $ scope ->getFunction ();
375
- if ($ classReflection === null || $ methodReflection === null ) {
374
+ if ($ methodReflection === null ) {
376
375
return [];
377
376
}
378
377
379
- if ($ classReflection ->isInterface () || $ classReflection ->isAbstract ()) {
378
+ $ classReflection = $ scope ->getClassReflection ();
379
+ if ($ classReflection !== null && ($ classReflection ->isInterface () || $ classReflection ->isAbstract ())) {
380
380
return [];
381
381
}
382
382
Original file line number Diff line number Diff line change 8
8
class FooException extends RuntimeException {}
9
9
class BarException extends RuntimeException {}
10
10
11
+ /**
12
+ * @throws RuntimeException
13
+ */
14
+ function foo () { // error: Unused @throws RuntimeException annotation
15
+
16
+ }
17
+
11
18
class UnusedThrows
12
19
{
13
20
You can’t perform that action at this time.
0 commit comments