Uh oh!
There was an error while loading.Please reload this page.
- Notifications
You must be signed in to change notification settings - Fork9.7k
[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
Uh oh!
There was an error while loading.Please reload this page.
Conversation
55fc9bf to106fec9Compare106fec9 tob2a7627Compare| }; | ||
| 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))) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others.Learn more.
is_subclass_of?
There was a problem hiding this comment.
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?
There was a problem hiding this comment.
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
There was a problem hiding this comment.
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
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others.Learn more.
Exactly, thanks@xabbuh.
Korbeil left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others.Learn more.
👍
chalasr commentedApr 30, 2024
Thank you@mtarld. |
Understand custom collection objects.