Skip to content

Commit cd59eee

Browse files
committed
fix
1 parent 41308ec commit cd59eee

2 files changed

Lines changed: 5 additions & 21 deletions

File tree

src/Analyser/FileAnalyser.php

Lines changed: 1 addition & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -98,8 +98,6 @@ public function analyseFile(
9898
$this->collectErrors($analysedFiles);
9999
$parserNodes = $this->parser->parseFile($file);
100100
$processedFiles[] = $file;
101-
$linesToIgnore = $unmatchedLineIgnores = [$file => $this->getLinesToIgnoreFromTokens($parserNodes)];
102-
$ignoreErrorExtensions = $this->ignoreErrorExtensionProvider->getExtensions();
103101

104102
$nodeCallback = new FileAnalyserCallback(
105103
$file,
@@ -108,12 +106,10 @@ public function analyseFile(
108106
$collectorRegistry,
109107
$outerNodeCallback,
110108
$parserNodes,
111-
$ignoreErrorExtensions,
109+
$this->ignoreErrorExtensionProvider->getExtensions(),
112110
$this->parser,
113111
$this->dependencyResolver,
114112
$this->ruleErrorTransformer,
115-
$linesToIgnore,
116-
$unmatchedLineIgnores,
117113
$processedFiles,
118114
);
119115
$scope = $this->scopeFactory->create(ScopeContext::create($file), $nodeCallback);
@@ -213,20 +209,6 @@ public function analyseFile(
213209
);
214210
}
215211

216-
/**
217-
* @param Node[] $nodes
218-
* @return array<int, non-empty-list<string>|null>
219-
*/
220-
private function getLinesToIgnoreFromTokens(array $nodes): array
221-
{
222-
if (!isset($nodes[0])) {
223-
return [];
224-
}
225-
226-
/** @var array<int, non-empty-list<string>|null> */
227-
return $nodes[0]->getAttribute('linesToIgnore', []);
228-
}
229-
230212
/**
231213
* @param array<string, true> $analysedFiles
232214
*/

src/Analyser/FileAnalyserCallback.php

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,9 @@ final class FileAnalyserCallback
3838

3939
private array $temporaryFileErrors = [];
4040

41+
private array $linesToIgnore;
42+
private array $unmatchedLineIgnores;
43+
4144
/**
4245
* @param array<string, true> $analysedFiles
4346
* @param callable(Node $node, Scope $scope): void|null $outerNodeCallback
@@ -55,11 +58,10 @@ public function __construct(
5558
private Parser $parser,
5659
private DependencyResolver $dependencyResolver,
5760
private RuleErrorTransformer $ruleErrorTransformer,
58-
private array $linesToIgnore,
59-
private array $unmatchedLineIgnores,
6061
private array $processedFiles,
6162
)
6263
{
64+
$this->linesToIgnore = $this->unmatchedLineIgnores = [$file => $this->getLinesToIgnoreFromTokens($parserNodes)];
6365
}
6466

6567
public function __invoke(Node $node, Scope $scope): void

0 commit comments

Comments
 (0)