1--TEST-- 2ZE2 class type hinting 3--FILE-- 4<?php 5 6interface Foo { 7 function a(Foo $foo); 8} 9 10interface Bar { 11 function b(Bar $bar); 12} 13 14class FooBar implements Foo, Bar { 15 function a(Foo $foo) { 16 // ... 17 } 18 19 function b(Bar $bar) { 20 // ... 21 } 22} 23 24class Blort { 25} 26 27$a = new FooBar; 28$b = new Blort; 29 30$a->a($b); 31$a->b($b); 32 33?> 34--EXPECTF-- 35Fatal error: Uncaught TypeError: FooBar::a(): Argument #1 ($foo) must be of type Foo, Blort given, called in %s on line 27 and defined in %s:12 36Stack trace: 37#0 %s(%d): FooBar->a(Object(Blort)) 38#1 {main} 39 thrown in %s on line 12 40