Skip to content

Commit fb9d320

Browse files
committed
Unmatched ignore comment - add error identifier
1 parent 824a23b commit fb9d320

File tree

1 file changed

+13
-1
lines changed

1 file changed

+13
-1
lines changed

src/Analyser/FileAnalyser.php

+13-1
Original file line numberDiff line numberDiff line change
@@ -205,12 +205,24 @@ public function analyseFile(
205205

206206
if ($this->reportUnmatchedIgnoredErrors) {
207207
foreach (array_keys($unmatchedLineIgnores) as $line) {
208+
$traitFilePath = null;
209+
if ($scope->isInTrait()) {
210+
$traitReflection = $scope->getTraitReflection();
211+
if ($traitReflection->getFileName() !== false) {
212+
$traitFilePath = $traitReflection->getFileName();
213+
}
214+
}
208215
$fileErrors[] = new Error(
209216
sprintf('No error to ignore is reported on line %d.', $line),
210217
$scope->getFileDescription(),
211218
$line,
212219
false,
213-
$scope->getFile()
220+
$scope->getFile(),
221+
$traitFilePath,
222+
null,
223+
null,
224+
null,
225+
'ignoredError.unmatchedOnLine'
214226
);
215227
}
216228
}

0 commit comments

Comments
 (0)