1--TEST--
2Co-variance check failure for intersection type where child replace one of intersection type members with a supertype
3--FILE--
4<?php
5
6interface A {}
7interface B extends A {}
8interface C {}
9interface X {}
10
11class Test implements B, C {}
12
13class Foo {
14    public function foo(): (B&C)|X {
15        return new Test();
16    }
17}
18
19/* This fails because A is a parent type for B */
20class FooChild extends Foo {
21    public function foo(): (A&C)|X {
22        return new Test();
23    }
24}
25
26?>
27--EXPECTF--
28Fatal error: Declaration of FooChild::foo(): (A&C)|X must be compatible with Foo::foo(): (B&C)|X in %s on line %d
29