Re: Property Hooks Discussion

From: Date: Fri, 31 Mar 2023 13:17:12 +0000
Subject: Re: Property Hooks Discussion
References: 1  Groups: php.internals 
Request: Send a blank email to internals+get-119811@lists.php.net to get a copy of this message
Hi Robert! On Fri, Mar 31, 2023 at 10:57 AM Robert Landers <landers.robert@gmail.com> wrote: > I couldn't find the thread about Property Hooks > (https://wiki.php.net/rfc/property-hooks) -- I think it got embedded > in various places? Or maybe my search-fu in gmail is failing me. As Rowan has mentioned, you couldn't find an e-mail because it hasn't actually been announced yet. Larry and I are still working on the details. > What would happen with the following class: > > class BigNumbers { > public \Gmp $myNumber { > beforeSet(int|string $value) { > return gmp_init($value); > } > } > } We haven't fully decided on whether we want to allow types in hook parameters, or whether the type should be implicit. The main motivation for allowing types is that one could accept broader types in and convert the value to the property target type. But I'll need to verify the technical feasibility before we make this decision. > $x = $y = $z = 1; > > $x === $y && $y === $z; I'm not quite sure what this means, as this doesn't involve hooks or properties. Ilija

« previous php.internals (#119811) next »