1010namespace SebastianBergmann \CodeCoverage \StaticAnalysis ;
1111
1212use function assert ;
13- use function range ;
1413use PhpParser \Node ;
1514use PhpParser \Node \Attribute ;
1615use PhpParser \Node \Stmt \Class_ ;
@@ -80,7 +79,7 @@ public function enterNode(Node $node): void
8079 $ attributeGroup = $ node ->getAttribute ('parent ' );
8180 $ attributedNode = $ attributeGroup ->getAttribute ('parent ' );
8281
83- foreach ( range ( $ attributedNode ->getStartLine (), $ attributedNode ->getEndLine ()) as $ line ) {
82+ for ( $ line = $ attributedNode ->getStartLine (); $ line <= $ attributedNode ->getEndLine (); $ line++ ) {
8483 $ this ->ignoredLines [] = $ line ;
8584 }
8685
@@ -91,7 +90,7 @@ public function enterNode(Node $node): void
9190 }
9291
9392 /**
94- * @psalm-return list <int>
93+ * @psalm-return array <int>
9594 */
9695 public function ignoredLines (): array
9796 {
@@ -107,13 +106,13 @@ private function processDocComment(Node $node): void
107106 }
108107
109108 if (str_contains ($ docComment ->getText (), '@codeCoverageIgnore ' )) {
110- foreach ( range ( $ node ->getStartLine (), $ node ->getEndLine ()) as $ line ) {
109+ for ( $ line = $ node ->getStartLine (); $ line <= $ node ->getEndLine (); $ line++ ) {
111110 $ this ->ignoredLines [] = $ line ;
112111 }
113112 }
114113
115114 if ($ this ->ignoreDeprecated && str_contains ($ docComment ->getText (), '@deprecated ' )) {
116- foreach ( range ( $ node ->getStartLine (), $ node ->getEndLine ()) as $ line ) {
115+ for ( $ line = $ node ->getStartLine (); $ line <= $ node ->getEndLine (); $ line++ ) {
117116 $ this ->ignoredLines [] = $ line ;
118117 }
119118 }
0 commit comments