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

[TypeInfo] Handle custom collection objects properly#54661

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

@mtarld
Copy link
Contributor

QA
Branch?7.1
Bug fix?no
New feature?no
Deprecations?no
Issues
LicenseMIT

Understand custom collection objects.

@carsonbotcarsonbot added this to the7.1 milestoneApr 18, 2024
@mtarldmtarldforce-pushed thefix/handle-doctrine-collections branch from55fc9bf to106fec9CompareApril 18, 2024 13:09
@mtarldmtarldforce-pushed thefix/handle-doctrine-collections branch from106fec9 tob2a7627CompareApril 18, 2024 13:18
};

if ($typeinstanceof ObjectType &&\in_array($type->getClassName(),self::COLLECTION_CLASS_NAMES,true)) {
if ($typeinstanceof ObjectType &&(is_a($type->getClassName(), \Traversable::class,true) ||is_a($type->getClassName(),\ArrayAccess::class,true))) {

Choose a reason for hiding this comment

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

is_subclass_of?

Copy link
ContributorAuthor

Choose a reason for hiding this comment

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

When usingis_subclass_of, only subclasses will return true. And I think that it'd be great to be able to understandTraversable as a collection as well. WDYT?

Choose a reason for hiding this comment

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

Not sure what you mean. is_subclass_of works with interfaces too:https://3v4l.org/bP6JN

Copy link
Member

Choose a reason for hiding this comment

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

I guess what@mtarld means is thatis_subclass_of(\Traversable::class, \Traversable::class); returnsfalse:https://3v4l.org/1CbGV

nicolas-grekas reacted with thumbs up emoji
Copy link
ContributorAuthor

Choose a reason for hiding this comment

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

Exactly, thanks@xabbuh.

Copy link
Contributor

@KorbeilKorbeil left a comment

Choose a reason for hiding this comment

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

👍

@xabbuhxabbuh added the ❄️ Feature FreezeImportant Pull Requests to finish before the next Symfony "feature freeze" labelApr 30, 2024
@chalasr
Copy link
Member

Thank you@mtarld.

@chalasrchalasr merged commit95e8168 intosymfony:7.1Apr 30, 2024
@mtarldmtarld deleted the fix/handle-doctrine-collections branchApril 30, 2024 08:25
@fabpotfabpot mentioned this pull requestMay 2, 2024
Sign up for freeto join this conversation on GitHub. Already have an account?Sign in to comment

Reviewers

@nicolas-grekasnicolas-grekasnicolas-grekas left review comments

@xabbuhxabbuhxabbuh approved these changes

@welcoMatticwelcoMatticwelcoMattic approved these changes

@chalasrchalasrchalasr approved these changes

+1 more reviewer

@KorbeilKorbeilKorbeil approved these changes

Reviewers whose approvals may not affect merge requirements

Assignees

No one assigned

Labels

❄️ Feature FreezeImportant Pull Requests to finish before the next Symfony "feature freeze"Status: ReviewedTypeInfo

Projects

None yet

Milestone

7.1

Development

Successfully merging this pull request may close these issues.

7 participants

@mtarld@chalasr@nicolas-grekas@welcoMattic@Korbeil@xabbuh@carsonbot

[8]ページ先頭

©2009-2025 Movatter.jp