-
-
Notifications
You must be signed in to change notification settings - Fork 897
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
feat(metadata/doctrine): Use Type
of TypeInfo
instead of PropertyInfo
#6979
Open
mtarld
wants to merge
1
commit into
api-platform:main
Choose a base branch
from
mtarld:chore/type-info-type-metadata
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
9f1eab4
to
99cfee3
Compare
Type
of TypeInfo
instead of PropertyInfo
Type
of TypeInfo
instead of PropertyInfo
99cfee3
to
ffd86b8
Compare
Type
of TypeInfo
instead of PropertyInfo
Type
of TypeInfo
instead of PropertyInfo
d8618a7
to
6e47055
Compare
For information, the code can become simpler if the following PRs get merged: symfony/symfony#59844 will update $typeIsResourceClass = function (Type $type) use (&$typeIsResourceClass): bool {
return match (true) {
$type instanceof CollectionType => $type->getCollectionValueType()->isSatisfiedBy($typeIsResourceClass),
$type instanceof WrappingTypeInterface => $type->wrappedTypeIsSatisfiedBy($typeIsResourceClass),
$type instanceof CompositeTypeInterface => $type->composedTypesAreSatisfiedBy($typeIsResourceClass),
default => $type instanceof ObjectType && $this->isResourceClass($type->getClassName()),
};
}; to $typeIsResourceClass = fn (Type $type): bool => $type instanceof ObjectType && $this->isResourceClass($type->getClassName()); symfony/symfony#59845 will update foreach ($type instanceof CompositeTypeInterface ? $type->getTypes() : [$type] as $t) {
while ($t instanceof WrappingTypeInterface) {
$t = $t->getWrappedType();
}
$typeStrings[] = (string) $t;
} to foreach ($type->traverse() as $t) {
if ($t instanceof CompositeTypeInterface || $t instanceof WrappingTypeInterface) {
continue;
}
$typeStrings[] = (string) $t;
} |
f44914f
to
6e47055
Compare
Edit: I was wrong about it, there is no need to wait, the deprecation could be merged in Symfony 7.3 |
soyuka
reviewed
Feb 28, 2025
soyuka
reviewed
Feb 28, 2025
soyuka
reviewed
Feb 28, 2025
soyuka
reviewed
Feb 28, 2025
soyuka
reviewed
Feb 28, 2025
src/Metadata/Property/Factory/ExtractorPropertyMetadataFactory.php
Outdated
Show resolved
Hide resolved
soyuka
reviewed
Feb 28, 2025
src/Metadata/Property/Factory/SerializerPropertyMetadataFactory.php
Outdated
Show resolved
Hide resolved
soyuka
reviewed
Feb 28, 2025
soyuka
reviewed
Feb 28, 2025
soyuka
reviewed
Feb 28, 2025
aba898d
to
cc85008
Compare
7ad53c9
to
4b6eaa7
Compare
4b6eaa7
to
b4ae0b4
Compare
chalasr
added a commit
to symfony/symfony
that referenced
this pull request
Mar 22, 2025
This PR was merged into the 7.3 branch. Discussion ---------- [PropertyInfo] Deprecate `Type` | Q | A | ------------- | --- | Branch? | 7.3 | Bug fix? | no | New feature? | no | Deprecations? | yes | Issues | | License | MIT A new attempt to #53160, now that `symfony/type-info` is not experimental anymore. Deprecates: - `Type` class in favor of the `Type` class of `symfony/type-info` - `PropertyTypeExtractorInterface::getTypes()` in favor of the `PropertyTypeExtractorInterface::getType()` method - `ConstructorArgumentTypeExtractorInterface::getTypesFromConstructor()` in favor of the `ConstructorArgumentTypeExtractorInterface::getTypeFromConstructor()` method The work for upgrading dependent packages has begun already: - api-platform/core#6979 - symfony/ux#2607 Commits ------- 4d2ccf4 Fix md formatting f819aed [PropertyInfo] Deprecate Type
symfony-splitter
pushed a commit
to symfony/doctrine-bridge
that referenced
this pull request
Mar 22, 2025
This PR was merged into the 7.3 branch. Discussion ---------- [PropertyInfo] Deprecate `Type` | Q | A | ------------- | --- | Branch? | 7.3 | Bug fix? | no | New feature? | no | Deprecations? | yes | Issues | | License | MIT A new attempt to symfony/symfony#53160, now that `symfony/type-info` is not experimental anymore. Deprecates: - `Type` class in favor of the `Type` class of `symfony/type-info` - `PropertyTypeExtractorInterface::getTypes()` in favor of the `PropertyTypeExtractorInterface::getType()` method - `ConstructorArgumentTypeExtractorInterface::getTypesFromConstructor()` in favor of the `ConstructorArgumentTypeExtractorInterface::getTypeFromConstructor()` method The work for upgrading dependent packages has begun already: - api-platform/core#6979 - symfony/ux#2607 Commits ------- 4d2ccf4ac94 Fix md formatting f819aed8d13 [PropertyInfo] Deprecate Type
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
In order to anticipate the deprecation of
PropertyInfo
'sType
in favor ofTypeInfo
's one, this PR adds a new propertyphpType
(the name can be challenged) that will aim to replacebuiltinTypes
.What has been done:
ApiProperty::$phpType
property,ApiProperty::getPhpType()
, andApiProperty::withPhpType()
.PropertyInfoToTypeInfoHelper::convertTypeToLegacyTypes
to store legacy types inApiProperty::$builtinTypes
when settingApiProperty::$phpType
, this allows API Platform to work "the legacy way" while upgrading other packages.ApiProperty
to allow other API Platform packages to upgrade first.AbstractItemNormalizer
to not be dependent on the type order (type order might not be the same with these changes)PropertyTypeExtractorInterface::getType()
inDoctrineExtractor
(asgetTypes
is deprecated)api-platform/metadata
to^4.1
,symfony/property-info
to^7.1
in all packagessymfony/type-info:^7.2
inapi-platform/metadata
andapi-platform/doctrine