Skip to content

Commit

Permalink
Simplify NodeTypeResolver (#6728)
Browse files Browse the repository at this point in the history
* Simplify NodeTypeResolver

* Drop useless return type
  • Loading branch information
staabm authored Feb 10, 2025
1 parent 1018010 commit 50f9d87
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@

final class AccessoryNonEmptyStringTypeCorrector
{
public function correct(Type $mainType): Type | IntersectionType
public function correct(Type $mainType): Type
{
if (! $mainType instanceof IntersectionType) {
return $mainType;
Expand Down
4 changes: 2 additions & 2 deletions src/NodeTypeResolver/NodeTypeResolver.php
Original file line number Diff line number Diff line change
Expand Up @@ -404,10 +404,10 @@ private function resolveNativeUnionType(UnionType $unionType): Type
}

if ($hasChanged) {
return $this->accessoryNonEmptyStringTypeCorrector->correct(new UnionType($types));
return new UnionType($types);
}

return $this->accessoryNonEmptyStringTypeCorrector->correct($unionType);
return $unionType;
}

private function isMatchObjectWithoutClassType(
Expand Down

0 comments on commit 50f9d87

Please sign in to comment.