Skip to content

Commit

Permalink
Unmatched ignore comment - add error identifier
Browse files Browse the repository at this point in the history
  • Loading branch information
ondrejmirtes committed Apr 22, 2020
1 parent 824a23b commit fb9d320
Showing 1 changed file with 13 additions and 1 deletion.
14 changes: 13 additions & 1 deletion src/Analyser/FileAnalyser.php
Original file line number Diff line number Diff line change
Expand Up @@ -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'
);
}
}
Expand Down

0 comments on commit fb9d320

Please sign in to comment.