File tree Expand file tree Collapse file tree 2 files changed +15
-1
lines changed
tests/Rule/data/ForbidUnusedMatchResultRule Expand file tree Collapse file tree 2 files changed +15
-1
lines changed Original file line number Diff line number Diff line change 5
5
use PhpParser \Node ;
6
6
use PhpParser \Node \Arg ;
7
7
use PhpParser \Node \ArrayItem ;
8
+ use PhpParser \Node \Expr \ArrowFunction ;
8
9
use PhpParser \Node \Expr \Assign ;
9
10
use PhpParser \Node \Expr \AssignOp ;
10
11
use PhpParser \Node \Expr \BinaryOp \Coalesce ;
@@ -86,7 +87,8 @@ private function isUsed(Node $parent): bool
86
87
|| $ parent instanceof Ternary
87
88
|| $ parent instanceof MatchArm
88
89
|| $ parent instanceof Yield_
89
- || $ parent instanceof YieldFrom;
90
+ || $ parent instanceof YieldFrom
91
+ || $ parent instanceof ArrowFunction;
90
92
}
91
93
92
94
}
Original file line number Diff line number Diff line change @@ -70,6 +70,18 @@ public function testUsed(bool $bool): mixed
70
70
1 => 'y ' ,
71
71
} : null ;
72
72
73
+ function ($ int ) {
74
+ return match ($ int ) {
75
+ 0 => 'x ' ,
76
+ 1 => 'y ' ,
77
+ };
78
+ };
79
+
80
+ fn () => match ($ int ) {
81
+ 0 => 'x ' ,
82
+ 1 => 'y ' ,
83
+ };
84
+
73
85
return match ($ bool ) {
74
86
false => 1 ,
75
87
true => 2 ,
You can’t perform that action at this time.
0 commit comments