File tree Expand file tree Collapse file tree 2 files changed +11
-0
lines changed
tests/Rule/data/ForbidUnusedMatchResultRule Expand file tree Collapse file tree 2 files changed +11
-0
lines changed Original file line number Diff line number Diff line change 14
14
use PhpParser \Node \Expr \Throw_ as ThrowExpr ;
15
15
use PhpParser \Node \Expr \Yield_ ;
16
16
use PhpParser \Node \Expr \YieldFrom ;
17
+ use PhpParser \Node \MatchArm ;
17
18
use PhpParser \Node \Stmt \Return_ ;
18
19
use PhpParser \Node \Stmt \Throw_ ;
19
20
use PhpParser \NodeVisitorAbstract ;
@@ -82,6 +83,7 @@ private function isUsed(Node $parent): bool
82
83
|| $ parent instanceof ArrayItem
83
84
|| $ parent instanceof NullsafeMethodCall
84
85
|| $ parent instanceof Ternary
86
+ || $ parent instanceof MatchArm
85
87
|| $ parent instanceof Yield_
86
88
|| $ parent instanceof YieldFrom
87
89
|| $ parent instanceof ThrowExpr;
Original file line number Diff line number Diff line change @@ -24,6 +24,15 @@ public function testUsed(bool $bool): mixed
24
24
true => "Bar " ,
25
25
} ?? null ;
26
26
27
+ $ a = match ($ int ) {
28
+ 0 => $ a = '0 ' ,
29
+ 1 => $ b = '1 ' ,
30
+ default => match ($ bool ) {
31
+ false => "2 " ,
32
+ true => "3 " ,
33
+ },
34
+ };
35
+
27
36
$ this ->use (match ($ bool ) {
28
37
false => new LogicException (),
29
38
true => new RuntimeException (),
You can’t perform that action at this time.
0 commit comments