On Sun, Apr 5, 2020 at 4:02 PM Gabriel Caruso <carusogabrie...@gmail.com> wrote:
>
> Hello, internals.
>
> Hereby you can find the RFC Document that I want to discuss as suggested
> via https://externals.io/message/109416 and
> https://externals.io/message/107990:
>
> https://wiki.php.net/rfc/magic-methods-signature
>
> Best regards,
>
> -- Gabriel Caruso

Hello,

Thank you, this seems a sensible thing to add.

Just an interrogation: the following magic methods (from the
documentation) aren't mentioned at all in the RFC:
  - `__sleep(): array`
  - `__wakeup(): void`
  - `__unserialize(array $data): void`
  - (`__invoke` is basically untyped)
  - `__set_state(array $properties): object`
  -  `__debugInfo(): array`
Is there a reason for leaving them out?
Related, the RFC mentions that `__serialize` and `__toString` already
have a *runtime* check that they respectively return an `array` and a
`string` (when called), but why not check their signature (if typed)
at *compile time* too (i.e. make https://3v4l.org/ZPrVi an error)?

Regards,

--
Guilliam Xavier

-- 
PHP Internals - PHP Runtime Development Mailing List
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to