Skip to content

Commit

Permalink
use VirtualDeclare to signal Psalm the statement is not real
Browse files Browse the repository at this point in the history
  • Loading branch information
orklah committed Aug 30, 2021
1 parent 02aa9b3 commit cdbc82e
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion src/Hooks/StrictTypesHooks.php
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@
use Psalm\Internal\Analyzer\FunctionLikeAnalyzer;
use Psalm\Internal\Analyzer\ProjectAnalyzer;
use Psalm\IssueBuffer;
use Psalm\Node\Stmt\VirtualDeclare;
use Psalm\NodeTypeProvider;
use Psalm\Plugin\EventHandler\AfterFileAnalysisInterface;
use Psalm\Plugin\EventHandler\AfterFunctionLikeAnalysisInterface;
Expand Down Expand Up @@ -130,7 +131,7 @@ public static function afterAnalyzeFile(AfterFileAnalysisEvent $event): void
}
} else {
$issue = new StrictDeclarationToAddIssue('This file can have a strict declaration added',
new CodeLocation($statements_source, new Declare_([], null, ['startLine' => 0]))
new CodeLocation($statements_source, new VirtualDeclare([], null, ['startLine' => 0]))
);

IssueBuffer::accepts($issue, $statements_source->getSuppressedIssues());
Expand Down

0 comments on commit cdbc82e

Please sign in to comment.