magento / magento2

Prior to making any Submission(s), you must sign an Adobe Contributor License Agreement, available here at: https://opensource.adobe.com/cla.html. All Submissions you make to Adobe Inc. and its affiliates, assigns and subsidiaries (collectively “Adobe”) are subject to the terms of the Adobe Contributor License Agreement.
http://www.magento.com
Open Software License 3.0
11.54k stars 9.31k forks source link

Add PHP 8.1 Intersection Types Support for function Parameters #34931

Open karyna-t opened 2 years ago

karyna-t commented 2 years ago

In PHP 8.1, new Intersection types feature was introduced. (see details https://wiki.php.net/rfc/pure-intersection-types)

e.g. it's possible to create a function with a signature like function baz(Foo&Bar $arg) { ...

Right now Magento will not work properly with such a feature. There are several places where we're using Parameter's Class (e.g. for code generation):

These places should be adjusted to work properly with intersection types. The main reason for this adjustments it's because 3rd-party developers may develop some new extensions and declare them to support only php >= 8.1. in such modules they may use this PHP8.1-feature.

Expected result (*)

Magento should not break when Intersection types are used in the function parameters. It should properly generate code and so on.

Actual result (*)

Right now Magento can't handle Intersection types introduced in php 8.1

Related issues:

https://github.com/magento/magento2/issues/34932 https://github.com/magento/magento2/issues/34933

Note: There is a Union type feature that should also be implemented. Need to make sure that 2 people do not work on these features in parallel, as this will lead to a conflict! https://github.com/magento/magento2/issues/34263

m2-assistant[bot] commented 2 years ago

Hi @karyna-tsymbal-atwix. Thank you for your report. To speed up processing of this issue, make sure that you provided the following information:

Make sure that the issue is reproducible on the vanilla Magento instance following Steps to reproduce. To deploy vanilla Magento instance on our environment, Add a comment to the issue:

@magento give me 2.4-develop instance - upcoming 2.4.x release

For more details, review the Magento Contributor Assistant documentation.

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.


:clock10: You can find the schedule on the Magento Community Calendar page.

:telephone_receiver: 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.

:movie_camera: You can find the recording of the previous Community Contributions Triage on the Magento Youtube Channel

:pencil2: Feel free to post questions/proposals/feedback related to the Community Contributions Triage process to the corresponding Slack Channel

xmav commented 2 years ago

@magento export issue to Jira project AC

github-jira-sync-bot commented 2 years ago

:x: You don't have permission to export this issue.

m2-assistant[bot] commented 1 year ago

Hi @engcom-November. Thank you for working on this issue. In order to make sure that issue has enough information and ready for development, please read and check the following instruction: :point_down:

engcom-November commented 1 year ago

Hi @karyna-tsymbal-atwix , Thank you for reporting and collaboration. We have gone through the main description and found that this is not related to any bug of Magento but it can be a good feature to have in Magento. Hence marking this ticket as a feature request to process further. Thank you.