Re: [RFC] [DISCUSSION] Ensure correct magic methods' signatures when typed
| From: | Guilliam Xavier | Date: | Tue, 14 Apr 2020 14:37:28 +0000 |
| Subject: | Re: [RFC] [DISCUSSION] Ensure correct magic methods' signatures when typed | ||
| References: | 1 2 3 4 5 6 7 | Groups: | php.internals |
| Request: | Send a blank email to internals+get-109632@lists.php.net to get a copy of this message | ||
Hi, just chiming in on a specific question/answer:
On Tue, Apr 14, 2020 at 3:46 PM Gabriel Caruso
<carusogabriel34@gmail.com> wrote:
>
> On Tue, 14 Apr 2020 at 15:24, Nicolas Grekas <nicolas.grekas+php@gmail.com>
> wrote:
>
> >
> > > Foo::__isset(string $name): bool;
> > > Foo::__unset(string $name): void;
> >
> > Same comment about LSP, but also about the type: isn't it allowed to have
> > integers as keys? How does this play with strict_type and array access?
> >
> Thanks for raise this. Nowadays, you can't:
> https://3v4l.org/pPJDt. But, if
> you call as a method, yes: https://3v4l.org/0VmYQ.
Actually there are ways to use integers as property names, but they
are converted to strings on creation: https://3v4l.org/0k4LS
and
https://3v4l.org/HhPZP (also https://3v4l.org/Ts42B).
ArrayAccess doesn't use magic __isset(string $name) but interface
offsetExists(mixed $offset).
Regards,
--
Guilliam Xavier