[TypeInfo] Fix Type::fromValue incorrectly setting object type instead of enum#60956
Merged
xabbuh merged 1 commit intosymfony:7.3from Jun 30, 2025
Merged
[TypeInfo] Fix Type::fromValue incorrectly setting object type instead of enum#60956xabbuh merged 1 commit intosymfony:7.3from
Type::fromValue incorrectly setting object type instead of enum#60956xabbuh merged 1 commit intosymfony:7.3from
Conversation
mtarld
approved these changes
Jun 30, 2025
xabbuh
reviewed
Jun 30, 2025
xabbuh
approved these changes
Jun 30, 2025
OskarStark
reviewed
Jun 30, 2025
| /** @var list<Type> $valueTypes */ | ||
| $valueTypes = []; | ||
|
|
||
| $i = 0; |
Member
|
Thank you @norkunas. |
stof
reviewed
Jun 30, 2025
| } | ||
|
|
||
| $type = match (true) { | ||
| \is_object($value) && is_subclass_of($value::class, \UnitEnum::class) => Type::enum($value::class), |
Member
There was a problem hiding this comment.
$value instanceof \UnitEnum would be better (instanceof has more built-in optimizations than is_subclass_of() btw)
Contributor
Author
There was a problem hiding this comment.
Ok will change it. I just copied it from TypeFactoryTrait::enum method
xabbuh
added a commit
that referenced
this pull request
Jul 1, 2025
This PR was merged into the 7.3 branch. Discussion ---------- [TypeInfo] Optimize enum check | Q | A | ------------- | --- | Branch? | 7.3 | Bug fix? | no | New feature? | no | Deprecations? | no | Issues | Fix #60956 (comment) | License | MIT Commits ------- e8b8282 [TypeInfo] Optimize enum check
Merged
This file contains hidden or 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
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.
Tried to apply #60820 (comment) comment, but found some failing cases