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

[PropertyInfo] Support for intersection types#42098

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

Conversation

@derrabus
Copy link
Member

@derrabusderrabus commentedJul 14, 2021
edited
Loading

QA
Branch?4.4
Bug fix?yes
New feature?no
Deprecations?no
Tickets#41552
LicenseMIT
Doc PRN/A

I was a bit unsure how to fix this one. PropertyInfo does not know about the concept of intersection types yet. With this PR, the component will behave exactly the same for an intersection type as for a union: You will get an array of all atomic types.

Copy link
Member

@nicolas-grekasnicolas-grekas left a comment

Choose a reason for hiding this comment

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

I suppose we need a way to differentiate unions from intersections.
Putting a preemptive "changes requested" until e figure out what we need here.
(I've no idea yet :) )

derrabus reacted with thumbs up emoji
@derrabus
Copy link
MemberAuthor

@nicolas-grekas Have you made up your mind yet?

@nicolas-grekas
Copy link
Member

Nope. Maybe@dunglas has? Otherwise can you make a proposal? I'm AFK right now 😅

@derrabus
Copy link
MemberAuthor

My proposal is this PR. Our current strategy of returning an array of types does not really work well anymore if we want to distinguish union from intersection types. I think, we can find a better representation for 5.4, but for 4.4, I just want PropertyInfo to not fall apart if we encounter an intersection.

@fabpot
Copy link
Member

This should probably be for 5.4 instead.

@derrabus
Copy link
MemberAuthor

This should probably be for 5.4 instead.

I tend to disagree here. The component would currently throw cryptic errors if presented with an intersection type. We can certainly argue aboutwhat it should do instead, but I don't think we should leave it as is in 4.4.

ro0NL reacted with thumbs up emoji

@derrabusderrabusforce-pushed thebugfix/pi-intersection-types branch from38d8741 to2bf839dCompareAugust 26, 2021 13:10
@ro0NL
Copy link
Contributor

i think a list of types fits our semantic generally;

can we think of something that would conflict in practice?

ref#37971 also :) i agree about the compat issue.

@fabpot
Copy link
Member

ok, fair enough.

Signed-off-by: Alexander M. Turek <me@derrabus.de>
{
return [
['nothing',null],
['collection', [newType(Type::BUILTIN_TYPE_OBJECT,false,'Traversable'),newType(Type::BUILTIN_TYPE_OBJECT,false,'Countable')]],
Copy link
Contributor

@ro0NLro0NLAug 26, 2021
edited
Loading

Choose a reason for hiding this comment

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

i tend to believe the intersection type should be preserved as a single type;

[new Type(Type::BUILTIN_TYPE_OBJECT, false, 'Traversable&Countable')]

Choose a reason for hiding this comment

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

Maybe on a higher branch, since this PR is motivated by the need to generate a proper message.
Follow up welcome.

@nicolas-grekas
Copy link
Member

Thank you@derrabus.

@nicolas-grekasnicolas-grekas merged commit3bf2d14 intosymfony:4.4Sep 7, 2021
@derrabusderrabus deleted the bugfix/pi-intersection-types branchSeptember 7, 2021 08:46
This was referencedSep 28, 2021
Sign up for freeto join this conversation on GitHub. Already have an account?Sign in to comment

Reviewers

@nicolas-grekasnicolas-grekasnicolas-grekas requested changes

@dunglasdunglasdunglas approved these changes

@chalasrchalasrchalasr approved these changes

+1 more reviewer

@ro0NLro0NLro0NL left review comments

Reviewers whose approvals may not affect merge requirements

Assignees

No one assigned

Projects

None yet

Milestone

4.4

Development

Successfully merging this pull request may close these issues.

7 participants

@derrabus@nicolas-grekas@fabpot@ro0NL@dunglas@chalasr@carsonbot

[8]ページ先頭

©2009-2025 Movatter.jp