File tree Expand file tree Collapse file tree 2 files changed +42
-0
lines changed Expand file tree Collapse file tree 2 files changed +42
-0
lines changed Original file line number Diff line number Diff line change @@ -126,6 +126,18 @@ public function enterNode(Node $node): void
126126 return ;
127127 }
128128
129+ if ($ node instanceof Node \Expr \Match_) {
130+ foreach ($ node ->arms as $ arm ) {
131+ $ this ->setLineBranch (
132+ $ arm ->body ->getStartLine (),
133+ $ arm ->body ->getEndLine (),
134+ ++$ this ->nextBranch
135+ );
136+ }
137+
138+ return ;
139+ }
140+
129141 if ($ node instanceof Node \Stmt \Declare_) {
130142 $ this ->unsets [] = range ($ node ->getStartLine (), $ node ->getEndLine ());
131143 }
Original file line number Diff line number Diff line change @@ -219,4 +219,34 @@ public function withSwitch() // +1
219219 ++$ var ; // +8
220220 endswitch ; // -8
221221 } // 0
222+ public function withMatch () // +9
223+ { // 0
224+ $ var = 1 ; // 0
225+ $ var2 = match ($ var ) { // 0
226+ 0 => ++$ var , // +1
227+ 1 => ++$ var , // +1
228+ default => ++$ var , // +1
229+ }; // -3
230+ $ var2 // 0
231+ = // 0
232+ match // 0
233+ ( // 0
234+ $ var // 0
235+ ) // 0
236+ { // 0
237+ 0 // 0
238+ => // 0
239+ ++$ var // +4
240+ , // -4
241+ 1 // 0
242+ => // 0
243+ ++$ var // +5
244+ , // -5
245+ default // 0
246+ => // 0
247+ ++$ var // +6
248+ , // -6
249+ } // 0
250+ ; // 0
251+ } // 0
222252}
You can’t perform that action at this time.
0 commit comments