Re: Proposal: A way for classes to define a response to any primitive type cast
| From: | someniatko | Date: | Wed, 08 Jul 2020 09:00:12 +0000 |
| Subject: | Re: Proposal: A way for classes to define a response to any primitive type cast | ||
| References: | 1 2 3 4 | Groups: | php.internals |
| Request: | Send a blank email to internals+get-110876@lists.php.net to get a copy of this message | ||
> This would seem to fit your use case with Shoop quite well:
> rather than Shoop::array($array)->first()->unfold(), you would just call
> $array->first(). It's fairly high on a lot of people's wish lists, but
> there's a lot of details to get right in both design and implementation,
> so I strongly recommend searching for previous discussions and proofs of
> concept before diving in.
We don't need methods on non-scalar objects, if we have [pipe
operator](https://wiki.php.net/rfc/pipe-operator-v2): sth like `$array
|> array_first(?)`. This would allow much greater flexibility.