Re: [RFC[ Property accessor hooks, take 2
| From: | Deleu | Date: | Thu, 22 Feb 2024 12:58:40 +0000 |
| Subject: | Re: [RFC[ Property accessor hooks, take 2 | ||
| References: | 1 2 | Groups: | php.internals |
| Request: | Send a blank email to internals+get-122453@lists.php.net to get a copy of this message | ||
On Thu, Feb 22, 2024 at 8:25 AM tag Knife <fenniclog@gmail.com> wrote:
> A few things i was interested to get the idea around.
> Was it thought about for the set{} for it to return the value to set the
> property to
> instead implicitly setting its own field?
>
> eg
>
> ```
> public string $name {
> set {
> return usfirst($value);
> }
> }
> ```
> Where the value returned in the set is what the property will be set to?
>
The answer to this question is best described on the RFC FAQ:
https://wiki.php.net/rfc/property-hooks#why_do_set_hooks_not_return_the_value_to_set
--
Marco Deleu