<?php
namespace NMSPC;
class Test2
{
public $test1 = 'fooooo';
}
class Test1
{
public function doSth(\NMSPC\Test2 $test2)
{
echo $test2;
}
}
$tst = new \NMSPC\Test1();
$tst->doSth(new \StdClass());
Fatal error: Uncaught TypeError: NMSPC\Test1::doSth(): Argument #1 ($test2) must be of type NMSPC\Test2, stdClass given, called in /in/Kf8o1 on line 19 and defined in /in/Kf8o1:12
Stack trace:
#0 /in/Kf8o1(19): NMSPC\Test1->doSth(Object(stdClass))
#1 {main}
thrown in /in/Kf8o1 on line 12
Process exited with code 255.
Fatal error: Uncaught TypeError: Argument 1 passed to NMSPC\Test1::doSth() must be an instance of NMSPC\Test2, instance of stdClass given, called in /in/Kf8o1 on line 19 and defined in /in/Kf8o1:12
Stack trace:
#0 /in/Kf8o1(19): NMSPC\Test1->doSth(Object(stdClass))
#1 {main}
thrown in /in/Kf8o1 on line 12
Process exited with code 255.
Catchable fatal error: Argument 1 passed to NMSPC\Test1::doSth() must be an instance of NMSPC\Test2, instance of stdClass given, called in /in/Kf8o1 on line 19 and defined in /in/Kf8o1 on line 12
Process exited with code 255.