Skip to content

Commit

Permalink
Fix ClosureType::equals()
Browse files Browse the repository at this point in the history
  • Loading branch information
ondrejmirtes committed Apr 4, 2024
1 parent 57a7d5d commit 29c35b5
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 2 deletions.
6 changes: 5 additions & 1 deletion src/Type/CallableType.php
Original file line number Diff line number Diff line change
Expand Up @@ -193,7 +193,11 @@ public function isAcceptedWithReasonBy(Type $acceptingType, bool $strictTypes):

public function equals(Type $type): bool
{
return $type instanceof self;
if (!$type instanceof self) {
return false;
}

return $this->describe(VerbosityLevel::precise()) === $type->describe(VerbosityLevel::precise());
}

public function describe(VerbosityLevel $level): string
Expand Down
2 changes: 1 addition & 1 deletion src/Type/ClosureType.php
Original file line number Diff line number Diff line change
Expand Up @@ -190,7 +190,7 @@ public function equals(Type $type): bool
return false;
}

return $this->returnType->equals($type->returnType);
return $this->describe(VerbosityLevel::precise()) === $type->describe(VerbosityLevel::precise());
}

public function describe(VerbosityLevel $level): string
Expand Down

0 comments on commit 29c35b5

Please sign in to comment.