# [RFC] [Discussion] Final promoted properties

- Thread: https://externals.io/message/126926
- Original archive: https://news-web.php.net/php.internals/126926
- Started by Daniel Scherzer on 2025-03-24T18:33:30+00:00
- Messages: 4
- RFC: Final Property Promotion (Implemented (PHP 8.5)) — https://externals.io/rfc/final_promotion.md
- Reply by email to internals@lists.php.net
- More for agents: search with https://externals.io/search.md?q={query} · RFCs at https://externals.io/rfc.md · JSON API at https://externals.io/api · documentation at https://externals.io/llms.txt

---

## #126926 — Daniel Scherzer — 2025-03-24T18:33:30+00:00

URL: https://externals.io/message/126926#126926

Hi internals,

I'd like to start the discussion for a new RFC about allowing final
promoted properties. You can see some preliminary discussion at <
https://externals.io/message/126475>, but this is now an official RFC.

* RFC: https://wiki.php.net/rfc/final_promotion
* Implementation: https://github.com/php/php-src/pull/17861

--Daniel

---

## #126952 — Ben Ramsey — 2025-03-26T00:24:50+00:00

URL: https://externals.io/message/126926#126952 · In reply to: #126926

> Hi internals,
> 
> I'd like to start the discussion for a new RFC about allowing final 
> promoted properties. You can see some preliminary discussion at < 
> https://externals.io/message/126475>, but this is now an official
> RFC.
> 
> * RFC: https://wiki.php.net/rfc/final_promotion 
> * Implementation: https://github.com/php/php-src/pull/17861
> 
> --Daniel
> 


 From the RFC:

> Since properties declared as `final` do not need an explicit
> visibility set (defaulting to public), no visibility is required in
> the promotion if `final` is used, though visibility (including
> asymmetric visibility) and other features (like property hooks) can
> be used and combined with `final`.

My first thought was that it feels weird to define a promoted property 
without a visibility modifier, but I didn't realize that this is valid 
in PHP 8.4:

```
class Foo
{
     final string $foo = 'This is a foo';
}

var_dump(new Foo()->foo);
```

So, if that's valid, then I don't have any objections following the same 
pattern with promoted properties.

I find it interesting that you can still declare a class property with 
the `var` keyword, but you can't use `final` with `var`, and you can't 
use `var` to promote properties. That's probably for the best. :-)

Cheers,
Ben

---

## #127042 — tim@bastelstu.be — 2025-04-04T11:18:56+00:00

URL: https://externals.io/message/126926#127042 · In reply to: #126926

Hi

Am 2025-03-24 19:33, schrieb Daniel Scherzer:
> I'd like to start the discussion for a new RFC about allowing final
> promoted properties. You can see some preliminary discussion at <
> https://externals.io/message/126475>, but this is now an official RFC.

I'm in favor of supporting all modifiers during promotion, but I don't 
particularly like the implicit promoting without also specifying the 
visibility, but given the precedent with `readonly` and hooks [1], it 
would at least be consistent.

I'll probably abstain from a vote for that reason.

Best regards
Tim Düsterhus

[1] The latter of which unfortunately was not specified in the RFC.

---

## #127302 — Daniel Scherzer — 2025-05-07T16:08:45+00:00

URL: https://externals.io/message/126926#127302 · In reply to: #126926

On Mon, Mar 24, 2025 at 11:33 AM Daniel Scherzer <
daniel.e.scherzer@gmail.com> wrote:

> Hi internals,
>
> I'd like to start the discussion for a new RFC about allowing final
> promoted properties. You can see some preliminary discussion at <
> https://externals.io/message/126475>, but this is now an official RFC.
>
> * RFC: https://wiki.php.net/rfc/final_promotion
> * Implementation: https://github.com/php/php-src/pull/17861
>
> --Daniel
>


If there is no further discussion I plan to open the vote in a few days.
-Daniel
