Skip to content

Commit

Permalink
prevent failures around not existing TypeInfo classes
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
xabbuh committed Nov 14, 2024
1 parent 6066de1 commit c210d2b
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion Normalizer/AbstractObjectNormalizer.php
Original file line number Diff line number Diff line change
Expand Up @@ -938,7 +938,7 @@ private function getType(string $currentClass, string $attribute): Type|array|nu
*/
private function getPropertyType(string $className, string $property): Type|array|null
{
if (method_exists($this->propertyTypeExtractor, 'getType')) {
if (class_exists(Type::class) && method_exists($this->propertyTypeExtractor, 'getType')) {
return $this->propertyTypeExtractor->getType($className, $property);
}

Expand Down

0 comments on commit c210d2b

Please sign in to comment.