Final Promoted Properties
Promoted properties could not be final. Since PHP 8.5, it is possible to use final in promoted properties definition.
PHP code
<?php
class x {
function __construct(
public final int $i
) {}
}
var_dump(new x(1));
?>
Before
PHP Fatal error: Cannot use the final modifier on a parameter
Fatal error: Cannot use the final modifier on a parameter
After
object(x)#1 (1) {
["i"]=>
int(1)
}
PHP version change
This behavior changed in 8.5.