Skip to content

Commit d41f065

Browse files
committed
WrongVariableNameInVarTagRule - simplification
1 parent cbbbd36 commit d41f065

File tree

1 file changed

+3
-8
lines changed

1 file changed

+3
-8
lines changed

src/Rules/PhpDoc/WrongVariableNameInVarTagRule.php

Lines changed: 3 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010
use PHPStan\Type\FileTypeMapper;
1111

1212
/**
13-
* @implements \PHPStan\Rules\Rule<\PhpParser\Node>
13+
* @implements \PHPStan\Rules\Rule<\PhpParser\Node\Stmt>
1414
*/
1515
class WrongVariableNameInVarTagRule implements Rule
1616
{
@@ -24,15 +24,13 @@ public function __construct(FileTypeMapper $fileTypeMapper)
2424

2525
public function getNodeType(): string
2626
{
27-
return \PhpParser\Node::class;
27+
return \PhpParser\Node\Stmt::class;
2828
}
2929

3030
public function processNode(Node $node, Scope $scope): array
3131
{
3232
if (
3333
!$node instanceof Node\Stmt\Foreach_
34-
&& !$node instanceof Node\Expr\Assign
35-
&& !$node instanceof Node\Expr\AssignRef
3634
&& !$node instanceof Node\Stmt\Static_
3735
&& !$node instanceof Node\Stmt\Echo_
3836
&& !$node instanceof Node\Stmt\Return_
@@ -64,9 +62,6 @@ public function processNode(Node $node, Scope $scope): array
6462
if (count($varTags) === 0) {
6563
return [];
6664
}
67-
if ($node instanceof Node\Expr\Assign || $node instanceof Node\Expr\AssignRef) {
68-
return $this->processAssign($scope, $node->var, $varTags);
69-
}
7065

7166
if ($node instanceof Node\Stmt\Foreach_) {
7267
return $this->processForeach($node->keyVar, $node->valueVar, $varTags);
@@ -254,7 +249,7 @@ private function processStatic(array $vars, array $varTags): array
254249
private function processExpression(Scope $scope, Expr $expr, array $varTags): array
255250
{
256251
if ($expr instanceof Node\Expr\Assign || $expr instanceof Node\Expr\AssignRef) {
257-
return [];
252+
return $this->processAssign($scope, $expr->var, $varTags);
258253
}
259254

260255
return $this->processStmt($scope, $varTags, null);

0 commit comments

Comments
 (0)