diff --git a/rules/TypeDeclaration/TypeAnalyzer/ObjectTypeComparator.php b/rules/TypeDeclaration/TypeAnalyzer/ObjectTypeComparator.php index d31a90b15076..4314cb878d51 100644 --- a/rules/TypeDeclaration/TypeAnalyzer/ObjectTypeComparator.php +++ b/rules/TypeDeclaration/TypeAnalyzer/ObjectTypeComparator.php @@ -37,7 +37,7 @@ public function isCurrentObjectTypeSubType(Type $currentType, Type $newType): bo return false; } - return is_a($currentType->getClassName(), $newType->getClassName(), true); + return $newType->isSuperTypeOf($currentType)->yes(); } private function isClosure(Type $type): bool