Re: [RFC] Property hooks, nee accessors
| From: | Matthew Brown | Date: | Sun, 14 May 2023 02:52:57 +0000 |
| Subject: | Re: [RFC] Property hooks, nee accessors | ||
| References: | 1 2 | Groups: | php.internals |
| Request: | Send a blank email to internals+get-120267@lists.php.net to get a copy of this message | ||
>
> Regarding $field vs. $this->propName, there's a few reasons we went that
> route.
Overall I think this is a really good proposal, but you might want to
consider a second vote for that particular syntax.
$field vs $this->propName feels a little magical. It's a simpler
magic
than actual magic methods — it's magic that static analysis tools can
quickly reason about (as they can with promoted properties).
But I can imagine developers coming across this particular syntax in a PR
and thinking "that looks like a bug".
I know it's a few extra keypresses, but I think $this->propName is easier
to scan, and more familiar (given this RFC introduces a lot of other new
syntax).