1--TEST--
2Intersection types in parameters
3--FILE--
4<?php
5
6interface A {}
7interface B {}
8
9class Foo implements A, B {}
10class Bar implements A {}
11
12function foo(A&B $bar) {
13    var_dump($bar);
14}
15
16foo(new Foo());
17
18try {
19    foo(new Bar());
20} catch (\TypeError $e) {
21    echo $e->getMessage(), \PHP_EOL;
22}
23
24?>
25--EXPECTF--
26object(Foo)#1 (0) {
27}
28foo(): Argument #1 ($bar) must be of type A&B, Bar given, called in %s on line %d
29