Re: Re: [Concept] Magic Casting
| From: | Andrey Andreev | Date: | Fri, 02 Dec 2016 13:54:40 +0000 |
| Subject: | Re: Re: [Concept] Magic Casting | ||
| References: | 1 2 3 | Groups: | php.internals |
| Request: | Send a blank email to internals+get-97251@lists.php.net to get a copy of this message | ||
Hi,
On Fri, Dec 2, 2016 at 3:44 PM, Alex Bowers <bowersbros@gmail.com> wrote:
> And because the email formatting appears bad (at least in externals.io)
>
> Here it is in a gist:
>
> https://gist.github.com/alexbowers/9520c8df746249ecae2d9c7aad2e54ae
>
There's been a few times I've wanted something like that, but I don't
really like the idea of yet another magic method.
Especially given the obvious limitation of just one parameter being
accepted, the whole thing may work with just an interface:
interface Castable {
public function __construct($whatever);
}
Cheers,
Andrey.