On Sat, 23 Apr 2022 at 19:19, Marco Pivetta <ocram...@gmail.com> wrote:

> 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?
>

They would, that's the main point of this change is to make handling this
sort of code easier.
As currently we need to manually check that array is indeed compatible with
iterable and similarly with Traversable.

With this change, the engine would effectively see:

interface A {
    function foo(array|\Traversable $param): array|\Traversable;
}
interface B {
    function foo(array|\Trabersable $param): array|\Traversable:
}

Allowing us to use the generic LSP handling (and in this case it is trivial)

Reply via email to