99 */
1010namespace SebastianBergmann \CodeCoverage \StaticAnalysis ;
1111
12- use function array_merge ;
1312use function assert ;
1413use function range ;
1514use PhpParser \Node ;
2726final class IgnoredLinesFindingVisitor extends NodeVisitorAbstract
2827{
2928 /**
30- * @psalm-var list <int>
29+ * @psalm-var array <int>
3130 */
3231 private array $ ignoredLines = [];
3332
@@ -81,10 +80,9 @@ public function enterNode(Node $node): void
8180 $ attributeGroup = $ node ->getAttribute ('parent ' );
8281 $ attributedNode = $ attributeGroup ->getAttribute ('parent ' );
8382
84- $ this ->ignoredLines = array_merge (
85- $ this ->ignoredLines ,
86- range ($ attributedNode ->getStartLine (), $ attributedNode ->getEndLine ())
87- );
83+ foreach (range ($ attributedNode ->getStartLine (), $ attributedNode ->getEndLine ()) as $ line ) {
84+ $ this ->ignoredLines [] = $ line ;
85+ }
8886
8987 return ;
9088 }
@@ -109,17 +107,15 @@ private function processDocComment(Node $node): void
109107 }
110108
111109 if (str_contains ($ docComment ->getText (), '@codeCoverageIgnore ' )) {
112- $ this ->ignoredLines = array_merge (
113- $ this ->ignoredLines ,
114- range ($ node ->getStartLine (), $ node ->getEndLine ())
115- );
110+ foreach (range ($ node ->getStartLine (), $ node ->getEndLine ()) as $ line ) {
111+ $ this ->ignoredLines [] = $ line ;
112+ }
116113 }
117114
118115 if ($ this ->ignoreDeprecated && str_contains ($ docComment ->getText (), '@deprecated ' )) {
119- $ this ->ignoredLines = array_merge (
120- $ this ->ignoredLines ,
121- range ($ node ->getStartLine (), $ node ->getEndLine ())
122- );
116+ foreach (range ($ node ->getStartLine (), $ node ->getEndLine ()) as $ line ) {
117+ $ this ->ignoredLines [] = $ line ;
118+ }
123119 }
124120 }
125121}
0 commit comments