You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Promoted properties support was added by #114
For some reason, this is lacking support for promoted property default value, I am not sure if this was made on purpose or not, but adding this seems pretty straight forward
Full context of the issue: In a Symfony application, when configuring a service as lazy, this is generating a proxy under the hood (using friendsofphp/proxy-manager-lts). Hunting all deprecations on the road of upgrading PHP in my userland application, I've been faced with a notice about optional parameter being treated as required because of the parameter position. Problem is, this notice come from the generated proxy, but my userland code signature is correct. Let's consider this signature
$someOptionalConfig does not have its default value anymore, so the argument position becomes wrong because there is this optional $logger which is now treated as required.
Obviously I can change the userland code signature to fix that, but this behaviour feels unexpected
Current behavior
Promoted property default value is basically always ignored
How to reproduce
Slighlty changing the relevant test easily show the failure, see below
Generated class does include promoted property default value. Applying the below tiny patch makes the test pass, and ultimately fixes the root issue of generating proxy classes from Symfony config, but again I am not sure if this was initially made on purpose
Bug Report
Summary
Promoted properties support was added by #114
For some reason, this is lacking support for promoted property default value, I am not sure if this was made on purpose or not, but adding this seems pretty straight forward
Full context of the issue: In a Symfony application, when configuring a service as lazy, this is generating a proxy under the hood (using friendsofphp/proxy-manager-lts). Hunting all deprecations on the road of upgrading PHP in my userland application, I've been faced with a notice about optional parameter being treated as required because of the parameter position. Problem is, this notice come from the generated proxy, but my userland code signature is correct. Let's consider this signature
That signature is a bit ugly but is technically correct, the problem is, when generating a proxy for this class, you end up with
$someOptionalConfig
does not have its default value anymore, so the argument position becomes wrong because there is this optional$logger
which is now treated as required.Obviously I can change the userland code signature to fix that, but this behaviour feels unexpected
Current behavior
Promoted property default value is basically always ignored
How to reproduce
Slighlty changing the relevant test easily show the failure, see below
Expected behavior
Generated class does include promoted property default value. Applying the below tiny patch makes the test pass, and ultimately fixes the root issue of generating proxy classes from Symfony config, but again I am not sure if this was initially made on purpose
The text was updated successfully, but these errors were encountered: