diff --git a/src/Type/ObjectType.php b/src/Type/ObjectType.php index 3e755bab60..0f01d33372 100644 --- a/src/Type/ObjectType.php +++ b/src/Type/ObjectType.php @@ -635,6 +635,20 @@ public function equals(Type $type): bool return false; } + $classReflection = $this->getClassReflection(); + if ($classReflection !== null) { + $otherClassReflection = $type->getClassReflection(); + if ( + $otherClassReflection !== null + && ( + $classReflection->hasFinalByKeywordOverride() + !== $otherClassReflection->hasFinalByKeywordOverride() + ) + ) { + return false; + } + } + if ($this->subtractedType === null) { return $type->subtractedType === null; }