From 214fd876144e7f658d320a6b706315b0608eef2e Mon Sep 17 00:00:00 2001 From: Markus Staab Date: Mon, 16 Sep 2024 15:46:24 +0200 Subject: [PATCH 1/4] Create inline-html.php --- tests/data/inline-html.php | 11 +++++++++++ 1 file changed, 11 insertions(+) create mode 100644 tests/data/inline-html.php diff --git a/tests/data/inline-html.php b/tests/data/inline-html.php new file mode 100644 index 0000000..d66720a --- /dev/null +++ b/tests/data/inline-html.php @@ -0,0 +1,11 @@ + + + +

hello

From ce6262eb66090bbb1d47f3acbed92d4db8e0b379 Mon Sep 17 00:00:00 2001 From: Markus Staab Date: Mon, 16 Sep 2024 15:48:24 +0200 Subject: [PATCH 2/4] Ignore InlineHTML to reduce memory consumption --- src/utils/CommentMatcher.php | 1 + tests/TodoByDateRuleTest.php | 13 +++++++++++++ tests/data/inline-html.php | 1 - 3 files changed, 14 insertions(+), 1 deletion(-) 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..7ae8c75 100644 --- a/tests/TodoByDateRuleTest.php +++ b/tests/TodoByDateRuleTest.php @@ -201,4 +201,17 @@ 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 index d66720a..4726d6c 100644 --- a/tests/data/inline-html.php +++ b/tests/data/inline-html.php @@ -6,6 +6,5 @@

hello

From 488dd75b4651fd1b0f9d58ff4fd160a8f52246d5 Mon Sep 17 00:00:00 2001 From: staabm Date: Mon, 16 Sep 2024 13:51:07 +0000 Subject: [PATCH 3/4] Apply php-cs-fixer changes --- tests/TodoByDateRuleTest.php | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/tests/TodoByDateRuleTest.php b/tests/TodoByDateRuleTest.php index 7ae8c75..d7f8cb9 100644 --- a/tests/TodoByDateRuleTest.php +++ b/tests/TodoByDateRuleTest.php @@ -209,9 +209,8 @@ public function testInlineHtml(): void $this->analyse([__DIR__ . '/data/inline-html.php'], [ [ 'Expired on 2023-12-14: Expired comment1.', - 8 - ] + 8, + ], ]); } - } From b50db7a4e97ec573987c55fcffc31736c5266ea7 Mon Sep 17 00:00:00 2001 From: Markus Staab Date: Mon, 16 Sep 2024 15:51:19 +0200 Subject: [PATCH 4/4] Update inline-html.php --- tests/data/inline-html.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/data/inline-html.php b/tests/data/inline-html.php index 4726d6c..0b979b7 100644 --- a/tests/data/inline-html.php +++ b/tests/data/inline-html.php @@ -1,6 +1,6 @@