8000 prevent failures around not existing TypeInfo classes · symfony/symfony@386453e · GitHub
[go: up one dir, main page]

Skip to content

Commit 386453e

Browse files
committed
prevent failures around not existing TypeInfo classes
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.
1 parent 49f4c44 commit 386453e

File tree

2 files changed

+2
-2
lines changed

2 files changed

+2
-2
lines changed

src/Symfony/Component/Serializer/Normalizer/AbstractObjectNormalizer.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -938,7 +938,7 @@ private function getType(string $currentClass, string $attribute): Type|array|nu
938938
*/
939939
private function getPropertyType(string $className, string $property): Type|array|null
940940
{
941-
if (method_exists($this->propertyTypeExtractor, 'getType')) {
941+
if (class_exists(Type::class) && method_exists($this->propertyTypeExtractor, 'getType')) {
942942
return $this->propertyTypeExtractor->getType($className, $property);
943943
}
944944

src/Symfony/Component/Validator/Mapping/Loader/PropertyInfoLoader.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -175,7 +175,7 @@ public function loadClassMetadata(ClassMetadata $metadata): bool
175175
*/
176176
private function getPropertyTypes(string $className, string $property): TypeInfoType|array|null
177177
{
178-
if (method_exists($this->typeExtractor, 'getType')) {
178+
if (class_exists(TypeInfoType::class) && method_exists($this->typeExtractor, 'getType')) {
179179
return $this->typeExtractor->getType($className, $property);
180180
}
181181

0 commit comments

Comments
 (0)
0