Skip to content

Commit 39ec8be

Browse files
bug #58870 [Serializer][Validator] prevent failures around not existing TypeInfo classes (xabbuh)
This PR was merged into the 7.1 branch. Discussion ---------- [Serializer][Validator] prevent failures around not existing TypeInfo classes | Q | A | ------------- | --- | Branch? | 7.1 | Bug fix? | yes | New feature? | no | Deprecations? | no | Issues | | License | MIT Having a `getType()` method on an extractor is not enough. Such a method may exist to be forward-compatible with the TypeInfo component. We still must not call it if the TypeInfo component is not installed to prevent running into errors for not-defined classes when the TypeInfo component is not installed. Commits ------- 386453ee77b prevent failures around not existing TypeInfo classes
2 parents 7afcfbb + c210d2b commit 39ec8be

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

Normalizer/AbstractObjectNormalizer.php

+1-1
Original file line numberDiff line numberDiff line change
@@ -992,7 +992,7 @@ private function getType(string $currentClass, string $attribute): Type|array|nu
992992
*/
993993
private function getPropertyType(string $className, string $property): Type|array|null
994994
{
995-
if (method_exists($this->propertyTypeExtractor, 'getType')) {
995+
if (class_exists(Type::class) && method_exists($this->propertyTypeExtractor, 'getType')) {
996996
return $this->propertyTypeExtractor->getType($className, $property);
997997
}
998998

0 commit comments

Comments
 (0)