Re: Re: [Concept] Magic Casting
| From: | David Rodrigues | Date: | Fri, 02 Dec 2016 14:19:54 +0000 |
| Subject: | Re: Re: [Concept] Magic Casting | ||
| References: | 1 2 3 4 5 | Groups: | php.internals |
| Request: | Send a blank email to internals+get-97253@lists.php.net to get a copy of this message | ||
2016-12-02 12:16 GMT-02:00 Alex Bowers <bowersbros@gmail.com>:
> var_dump was just an example to "show what type the variable is", and
> completely untested. Consider replacing that line with anything that would
> make it clear to you that it is now no longer an array, but a Collection for
> example.
Sure, but how the engine will knows when it should __cast()?
For instance, when method(Type $variable) will call Type::__cast() for
$variable, or just work with the Type instance?
In this case, is not better I create an interface (like IsCollection)
and call $variable->getCollection()?
Thanks!
--
David Rodrigues