Skip to content
Permalink
Browse files

Fix offsets when checking function suppressions

  • Loading branch information...
muglug committed Aug 18, 2019
1 parent 2a5e0d8 commit eb50aad3a1078cf2d894f27eae756147d5f92cd1
@@ -152,6 +152,12 @@ public function analyze(
$classlike_storage_provider = $codebase->classlike_storage_provider;
if ($codebase->track_unused_suppressions) {
foreach ($storage->suppressed_issues as $offset => $issue_name) {
IssueBuffer::addUnusedSuppression($this->getFilePath(), $offset, $issue_name);
}
}
$overridden_method_ids = [];
if ($this->function instanceof ClassMethod) {
@@ -1016,12 +1022,6 @@ function (FunctionLikeParameter $p) {
}
}
if ($codebase->track_unused_suppressions) {
foreach ($storage->suppressed_issues as $offset => $issue_name) {
IssueBuffer::addUnusedSuppression($this->getFilePath(), $offset, $issue_name);
}
}
foreach ($storage->throws as $expected_exception => $_) {
if (isset($storage->throw_locations[$expected_exception])) {
if (ClassLikeAnalyzer::checkFullyQualifiedClassLikeName(
@@ -300,7 +300,8 @@ function ($line) {
$new_issues = [];
foreach ($suppressed as $offset => $issue_type) {
$new_issues[$offset + $docblock->getFilePos()] = $issue_type;
$offset += $docblock->getFilePos();
$new_issues[$offset] = $issue_type;
IssueBuffer::addUnusedSuppression($this->getFilePath(), $offset, $issue_type);
}

0 comments on commit eb50aad

Please sign in to comment.
You can’t perform that action at this time.