From f64a1c7cc9625b0b21e4aee5cb8b26143fddb4fb Mon Sep 17 00:00:00 2001 From: Markus Staab Date: Mon, 16 Sep 2024 16:10:50 +0200 Subject: [PATCH] Fix comment (#107) --- src/utils/CommentMatcher.php | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/src/utils/CommentMatcher.php b/src/utils/CommentMatcher.php index ce58d52..0fc302e 100644 --- a/src/utils/CommentMatcher.php +++ b/src/utils/CommentMatcher.php @@ -16,11 +16,17 @@ final class CommentMatcher */ public static function matchComments(Node $node, string $pattern): iterable { + if ( + $node instanceof Node\Stmt\InlineHTML + || $node instanceof \PHPStan\Node\CollectedDataNode // see https://github.com/phpstan/phpstan/discussions/11701 + ) { + // prevent unnecessary work / reduce memory consumption + return []; + } + if ( $node instanceof VirtualNode || $node instanceof Node\Expr - || $node instanceof Node\Stmt\InlineHTML - || $node instanceof \PHPStan\Node\CollectedDataNode // see https://github.com/phpstan/phpstan/discussions/11701 ) { // prevent duplicate errors return [];