Skip to content

Commit 6775b34

Browse files
committed
simplify
1 parent aa70750 commit 6775b34

File tree

1 file changed

+1
-7
lines changed

1 file changed

+1
-7
lines changed

src/Rules/Playground/PhpdocCommentRule.php

Lines changed: 1 addition & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -2,13 +2,11 @@
22

33
namespace PHPStan\Rules\Playground;
44

5-
use PhpParser\Comment;
65
use PhpParser\Node;
76
use PHPStan\Analyser\Scope;
87
use PHPStan\Node\VirtualNode;
98
use PHPStan\Rules\Rule;
109
use PHPStan\Rules\RuleErrorBuilder;
11-
use PHPStan\ShouldNotHappenException;
1210
use function str_contains;
1311
use function str_starts_with;
1412

@@ -29,14 +27,10 @@ public function processNode(Node $node, Scope $scope): array
2927
return [];
3028
}
3129

32-
$comments = $node->getAttribute('comments', []);
30+
$comments = $node->getComments();
3331

3432
$errors = [];
3533
foreach ($comments as $comment) {
36-
if (!$comment instanceof Comment) {
37-
throw new ShouldNotHappenException();
38-
}
39-
4034
if (!str_contains($comment->getText(), '@')) {
4135
continue;
4236
}

0 commit comments

Comments
 (0)