Hi Robert!

On Fri, Mar 31, 2023 at 10:57 AM Robert Landers
<landers.rob...@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

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

Reply via email to