1--TEST--
2Replacing object type with intersection type
3--FILE--
4<?php
5
6// It's sufficient that Y is loadable.
7interface Y {}
8
9class Test {
10    function method1(): object {}
11    function method2(): object|int {}
12    function method3(): Y|int {}
13}
14class Test2 extends Test {
15    function method1(): (X&Y)|Countable {}
16    function method2(): (X&Y)|int {}
17    function method3(): (X&Y)|int {}
18}
19
20?>
21===DONE===
22--EXPECT--
23===DONE===
24