Skip to content

Commit

Permalink
Ignore InlineHTML to reduce memory consumption (#106)
Browse files Browse the repository at this point in the history
Co-authored-by: staabm <[email protected]>
  • Loading branch information
staabm and staabm authored Sep 16, 2024
1 parent cf30537 commit e90df6d
Show file tree
Hide file tree
Showing 3 changed files with 23 additions and 0 deletions.
1 change: 1 addition & 0 deletions src/utils/CommentMatcher.php
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
12 changes: 12 additions & 0 deletions tests/TodoByDateRuleTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -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,
],
]);
}
}
10 changes: 10 additions & 0 deletions tests/data/inline-html.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
<?php

namespace InlineHtmlTest;

?>
<head></head>
<?php
// TODO: 2023-12-14 Expired comment1
?>
<h1>hello</h1>

0 comments on commit e90df6d

Please sign in to comment.