diff --git a/src/Analyser/FileAnalyser.php b/src/Analyser/FileAnalyser.php index 2551c4b391..9d558c9344 100644 --- a/src/Analyser/FileAnalyser.php +++ b/src/Analyser/FileAnalyser.php @@ -205,12 +205,24 @@ public function analyseFile( if ($this->reportUnmatchedIgnoredErrors) { foreach (array_keys($unmatchedLineIgnores) as $line) { + $traitFilePath = null; + if ($scope->isInTrait()) { + $traitReflection = $scope->getTraitReflection(); + if ($traitReflection->getFileName() !== false) { + $traitFilePath = $traitReflection->getFileName(); + } + } $fileErrors[] = new Error( sprintf('No error to ignore is reported on line %d.', $line), $scope->getFileDescription(), $line, false, - $scope->getFile() + $scope->getFile(), + $traitFilePath, + null, + null, + null, + 'ignoredError.unmatchedOnLine' ); } }