<?php
set_error_handler(function () {});
class Foo {}
class Bar {}
function test(Foo $instance) { var_dump($instance); }
test(new Bar);
test(123);
test('Really?');
Fatal error: Uncaught TypeError: test(): Argument #1 ($instance) must be of type Foo, Bar given, called in /in/4j4aQ on line 10 and defined in /in/4j4aQ:8
Stack trace:
#0 /in/4j4aQ(10): test(Object(Bar))
#1 {main}
thrown in /in/4j4aQ on line 8
Process exited with code 255.
Fatal error: Uncaught TypeError: Argument 1 passed to test() must be an instance of Foo, instance of Bar given, called in /in/4j4aQ on line 10 and defined in /in/4j4aQ:8
Stack trace:
#0 /in/4j4aQ(10): test(Object(Bar))
#1 {main}
thrown in /in/4j4aQ on line 8
Process exited with code 255.