1--TEST--
2Co-variance failure for intersection type where child is union, but not all members are a subtype of intersection 2
3--FILE--
4<?php
5
6interface X {}
7interface Y {}
8interface Z extends Y {}
9
10class TestOne implements X, Z {}
11class TestTwo implements X, Y {}
12
13interface A
14{
15    public function foo(): X&Z;
16}
17
18interface B extends A
19{
20    public function foo(): TestOne|TestTwo;
21}
22
23?>
24--EXPECTF--
25Fatal error: Declaration of B::foo(): TestOne|TestTwo must be compatible with A::foo(): X&Z in %s on line %d
26