Skip to content

Commit

Permalink
[ci-review] Rector Rectify
Browse files Browse the repository at this point in the history
  • Loading branch information
actions-user committed Oct 5, 2021
1 parent 09a5b9f commit c60f6a5
Showing 1 changed file with 8 additions and 8 deletions.
16 changes: 8 additions & 8 deletions rules/Strict/NodeFactory/ExactCompareFactory.php
Original file line number Diff line number Diff line change
Expand Up @@ -78,25 +78,25 @@ public function createNotIdenticalFalsyCompare(Type $exprType, Expr $expr, bool
return $this->createFromUnionType($exprType, $expr, $treatAsNotEmpty);
}

private function createFromUnionType(UnionType $exprType, Expr $expr, bool $treatAsNotEmpty): Expr|null
private function createFromUnionType(UnionType $unionType, Expr $expr, bool $treatAsNotEmpty): Expr|null
{
$exprType = TypeCombinator::removeNull($exprType);
$unionType = TypeCombinator::removeNull($unionType);

if ($exprType instanceof BooleanType) {
if ($unionType instanceof BooleanType) {
return new Identical($expr, $this->nodeFactory->createTrue());
}

if ($exprType instanceof TypeWithClassName) {
return new Instanceof_($expr, new FullyQualified($exprType->getClassName()));
if ($unionType instanceof TypeWithClassName) {
return new Instanceof_($expr, new FullyQualified($unionType->getClassName()));
}

$nullConstFetch = $this->nodeFactory->createNull();
$toNullNotIdentical = new NotIdentical($expr, $nullConstFetch);

if ($exprType instanceof UnionType) {
if ($unionType instanceof UnionType) {
$compareExprs = [];

foreach ($exprType->getTypes() as $unionedType) {
foreach ($unionType->getTypes() as $unionedType) {
$compareExprs[] = $this->createNotIdenticalFalsyCompare($unionedType, $expr, $treatAsNotEmpty);
}

Expand All @@ -110,7 +110,7 @@ private function createFromUnionType(UnionType $exprType, Expr $expr, bool $trea
return $truthyExpr;
}

$compareExpr = $this->createNotIdenticalFalsyCompare($exprType, $expr, $treatAsNotEmpty);
$compareExpr = $this->createNotIdenticalFalsyCompare($unionType, $expr, $treatAsNotEmpty);
if (! $compareExpr instanceof Expr) {
return null;
}
Expand Down

0 comments on commit c60f6a5

Please sign in to comment.