Skip to content

Commit 29c35b5

Browse files
committed
Fix ClosureType::equals()
1 parent 57a7d5d commit 29c35b5

File tree

2 files changed

+6
-2
lines changed

2 files changed

+6
-2
lines changed

src/Type/CallableType.php

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -193,7 +193,11 @@ public function isAcceptedWithReasonBy(Type $acceptingType, bool $strictTypes):
193193

194194
public function equals(Type $type): bool
195195
{
196-
return $type instanceof self;
196+
if (!$type instanceof self) {
197+
return false;
198+
}
199+
200+
return $this->describe(VerbosityLevel::precise()) === $type->describe(VerbosityLevel::precise());
197201
}
198202

199203
public function describe(VerbosityLevel $level): string

src/Type/ClosureType.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -190,7 +190,7 @@ public function equals(Type $type): bool
190190
return false;
191191
}
192192

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

196196
public function describe(VerbosityLevel $level): string

0 commit comments

Comments
 (0)