Re: [RFC[ Property accessor hooks, take 2
| From: | Robert Landers | Date: | Thu, 21 Mar 2024 09:10:02 +0000 |
| Subject: | Re: [RFC[ Property accessor hooks, take 2 | ||
| References: | 1 2 3 4 | Groups: | php.internals |
| Request: | Send a blank email to internals+get-122704@lists.php.net to get a copy of this message | ||
Hello,
I'm a bit confused on inheritance. In the following example of a
proxy, do I need to be aware of a parent's hook and handle it
specially?
class Loud
{
public string $name {
get {
return strtoupper($this->name);
}
}
}
class LoudProxy extends Loud
{
public string $name {
get {
// detected the parent has a hook? //
$return = parent::$name::get();
// do something with return //
return $return;
}
}
}
what happens if the Loud class later removes its hook implementation
(ex: moves it to the set hook)? Will my proxy now cause an error?
Would simply calling $this->name call the parents hook?
Robert Landers
Software Engineer
Utrecht NL