<?php
class A {
public function test(myclass $obj) {}
}
use stdClass as myclass;
class B {
public function bar(myclass $another) {}
}
$obj = new myclass;
(new A)->test($obj);
Fatal error: Uncaught TypeError: A::test(): Argument #1 ($obj) must be of type myclass, stdClass given, called in /in/nNFfP on line 17 and defined in /in/nNFfP:4
Stack trace:
#0 /in/nNFfP(17): A->test(Object(stdClass))
#1 {main}
thrown in /in/nNFfP on line 4
Process exited with code 255.
Fatal error: Uncaught TypeError: Argument 1 passed to A::test() must be an instance of myclass, instance of stdClass given, called in /in/nNFfP on line 17 and defined in /in/nNFfP:4
Stack trace:
#0 /in/nNFfP(17): A->test(Object(stdClass))
#1 {main}
thrown in /in/nNFfP on line 4
Process exited with code 255.
Catchable fatal error: Argument 1 passed to A::test() must be an instance of myclass, instance of stdClass given, called in /in/nNFfP on line 17 and defined in /in/nNFfP on line 4
Process exited with code 255.
Output for 5.3.0 - 5.3.29
Parse error: syntax error, unexpected T_OBJECT_OPERATOR in /in/nNFfP on line 17
Process exited with code 255.
Output for 5.1.0 - 5.1.6, 5.2.0 - 5.2.17
Parse error: syntax error, unexpected T_STRING, expecting T_CONSTANT_ENCAPSED_STRING or '(' in /in/nNFfP on line 8
Process exited with code 255.
Output for 5.0.0 - 5.0.5
Parse error: parse error, unexpected T_STRING, expecting T_CONSTANT_ENCAPSED_STRING or '(' in /in/nNFfP on line 8
Process exited with code 255.
Output for 4.4.2 - 4.4.9
Parse error: syntax error, unexpected T_STRING, expecting T_OLD_FUNCTION or T_FUNCTION or T_VAR or '}' in /in/nNFfP on line 4
Process exited with code 255.
Parse error: parse error, unexpected T_STRING, expecting T_OLD_FUNCTION or T_FUNCTION or T_VAR or '}' in /in/nNFfP on line 4
Process exited with code 255.
Output for 4.3.2 - 4.3.4
Parse error: parse error, expecting `T_OLD_FUNCTION' or `T_FUNCTION' or `T_VAR' or `'}'' in /in/nNFfP on line 4
Process exited with code 255.