Open
Description
Description
The following code (https://3v4l.org/t2Pra)
<?php
class Demo {
public function __construct(
final public string $v
) {}
}
$d = new Demo( "FOO" );
var_dump( $d );
$r = new ReflectionProperty( Demo::class, 'v' );
var_dump( $r->isFinal() );
Resulted in this output:
Fatal error: Cannot use the final modifier on a parameter in /in/t2Pra on line 5
Process exited with code 255.
But I expected this output instead (from https://3v4l.org/Zus4v)
object(Demo)#1 (1) {
["v"]=>
string(3) "FOO"
}
bool(true)
From discussion on #17861
This came up, and there were some concerns it could imply const parameters as in Java. So we just left it out.