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
Similar to the issue described in #39502 code generation for interceptors also fails when union return types are used (eg. int|string). In the current 2.4 develop branch this is already refactored, and the responsible logic is moved to lib/internal/Magento/Framework/GetReflectionMethodReturnTypeValueTrait.php. However, for 2.4.5-p10, this is still an existing issue.
Examples
Create a new class which extends \Magento\Framework\App\ActionInterface. In the implemented execute() method add the return types to the method signature:
public function execute(): ResponseInterface|Json|ResultInterface
Run the setup:di:compile command.
You should now receive an error when the Interceptor code for the class is generated.
Call to undefined method ReflectionUnionType::getName() in vendor/magento/framework/Interception/Code/Generator/Interceptor.php
Proposed solution
The following patch applies a change similar to the fix done in the issue #39502. The original commit was e4d1043
Hi @Skullsneeze. Thank you for your report.
To speed up processing of this issue, make sure that the issue is reproducible on the vanilla Magento instance following Steps to reproduce.
Add a comment to assign the issue: @magento I am working on this
To learn more about issue processing workflow, refer to the Code Contributions.
Join Magento Community Engineering Slack and ask your questions in #github channel. ⚠️ According to the Magento Contribution requirements, all issues must go through the Community Contributions Triage process. Community Contributions Triage is a public meeting.
🕙 You can find the schedule on the Magento Community Calendar page.
📞 The triage of issues happens in the queue order. If you want to speed up the delivery of your contribution, join the Community Contributions Triage session to discuss the appropriate ticket.
Summary
Similar to the issue described in #39502 code generation for interceptors also fails when union return types are used (eg.
int|string
). In the current 2.4 develop branch this is already refactored, and the responsible logic is moved tolib/internal/Magento/Framework/GetReflectionMethodReturnTypeValueTrait.php
. However, for 2.4.5-p10, this is still an existing issue.Examples
Create a new class which extends
\Magento\Framework\App\ActionInterface
. In the implementedexecute()
method add the return types to the method signature:Run the
setup:di:compile
command.You should now receive an error when the Interceptor code for the class is generated.
Proposed solution
The following patch applies a change similar to the fix done in the issue #39502. The original commit was e4d1043
Patch:
Release note
No response
Triage and priority
The text was updated successfully, but these errors were encountered: