Description
In PHP 8, new Union types feature was introduced.
(see details https://wiki.php.net/rfc/union_types_v2)
e.g. it's possible to create a function with a signature like
function baz(Foo|Bar|int $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):
- https://github.com/magento/magento2/blob/platform-health/lib/internal/Magento/Framework/Code/Generator/EntityAbstract.php#L338
- https://github.com/magento/magento2/blob/platform-health/lib/internal/Magento/Framework/Code/Reader/ArgumentsReader.php#L105
- https://github.com/magento/magento2/blob/platform-health/lib/internal/Magento/Framework/Code/Reader/ClassReader.php#L36
- https://github.com/magento/magento2/blob/platform-health/lib/internal/Magento/Framework/Code/Reader/SourceArgumentsReader.php#L69
- https://github.com/magento/magento2/blob/platform-health/lib/internal/Magento/Framework/Interception/Code/InterfaceValidator.php#L175
- https://github.com/magento/magento2/blob/platform-health/lib/internal/Magento/Framework/TestFramework/Unit/Helper/ObjectManager.php
(better to re-check other places)
These places should be adjusted to work properly with union 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.0.
in such modules they may use this PHP8-feature.
Expected result (*)
Magento should not break when union types are used in the function parameters. It should properly generate code and so on.
Actual result (*)
Right now Magento can't handle union types introduced in php 8.
Related issues:
Metadata
Metadata
Assignees
Type
Projects
Status