File tree Expand file tree Collapse file tree 2 files changed +7
-0
lines changed
tests/Rule/data/ForbidUnusedExceptionRule Expand file tree Collapse file tree 2 files changed +7
-0
lines changed Original file line number Diff line number Diff line change 77use PhpParser \Node \ArrayItem ;
88use PhpParser \Node \Expr \Assign ;
99use PhpParser \Node \Expr \BinaryOp \Coalesce ;
10+ use PhpParser \Node \Expr \ClassConstFetch ;
1011use PhpParser \Node \Expr \MethodCall ;
1112use PhpParser \Node \Expr \New_ ;
1213use PhpParser \Node \Expr \NullsafeMethodCall ;
@@ -94,6 +95,7 @@ private function isUsed(Node $parent): bool
9495 || $ parent instanceof Ternary
9596 || $ parent instanceof Yield_
9697 || $ parent instanceof Throw_
98+ || $ parent instanceof ClassConstFetch
9799 || $ parent instanceof MatchArm;
98100 }
99101
Original file line number Diff line number Diff line change @@ -59,6 +59,11 @@ public function okUsage7(string $decide): void
5959 };
6060 }
6161
62+ public function okUsage8 (): void
63+ {
64+ echo $ this ->getException ()::class;
65+ }
66+
6267 public function getExceptionAtRuntime (): RuntimeException
6368 {
6469 return new RuntimeException ();
You can’t perform that action at this time.
0 commit comments