Take the State of PHP 2026 Survey →

Final Property Promotion View as Markdown

Implemented (PHP 8.5)
Authors
Daniel Scherzer, daniel.e.scherzer@gmail.com
Date
2025-03-24
Version
0.1
Implementation
https://github.com/php/php-src/pull/17861
Source
wiki.php.net/rfc/final_promotion

Vote

Allow `final` to be used with property promotion? closed
Yes
25
No
0
25 voters
alcaeus Yes 2025-05-27 10:50
asgrim Yes 2025-05-26 20:19
ashnazg Yes 2025-05-28 14:07
bwoebi Yes 2025-05-30 14:21
cpriest Yes 2025-06-02 18:28
crell Yes 2025-05-28 22:05
daniels Yes 2025-06-09 08:06
devnexen Yes 2025-06-05 15:20
edorian Yes 2025-06-08 13:05
ericmann Yes 2025-06-02 16:21
galvao Yes 2025-05-28 19:24
girgias Yes 2025-05-28 11:25
ilutov Yes 2025-05-27 07:12
kalle Yes 2025-05-28 10:47
kinncj Yes 2025-06-01 03:03
malferov Yes 2025-06-02 02:39
mauricio Yes 2025-06-03 02:17
mbeccati Yes 2025-05-28 14:31
nikic Yes 2025-05-31 10:46
ramsey Yes 2025-05-27 16:49
sergey Yes 2025-05-27 11:46
theodorejb Yes 2025-05-28 00:29
thorstenr Yes 2025-06-01 08:41
weierophinney Yes 2025-06-08 20:07
wyrihaximus Yes 2025-05-30 18:45

Discussions on the mailing list

Constructor property promotion for final properties
by Daniel Scherzer · 9 messages
[RFC] [Discussion] Final promoted properties
by Daniel Scherzer · 4 messages
[VOTE] RFC: Final Property Promotion
by Daniel Scherzer · 3 messages

RFC text

Copied from wiki.php.net, last synchronized Oct 13, 2026 11:50 UTC

Introduction

When property-hooks added property hooks, it also added a mechanism for properties to be declared as final. However, the final modifier is not currently supported for properties that are created via constructor property promotion. This RFC proposes that final properties also be allowed in constructor property promotion.

The reasoning is basically the same as from the original constructor_promotion RFC - reducing boilderplate.

Proposal

When a constructor parameter is marked with final, it is considered “promoted” and treated like other promoted properties, with the resulting property also being marked as final.

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.

Backward Incompatible Changes

None, all prior code that was valid is executed the same

As with all RFCs that make code that previously had a compile-time error become valid, this RFC requires updates to static analyzers and IDEs to understand the semantics of constructor parameters marked as final.

Proposed PHP Version(s)

Next version of PHP (PHP 8.5 or PHP 9.0)

Unaffected PHP Functionality

Since final was not valid for property promotion previously, the behavior of existing legal code is unchanged.

Proposed Voting Choices

Vote: Allow `final` to be used with property promotion? — Yes: 25 · No: 0 (closed)

Patches and Tests

https://github.com/php/php-src/pull/17861

Implementation

After the project is implemented, this section should contain

  1. the version(s) it was merged into
  2. a link to the git commit(s)
  3. a link to the PHP manual entry for the feature
  4. a link to the language specification section (if any)

References