@@ -69,8 +69,7 @@ public function enterNode(Node $node): void
6969 }
7070
7171 if ($ node instanceof Node \Scalar \String_ ||
72- $ node instanceof Node \Scalar \EncapsedStringPart
73- ) {
72+ $ node instanceof Node \Scalar \EncapsedStringPart) {
7473 $ startLine = $ node ->getStartLine () + 1 ;
7574 $ endLine = $ node ->getEndLine () - 1 ;
7675
@@ -102,17 +101,15 @@ public function enterNode(Node $node): void
102101 $ node instanceof Node \Identifier ||
103102 $ node instanceof Node \Name ||
104103 $ node instanceof Node \Param ||
105- $ node instanceof Node \Scalar
106- ) {
104+ $ node instanceof Node \Scalar) {
107105 return ;
108106 }
109107
110108 if ($ node instanceof Node \Stmt \Function_ ||
111109 $ node instanceof Node \Stmt \Class_ ||
112110 $ node instanceof Node \Stmt \ClassMethod ||
113111 $ node instanceof Node \Expr \Closure ||
114- $ node instanceof Node \Stmt \Trait_
115- ) {
112+ $ node instanceof Node \Stmt \Trait_) {
116113 $ isConcreteClassLike = $ node instanceof Node \Stmt \Class_ || $ node instanceof Node \Stmt \Trait_;
117114
118115 if (null !== $ node ->stmts ) {
@@ -163,6 +160,7 @@ public function enterNode(Node $node): void
163160 $ node ->getStartLine () + 1 ,
164161 $ node ->expr ->getStartLine ()
165162 );
163+
166164 $ endLine = $ node ->expr ->getEndLine ();
167165
168166 if ($ endLine < $ startLine ) {
@@ -176,8 +174,7 @@ public function enterNode(Node $node): void
176174
177175 if ($ node instanceof Node \Expr \Ternary) {
178176 if (null !== $ node ->if &&
179- $ node ->getStartLine () !== $ node ->if ->getEndLine ()
180- ) {
177+ $ node ->getStartLine () !== $ node ->if ->getEndLine ()) {
181178 $ this ->setLineBranch ($ node ->if ->getStartLine (), $ node ->if ->getEndLine (), ++$ this ->nextBranch );
182179 }
183180
@@ -198,8 +195,7 @@ public function enterNode(Node $node): void
198195
199196 if ($ node instanceof Node \Stmt \If_ ||
200197 $ node instanceof Node \Stmt \ElseIf_ ||
201- $ node instanceof Node \Stmt \Case_
202- ) {
198+ $ node instanceof Node \Stmt \Case_) {
203199 if (null === $ node ->cond ) {
204200 return ;
205201 }
@@ -219,26 +215,35 @@ public function enterNode(Node $node): void
219215
220216 if ([] !== $ node ->init ) {
221217 $ startLine = $ node ->init [0 ]->getStartLine ();
218+
222219 end ($ node ->init );
220+
223221 $ endLine = current ($ node ->init )->getEndLine ();
222+
224223 reset ($ node ->init );
225224 }
226225
227226 if ([] !== $ node ->cond ) {
228227 if (null === $ startLine ) {
229228 $ startLine = $ node ->cond [0 ]->getStartLine ();
230229 }
230+
231231 end ($ node ->cond );
232+
232233 $ endLine = current ($ node ->cond )->getEndLine ();
234+
233235 reset ($ node ->cond );
234236 }
235237
236238 if ([] !== $ node ->loop ) {
237239 if (null === $ startLine ) {
238240 $ startLine = $ node ->loop [0 ]->getStartLine ();
239241 }
242+
240243 end ($ node ->loop );
244+
241245 $ endLine = current ($ node ->loop )->getEndLine ();
246+
242247 reset ($ node ->loop );
243248 }
244249
@@ -266,8 +271,7 @@ public function enterNode(Node $node): void
266271 }
267272
268273 if ($ node instanceof Node \Stmt \While_ ||
269- $ node instanceof Node \Stmt \Do_
270- ) {
274+ $ node instanceof Node \Stmt \Do_) {
271275 $ this ->setLineBranch (
272276 $ node ->cond ->getStartLine (),
273277 $ node ->cond ->getEndLine (),
@@ -322,8 +326,7 @@ public function afterTraverse(array $nodes): void
322326 (
323327 isset ($ this ->commentsToCheckForUnset [$ lineNumber ]) &&
324328 1 === preg_match (sprintf ('/^\s*%s\s*$/ ' , preg_quote ($ this ->commentsToCheckForUnset [$ lineNumber ], '/ ' )), $ line )
325- )
326- ) {
329+ )) {
327330 unset($ this ->executableLinesGroupedByBranch [$ lineNumber ]);
328331 }
329332 }
0 commit comments