Re: [RFC] [DISCUSSION] Ensure correct magic methods' signatures when typed

From: Date: Tue, 28 Apr 2020 16:31:42 +0000
Subject: Re: [RFC] [DISCUSSION] Ensure correct magic methods' signatures when typed
References: 1 2  Groups: php.internals 
Request: Send a blank email to internals+get-109889@lists.php.net to get a copy of this message
On Thu, 16 Apr 2020 at 16:22, Guilliam Xavier <guilliam.xavier@gmail.com> wrote: > On Sun, Apr 5, 2020 at 4:02 PM Gabriel Caruso <carusogabriel34@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 > The RFC has been updated with the missing methods. If there are no further requests or comments, I'll open this RFC for voting next Friday.

« previous php.internals (#109889) next »