Skip to content

Commit 810eb82

Browse files
committed
Skip non ignorable errors
1 parent d3ae67d commit 810eb82

File tree

2 files changed

+14
-4
lines changed

2 files changed

+14
-4
lines changed

src/Analyser/AnalyserResultFinalizer.php

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -93,7 +93,11 @@ public function finalize(AnalyserResult $analyserResult, bool $onlyFiles, bool $
9393
}
9494
}
9595

96-
$tempCollectorErrors = array_filter($tempCollectorErrors, function (string $error) use ($scope, $node) : bool {
96+
$tempCollectorErrors = array_filter($tempCollectorErrors, function (Error $error) use ($scope, $node) : bool {
97+
if (! $error->canBeIgnored()) {
98+
return true;
99+
}
100+
97101
foreach ($this->ignoreErrorExtensionProvider->getExtensions() as $ignoreErrorExtension) {
98102
if ($ignoreErrorExtension->shouldIgnore($error, $node, $scope)) {
99103
return false;

src/Analyser/FileAnalyser.php

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -145,9 +145,11 @@ public function analyseFile(
145145
foreach ($ruleErrors as $ruleError) {
146146
$error = $this->ruleErrorTransformer->transform($ruleError, $scope, $nodeType, $node->getStartLine());
147147

148-
foreach ($this->ignoreErrorExtensionProvider->getExtensions() as $ignoreErrorExtension) {
149-
if ($ignoreErrorExtension->shouldIgnore($error, $node, $scope)) {
150-
continue 2;
148+
if ($error->canBeIgnored()) {
149+
foreach ($this->ignoreErrorExtensionProvider->getExtensions() as $ignoreErrorExtension) {
150+
if ($ignoreErrorExtension->shouldIgnore($error, $node, $scope)) {
151+
continue 2;
152+
}
151153
}
152154
}
153155

@@ -291,6 +293,10 @@ public function analyseFile(
291293
}
292294

293295
$fileErrors = array_filter($fileErrors, function (Error $error) use ($scope) : bool {
296+
if (! $error->canBeIgnored()) {
297+
return true;
298+
}
299+
294300
foreach ($this->ignoreErrorExtensionProvider->getExtensions() as $ignoreErrorExtension) {
295301
if ($ignoreErrorExtension->shouldIgnore($error, null, $scope)) {
296302
return false;

0 commit comments

Comments
 (0)