Skip to content

Commit 88f458a

Browse files
committed
fix(jsonschema): drop removed getBuiltinTypes path in SchemaPropertyMetadataFactory
The 4.4 readable-link refinement used a getType-gated dual path; main (5.0) removed ApiProperty::getBuiltinTypes and property-info's getType, so on the bumped Symfony floor the legacy branch fatally called an undefined method during cache warmup (breaking every PHPUnit job). Keep only the native-type branch, matching main's modern type handling.
1 parent 432992e commit 88f458a

1 file changed

Lines changed: 2 additions & 17 deletions

File tree

src/JsonSchema/Metadata/Property/Factory/SchemaPropertyMetadataFactory.php

Lines changed: 2 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -73,23 +73,8 @@ public function create(string $resourceClass, string $property, array $options =
7373
// on output a non-resource object is serialized by the standard object normalizer, which embeds non-resource properties regardless of readableLink (see AbstractItemNormalizer::supportsNormalization())
7474
// For resource-typed properties however, the circular reference handler (see AbstractItemNormalizer::$defaultContext) may produce an IRI, so isReadableLink should determine the schema
7575
if (!$isInput && !$this->isResourceClass($resourceClass)) {
76-
if (method_exists(PropertyInfoExtractor::class, 'getType')) {
77-
if (!$propertyMetadata->getNativeType()?->isSatisfiedBy(fn (Type $t) => $t instanceof ObjectType && $this->resourceClassResolver->isResourceClass($t->getClassName()))) {
78-
$link = true;
79-
}
80-
} else {
81-
$propertyTypeIsResource = false;
82-
foreach ($propertyMetadata->getBuiltinTypes() ?? [] as $builtinType) {
83-
$className = $builtinType->isCollection() ? ($builtinType->getCollectionValueTypes()[0] ?? null)?->getClassName() : $builtinType->getClassName();
84-
if ($className && $this->resourceClassResolver->isResourceClass($className)) {
85-
$propertyTypeIsResource = true;
86-
break;
87-
}
88-
}
89-
90-
if (!$propertyTypeIsResource) {
91-
$link = true;
92-
}
76+
if (!$propertyMetadata->getNativeType()?->isSatisfiedBy(fn (Type $t) => $t instanceof ObjectType && $this->resourceClassResolver->isResourceClass($t->getClassName()))) {
77+
$link = true;
9378
}
9479
}
9580

0 commit comments

Comments
 (0)