Skip to content

Commit 362c0f1

Browse files
fix: symfony deprecation
1 parent 828b62a commit 362c0f1

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

src/Metadata/ApiProperty.php

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -513,6 +513,10 @@ public function getBuiltinTypes(): ?array
513513
{
514514
trigger_deprecation('api-platform/metadata', '4.2', 'The "%s()" method is deprecated, use "%s::getNativeType()" instead.', __METHOD__, self::class);
515515

516+
if (null === $this->builtinTypes && null !== $this->nativeType) {
517+
$this->builtinTypes = PropertyInfoToTypeInfoHelper::convertTypeToLegacyTypes($this->nativeType) ?? [];
518+
}
519+
516520
return $this->builtinTypes;
517521
}
518522

@@ -541,7 +545,6 @@ public function withNativeType(?Type $nativeType): self
541545
{
542546
$self = clone $this;
543547
$self->nativeType = $nativeType;
544-
$self->builtinTypes = PropertyInfoToTypeInfoHelper::convertTypeToLegacyTypes($nativeType) ?? [];
545548

546549
return $self;
547550
}

0 commit comments

Comments
 (0)