Hello,

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.

Anyway, I was reading it carefully and I had a couple of questions.

What would happen with the following class:

class BigNumbers {
  public \Gmp $myNumber {
    beforeSet(int|string $value) {
      return gmp_init($value);
    }
  }
}

Would $bigNumber->myNumber = gmp_init('25') throw an error because it
isn't a `string|int`? Can hooks only accept the type they are setting
or any type?

In other words, will it be possible for this to no longer be true (I'm
not sure it is always true now, fwiw):

$x = $y = $z = 1;

$x === $y && $y === $z;

This looks like a very powerful change to the language and I'm really
looking forward to using it!

Robert Landers
Software Engineer
Utrecht NL

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

Reply via email to