<?php
namespace NMSPC;
class Test2
{
public $test1 = 'fooooo';
}
class Test1
{
public function doSth(\NMSPC\Test2 $test2)
{
echo $test2;
}
}
(new \NMSPC\Test1())->doSth(new \StdClass());
Fatal error: Uncaught TypeError: NMSPC\Test1::doSth(): Argument #1 ($test2) must be of type NMSPC\Test2, stdClass given, called in /in/Z0pFY on line 18 and defined in /in/Z0pFY:12
Stack trace:
#0 /in/Z0pFY(18): NMSPC\Test1->doSth(Object(stdClass))
#1 {main}
thrown in /in/Z0pFY 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/Z0pFY on line 18 and defined in /in/Z0pFY:12
Stack trace:
#0 /in/Z0pFY(18): NMSPC\Test1->doSth(Object(stdClass))
#1 {main}
thrown in /in/Z0pFY 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/Z0pFY on line 18 and defined in /in/Z0pFY on line 12
Process exited with code 255.
Output for 5.3.0 - 5.3.29
Parse error: syntax error, unexpected T_OBJECT_OPERATOR in /in/Z0pFY on line 18
Process exited with code 255.