File tree Expand file tree Collapse file tree 3 files changed +24
-1
lines changed
Expand file tree Collapse file tree 3 files changed +24
-1
lines changed Original file line number Diff line number Diff line change @@ -389,8 +389,9 @@ private function setupFunction($function, Node\FunctionLike $node): void
389389 $ function ->setReturnType ($ node ->getReturnType () ? $ this ->toPhp ($ node ->getReturnType ()) : null );
390390 foreach ($ node ->getParams () as $ item ) {
391391 $ visibility = $ this ->toVisibility ($ item ->flags );
392+ $ isReadonly = (bool ) ($ item ->flags & Node \Stmt \Class_::MODIFIER_READONLY );
392393 $ param = $ visibility
393- ? ($ function ->addPromotedParameter ($ item ->var ->name ))->setVisibility ($ visibility )
394+ ? ($ function ->addPromotedParameter ($ item ->var ->name ))->setVisibility ($ visibility )-> setReadonly ( $ isReadonly )
394395 : $ function ->addParameter ($ item ->var ->name );
395396 $ param ->setType ($ item ->type ? $ this ->toPhp ($ item ->type ) : null );
396397 $ param ->setReference ($ item ->byRef );
Original file line number Diff line number Diff line change @@ -27,3 +27,14 @@ class Class11
2727class Attr
2828{
2929}
30+
31+ class Class12
32+ {
33+ private readonly string $bar;
34+
35+
36+ public function __construct(private readonly string $foo)
37+ {
38+ $this->bar = "foobar";
39+ }
40+ }
Original file line number Diff line number Diff line change @@ -27,3 +27,14 @@ public function bar($c = new \stdClass)
2727class Attr
2828{
2929}
30+
31+ class Class12
32+ {
33+ private readonly string $ bar ;
34+
35+
36+ public function __construct (private readonly string $ foo )
37+ {
38+ $ this ->bar = "foobar " ;
39+ }
40+ }
You can’t perform that action at this time.
0 commit comments