@@ -75,8 +75,7 @@ public function enterNode(Node $node): void
7575 }
7676
7777 if ($ node instanceof Node \Scalar \String_ ||
78- $ node instanceof Node \Scalar \EncapsedStringPart
79- ) {
78+ $ node instanceof Node \Scalar \EncapsedStringPart) {
8079 $ startLine = $ node ->getStartLine () + 1 ;
8180 $ endLine = $ node ->getEndLine () - 1 ;
8281
@@ -108,17 +107,15 @@ public function enterNode(Node $node): void
108107 $ node instanceof Node \Identifier ||
109108 $ node instanceof Node \Name ||
110109 $ node instanceof Node \Param ||
111- $ node instanceof Node \Scalar
112- ) {
110+ $ node instanceof Node \Scalar) {
113111 return ;
114112 }
115113
116114 if ($ node instanceof Node \Stmt \Function_ ||
117115 $ node instanceof Node \Stmt \Class_ ||
118116 $ node instanceof Node \Stmt \ClassMethod ||
119117 $ node instanceof Node \Expr \Closure ||
120- $ node instanceof Node \Stmt \Trait_
121- ) {
118+ $ node instanceof Node \Stmt \Trait_) {
122119 $ isConcreteClassLike = $ node instanceof Node \Stmt \Class_ || $ node instanceof Node \Stmt \Trait_;
123120
124121 if (null !== $ node ->stmts ) {
@@ -169,6 +166,7 @@ public function enterNode(Node $node): void
169166 $ node ->getStartLine () + 1 ,
170167 $ node ->expr ->getStartLine ()
171168 );
169+
172170 $ endLine = $ node ->expr ->getEndLine ();
173171
174172 if ($ endLine < $ startLine ) {
@@ -182,8 +180,7 @@ public function enterNode(Node $node): void
182180
183181 if ($ node instanceof Node \Expr \Ternary) {
184182 if (null !== $ node ->if &&
185- $ node ->getStartLine () !== $ node ->if ->getEndLine ()
186- ) {
183+ $ node ->getStartLine () !== $ node ->if ->getEndLine ()) {
187184 $ this ->setLineBranch ($ node ->if ->getStartLine (), $ node ->if ->getEndLine (), ++$ this ->nextBranch );
188185 }
189186
@@ -204,8 +201,7 @@ public function enterNode(Node $node): void
204201
205202 if ($ node instanceof Node \Stmt \If_ ||
206203 $ node instanceof Node \Stmt \ElseIf_ ||
207- $ node instanceof Node \Stmt \Case_
208- ) {
204+ $ node instanceof Node \Stmt \Case_) {
209205 if (null === $ node ->cond ) {
210206 return ;
211207 }
@@ -225,26 +221,35 @@ public function enterNode(Node $node): void
225221
226222 if ([] !== $ node ->init ) {
227223 $ startLine = $ node ->init [0 ]->getStartLine ();
224+
228225 end ($ node ->init );
226+
229227 $ endLine = current ($ node ->init )->getEndLine ();
228+
230229 reset ($ node ->init );
231230 }
232231
233232 if ([] !== $ node ->cond ) {
234233 if (null === $ startLine ) {
235234 $ startLine = $ node ->cond [0 ]->getStartLine ();
236235 }
236+
237237 end ($ node ->cond );
238+
238239 $ endLine = current ($ node ->cond )->getEndLine ();
240+
239241 reset ($ node ->cond );
240242 }
241243
242244 if ([] !== $ node ->loop ) {
243245 if (null === $ startLine ) {
244246 $ startLine = $ node ->loop [0 ]->getStartLine ();
245247 }
248+
246249 end ($ node ->loop );
250+
247251 $ endLine = current ($ node ->loop )->getEndLine ();
252+
248253 reset ($ node ->loop );
249254 }
250255
@@ -272,8 +277,7 @@ public function enterNode(Node $node): void
272277 }
273278
274279 if ($ node instanceof Node \Stmt \While_ ||
275- $ node instanceof Node \Stmt \Do_
276- ) {
280+ $ node instanceof Node \Stmt \Do_) {
277281 $ this ->setLineBranch (
278282 $ node ->cond ->getStartLine (),
279283 $ node ->cond ->getEndLine (),
@@ -328,8 +332,7 @@ public function afterTraverse(array $nodes): void
328332 (
329333 isset ($ this ->commentsToCheckForUnset [$ lineNumber ]) &&
330334 1 === preg_match (sprintf ('/^\s*%s\s*$/ ' , preg_quote ($ this ->commentsToCheckForUnset [$ lineNumber ], '/ ' )), $ line )
331- )
332- ) {
335+ )) {
333336 unset($ this ->executableLinesGroupedByBranch [$ lineNumber ]);
334337 }
335338 }
0 commit comments