--TEST-- Missing one element of intersection type --FILE-- getMessage(), "\n"; } $c = new Collection(); $a = new A(); try { $c->intersect = $a; } catch (\TypeError $e) { echo $e->getMessage(), "\n"; } try { bar($a); } catch (\TypeError $e) { echo $e->getMessage(), "\n"; } ?> --EXPECTF-- foo(): Return value must be of type X&Y, A returned Cannot assign A to property Collection::$intersect of type X&Y bar(): Argument #1 ($o) must be of type X&Y, A given, called in %s on line %d