Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

[OptionsResolver] Allow Union/Intersection Types in Resolved Closures#58917

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 ourterms of service andprivacy statement. We’ll occasionally send you account related emails.

Already on GitHub?Sign in to your account

Conversation

zanbaldwin
Copy link
Member

@zanbaldwinzanbaldwin commentedNov 18, 2024
edited
Loading

QA
Branch?6.4
Bug fix?yes
New feature?no
Deprecations?no
IssuesN/A
LicenseMIT

Using intersection/union types in Closures set in OptionsResolver currently causes the fatal error:
Attempted to call an undefined method named "getName" of class "ReflectionUnionType".
invendor/symfony/options-resolver/OptionsResolver.php (line 235).

This can be re-created with following form type:

class ExampleTypeextends AbstractType{publicfunctiongetParent():string    {returnType\ChoiceType::class;    }publicfunctionconfigureOptions(OptionsResolver$resolver):void    {$resolver->setDefaults(['data_class' => MyEntity::class,'choice_value' =>fn (\Stringable|string|null$entity):string => (string)$entity,        ]);    }}

Copy link
Member

@ycerutoyceruto left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others.Learn more.

You can ignore the fabbot formatting issue (it's a false positive).

Thanks!

@nicolas-grekas
Copy link
Member

Thank you@zanbaldwin.

@nicolas-grekasnicolas-grekasforce-pushed thebugfix/union-types-in-resolver-closures branch from65dcf64 to61ddfc4CompareNovember 20, 2024 10:57
@nicolas-grekasnicolas-grekas merged commitcfb39c5 intosymfony:6.4Nov 20, 2024
1 check failed
@zanbaldwinzanbaldwin deleted the bugfix/union-types-in-resolver-closures branchNovember 20, 2024 11:47
This was referencedNov 27, 2024
Sign up for freeto join this conversation on GitHub. Already have an account?Sign in to comment
Reviewers

@ycerutoycerutoyceruto approved these changes

Assignees
No one assigned
Projects
None yet
Milestone
6.4
Development

Successfully merging this pull request may close these issues.

4 participants
@zanbaldwin@nicolas-grekas@yceruto@carsonbot

[8]ページ先頭

©2009-2025 Movatter.jp