Skip to content

Commit cd6b3fd

Browse files
janedbalondrejmirtes
authored andcommitted
Fix for unmatched ignored trait error being reported with partial analysis
1 parent cab991c commit cd6b3fd

File tree

2 files changed

+19
-0
lines changed

2 files changed

+19
-0
lines changed

src/Analyser/Ignore/IgnoredErrorHelperResult.php

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -218,6 +218,10 @@ public function process(
218218
continue;
219219
}
220220

221+
if ($onlyFiles) {
222+
continue;
223+
}
224+
221225
$errors[] = (new Error(
222226
sprintf(
223227
'Ignored error pattern %s was not matched in reported errors.',

tests/PHPStan/Analyser/AnalyserTest.php

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -467,6 +467,21 @@ public function testIgnoreErrorInTraitUsingClassFilePath(string $pathToIgnore):
467467
$this->assertNoErrors($result);
468468
}
469469

470+
#[DataProvider('dataIgnoreErrorInTraitUsingClassFilePath')]
471+
public function testIgnoreErrorInTraitUsingClassFilePathWithPartialAnalysis(string $pathToIgnore): void
472+
{
473+
$ignoreErrors = [
474+
[
475+
'message' => '#Fail\.#',
476+
'path' => $pathToIgnore,
477+
],
478+
];
479+
$result = $this->runAnalyser($ignoreErrors, true, [
480+
__DIR__ . '/data/traits-ignore/Foo.php',
481+
], true);
482+
$this->assertNoErrors($result);
483+
}
484+
470485
public function testIgnoredErrorMissingMessage(): void
471486
{
472487
$ignoreErrors = [

0 commit comments

Comments
 (0)