File tree Expand file tree Collapse file tree 4 files changed +11
-6
lines changed
tests/PhpGenerator/expected Expand file tree Collapse file tree 4 files changed +11
-6
lines changed Original file line number Diff line number Diff line change @@ -199,9 +199,14 @@ public function fromCallable(callable $from): Method|GlobalFunction|Closure
199199
200200 public function fromParameterReflection (\ReflectionParameter $ from ): Parameter
201201 {
202- $ param = $ from ->isPromoted ()
203- ? (new PromotedParameter ($ from ->name ))->setReadOnly (PHP_VERSION_ID >= 80100 && $ from ->getDeclaringClass ()->getProperty ($ from ->name )->isReadonly ())
204- : new Parameter ($ from ->name );
202+ if ($ from ->isPromoted ()) {
203+ $ property = $ from ->getDeclaringClass ()->getProperty ($ from ->name );
204+ $ param = (new PromotedParameter ($ from ->name ))
205+ ->setVisibility ($ this ->getVisibility ($ property ))
206+ ->setReadOnly (PHP_VERSION_ID >= 80100 && $ property ->isReadonly ());
207+ } else {
208+ $ param = new Parameter ($ from ->name );
209+ }
205210 $ param ->setReference ($ from ->isPassedByReference ());
206211 $ param ->setType ((string ) $ from ->getType ());
207212
Original file line number Diff line number Diff line change @@ -28,7 +28,7 @@ class Class12
2828
2929
3030 public function __construct(
31- public readonly string $foo,
31+ private readonly string $foo,
3232 ) {
3333 }
3434}
Original file line number Diff line number Diff line change @@ -4,7 +4,7 @@ readonly class Class13
44
55
66 public function __construct(
7- public bool $bar = true,
7+ private bool $bar = true,
88 ) {
99 }
1010
Original file line number Diff line number Diff line change @@ -111,7 +111,7 @@ class Class8
111111{
112112 public function __construct(
113113 public $a,
114- public string|int $b = 10,
114+ private string|int $b = 10,
115115 $c = null,
116116 ) {
117117 }
You can’t perform that action at this time.
0 commit comments