Skip to content

Commit c73c210

Browse files
committed
fix
1 parent ed7aabf commit c73c210

File tree

1 file changed

+2
-11
lines changed

1 file changed

+2
-11
lines changed

rules/DowngradePhp82/Rector/FuncCall/DowngradeIteratorCountToArrayRector.php

Lines changed: 2 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -6,13 +6,11 @@
66

77
use PhpParser\Node;
88
use PhpParser\Node\Arg;
9-
use PhpParser\Node\Expr;
109
use PhpParser\Node\Expr\FuncCall;
1110
use PhpParser\Node\Expr\New_;
1211
use PhpParser\Node\Expr\Ternary;
1312
use PhpParser\Node\Name\FullyQualified;
1413
use PHPStan\Type\Type;
15-
use PHPStan\Type\UnionType;
1614
use Rector\NodeAnalyzer\ArgsAnalyzer;
1715
use Rector\Rector\AbstractRector;
1816
use Symplify\RuleDocGenerator\ValueObject\CodeSample\CodeSample;
@@ -87,7 +85,7 @@ public function refactor(Node $node): ?Node
8785
}
8886

8987
$type = $this->nodeTypeResolver->getType($args[0]->value);
90-
if ($this->shouldSkip($type, $args[0]->value)) {
88+
if ($this->shouldSkip($type)) {
9189
return null;
9290
}
9391

@@ -103,19 +101,12 @@ public function refactor(Node $node): ?Node
103101
return $node;
104102
}
105103

106-
private function shouldSkip(Type $type, Expr $expr): bool
104+
private function shouldSkip(Type $type): bool
107105
{
108-
// only array type
109106
if ($type->isArray()->yes()) {
110107
return false;
111108
}
112109

113-
if ($type instanceof UnionType) {
114-
// possibly already transformed
115-
return $expr instanceof Ternary;
116-
}
117-
118-
// already has object type check
119110
return $type->isObject()
120111
->yes();
121112
}

0 commit comments

Comments
 (0)