diff --git a/src/utils/CommentMatcher.php b/src/utils/CommentMatcher.php index 5355179..ce58d52 100644 --- a/src/utils/CommentMatcher.php +++ b/src/utils/CommentMatcher.php @@ -19,6 +19,7 @@ public static function matchComments(Node $node, string $pattern): iterable 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 diff --git a/tests/TodoByDateRuleTest.php b/tests/TodoByDateRuleTest.php index bc4fedd..d7f8cb9 100644 --- a/tests/TodoByDateRuleTest.php +++ b/tests/TodoByDateRuleTest.php @@ -201,4 +201,16 @@ public function testBug64(): void ], ]); } + + public function testInlineHtml(): void + { + $this->referenceTime = 'now'; + + $this->analyse([__DIR__ . '/data/inline-html.php'], [ + [ + 'Expired on 2023-12-14: Expired comment1.', + 8, + ], + ]); + } } diff --git a/tests/data/inline-html.php b/tests/data/inline-html.php new file mode 100644 index 0000000..0b979b7 --- /dev/null +++ b/tests/data/inline-html.php @@ -0,0 +1,10 @@ + + + +

hello