Skip to content

Commit dd24d8f

Browse files
committed
[CodeQuality] Avoid too early findInstanceOf() usage on RepeatedOrEqualToInArrayRector
1 parent 2bd36d2 commit dd24d8f

1 file changed

Lines changed: 3 additions & 3 deletions

File tree

rules/CodeQuality/Rector/BooleanOr/RepeatedOrEqualToInArrayRector.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -65,9 +65,6 @@ public function getNodeTypes(): array
6565
*/
6666
public function refactor(Node $node): ?FuncCall
6767
{
68-
$identicals = $this->betterNodeFinder->findInstanceOf($node, Identical::class);
69-
$equals = $this->betterNodeFinder->findInstanceOf($node, Equal::class);
70-
7168
if (! $this->isEqualOrIdentical($node->right)) {
7269
return null;
7370
}
@@ -106,6 +103,9 @@ public function refactor(Node $node): ?FuncCall
106103

107104
$args = $this->nodeFactory->createArgs([$firstComparedExprAndValue->getComparedExpr(), $array]);
108105

106+
$identicals = $this->betterNodeFinder->findInstanceOf($node, Identical::class);
107+
$equals = $this->betterNodeFinder->findInstanceOf($node, Equal::class);
108+
109109
if ($identicals !== [] && $equals === []) {
110110
$args[] = new Arg(new ConstFetch(new Name('true')));
111111
}

0 commit comments

Comments
 (0)