Hey George, How would the engine behave (with this RFC included) with an inheritance check?
Specifically: interface A { function foo(interable $param): iterable; } interface B { function foo(array|\Trabersable $param): array|\Traversable: } Would they be compatible with each other, if put in inheritance between each other in any order? On Sat, 23 Apr 2022, 14:28 G. P. B., <george.bany...@gmail.com> wrote: > Hello internals, > > One area the engine currently needs to take special care is dealing with > the typing relation between iterable, Traversable, and array. > The change is to canonicalize "iterable" into "array|Traversable" as this > then removes this special case. > > However, doing so breaks Reflection for iterable types and will now return > a ReflectionUnionType instead of a ReflectionNamed type. > There are a couple of options to proceed: > - Accept the BC break, and expect end users to already be handling union > types for code running on 8.2 (least complexity) > - Only provide a BC layer for (?)iterable to return a ReflectionNamedType > and have usages of iterable in a union type be exposed as Traversable|array > (OK complexity) > - Full BC such that even in union types where iterabl was used > Traversable|array gets converted back to iterable (high complexity) > > The PR for this change is https://github.com/php/php-src/pull/7309 > > This PR is also blocking the implementation for DNF types, as it vastly > simplifies the implementation of it. > > Best regards, > > George P. Banyard >