Re: Re: Constructor property promotion for final properties
| From: | Daniel Scherzer | Date: | Fri, 21 Mar 2025 15:17:05 +0000 |
| Subject: | Re: Re: Constructor property promotion for final properties | ||
| References: | 1 2 3 | Groups: | php.internals |
| Request: | Send a blank email to internals+get-126897@lists.php.net to get a copy of this message | ||
On Fri, Mar 21, 2025 at 4:07 AM Tim Düsterhus <tim@bastelstu.be> wrote:
> Can you clarify if the following would result in constructor property
> promotion or not:
>
> class Foo {
> public function __construct(
> final string $bar,
> ) { }
> }
>
> Best regards
> Tim Düsterhus
>
Yes, that would result in constructor property promotion. I'll need to
retarget the original PR for master, but at
https://github.com/php/php-src/pull/17861
you can see in
Zend/tests/property_hooks/final_prop_promoted_2.phpt a very similar test
case.
--Daniel