Re: Re: [RFC] "arrayable" pseudo type hint
| From: | Guilliam Xavier | Date: | Tue, 04 Feb 2020 18:51:53 +0000 |
| Subject: | Re: Re: [RFC] "arrayable" pseudo type hint | ||
| References: | 1 2 | Groups: | php.internals |
| Request: | Send a blank email to internals+get-108401@lists.php.net to get a copy of this message | ||
On Tue, Feb 4, 2020 at 1:48 PM Aimeos | Norbert Sendetzky
<norbert@aimeos.com> wrote:
>
> [...]
>
> interface Arrayable extends ArrayAccess, Countable, Traversable
> {
> public function toArray() : array;
> }
>
> [...]
>
> If union data types are available and "iterable" is implemented as
> alias, an alias "arrayable" for "array|Arrayable" may be added as well.
About that last point: it would not be possible to have both the
Arrayable interface and the arrayable reserved word because PHP is
case-insensitive for those things (the same way you cannot declare an
interface Iterable because of the iterable reserved word,
<https://3v4l.org/Fhqar>), so you would need another name
(if you want
the alias)
--
Guilliam Xavier