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] Support union of types#59354

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

Merged
fabpot merged 1 commit intosymfony:7.3fromVincentLanglet:unionResolver
Jan 6, 2025

Conversation

VincentLanglet
Copy link
Contributor

@VincentLangletVincentLanglet commentedJan 3, 2025
edited
Loading

QA
Branch?7.3
Bug fix?no
New feature?yes
Deprecations?no
IssuesFix #...
LicenseMIT

Add support for| syntax when describing allowedType in OptionResolver.

It's not really useful forint|string since we can pass an array['string', 'int'].
But it's useful for array values since(int|string)[] was not possible so far and['string[]', 'int[]'] was not the same thing.

alamirault reacted with hooray emojisstok reacted with eyes emoji
@carsonbot
Copy link

Hey!

Thanks for your PR. You are targeting branch "7.3" but it seems your PR description refers to branch "7.3 for features".
Could you update the PR description or change target branch? This helps core maintainers a lot.

Cheers!

Carsonbot

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.

Good addition 👍 thanks!

@yceruto
Copy link
Member

Also, we could find a regex that matches all possible variants instead of checking them one by one.

@VincentLanglet
Copy link
ContributorAuthor

VincentLanglet commentedJan 3, 2025
edited
Loading

Also, we could find a regex that matches all possible variants instead of checking them one by one.

Didn't find an easy one, but I'm opened to suggestion.

I preferred to add the logic in the existing recursive implementation

@VincentLanglet
Copy link
ContributorAuthor

I found edge case where my previous implementation remove badly parenthesis, so I now introduce a private methodisEnclosedWithParenthesis@yceruto

@yceruto
Copy link
Member

Could you confirm that class Union is also supported with this new syntax? i.e.(App\FooInterface|App\BarInterface)[]

@VincentLanglet
Copy link
ContributorAuthor

Could you confirm that class Union is also supported with this new syntax? i.e.(App\FooInterface|App\BarInterface)[]

I added a test for\DateTime::class.'|'.\DateTimeImmutable::class. Is it enough ?

yceruto reacted with thumbs up emoji

@fabpot
Copy link
Member

Thank you@VincentLanglet.

@fabpotfabpot merged commitcd24b4b intosymfony:7.3Jan 6, 2025
9 of 11 checks passed
fabpot added a commit that referenced this pull requestJan 12, 2025
…hangelog (alamirault)This PR was merged into the 7.3 branch.Discussion----------[OptionsResolver] Add missing support of union type in changelog| Q             | A| ------------- | ---| Branch?       | 7.3| Bug fix?      | no| New feature?  | no <!-- please update src/**/CHANGELOG.md files -->| Deprecations? | no <!-- please update UPGRADE-*.md and src/**/CHANGELOG.md files -->| Issues        | Fix #... <!-- prefix each issue number with "Fix #", no need to create an issue if none exists, explain below instead -->| License       | MITI found changelog is missing while documentingsymfony/symfony-docs#20531Code PR:#59354Commits-------946278f [OptionsResolver] Add missing support of union type
@fabpotfabpot mentioned this pull requestMay 2, 2025
Sign up for freeto join this conversation on GitHub. Already have an account?Sign in to comment
Reviewers

@fabpotfabpotfabpot approved these changes

@nicolas-grekasnicolas-grekasnicolas-grekas approved these changes

@ycerutoycerutoyceruto approved these changes

Assignees
No one assigned
Projects
None yet
Milestone
7.3
Development

Successfully merging this pull request may close these issues.

5 participants
@VincentLanglet@carsonbot@yceruto@fabpot@nicolas-grekas

[8]ページ先頭

©2009-2025 Movatter.jp