File tree Expand file tree Collapse file tree 2 files changed +24
-1
lines changed Expand file tree Collapse file tree 2 files changed +24
-1
lines changed Original file line number Diff line number Diff line change @@ -141,12 +141,18 @@ public function enterNode(Node $node): void
141141 if (
142142 $ node instanceof Node \Stmt \Return_ ||
143143 $ node instanceof Node \Stmt \Continue_ ||
144- $ node instanceof Node \Stmt \Break_
144+ $ node instanceof Node \Stmt \Break_ ||
145+ $ node instanceof Node \Stmt \Goto_ ||
146+ $ node instanceof Node \Stmt \Label
145147 ) {
146148 $ returnBranch = $ this ->executableLinesGroupedByBranch [$ node ->getStartLine ()];
147149 $ returnEndLine = $ node ->getEndLine ();
148150 $ nextBranch = null ;
149151
152+ if ($ node instanceof Node \Stmt \Label) {
153+ $ returnEndLine = $ node ->getStartLine () - 1 ;
154+ }
155+
150156 foreach ($ this ->executableLinesGroupedByBranch as $ line => $ branch ) {
151157 if ($ line <= $ returnEndLine || $ branch !== $ returnBranch ) {
152158 continue ;
Original file line number Diff line number Diff line change @@ -297,4 +297,21 @@ public function withBreak() // +5
297297 ++$ var ; // +3
298298 } // -4
299299 }
300+ public function withGoto () // +5
301+ { // 0
302+ $ var = 1 ; // 0
303+ if (false ) { // 0
304+ ++$ var ; // +1
305+ goto // 0
306+ a // 0
307+ ; // 0
308+ ++$ var ; // +1
309+ } // -2
310+ ++$ var ; // 0
311+ a // +3
312+ : // 0
313+ ++$ var ; // 0
314+ b: // +1
315+ ++$ var ; // 0
316+ }
300317}
You can’t perform that action at this time.
0 commit comments