xref: /PHP-7.3/Zend/tests/bug43332_1.phpt (revision 4ea1d8a9)
1--TEST--
2Bug #43332.1 (self and parent as type hint in namespace)
3--FILE--
4<?php
5namespace foobar;
6
7class foo {
8  public function bar(self $a) { }
9}
10
11$foo = new foo;
12$foo->bar($foo); // Ok!
13$foo->bar(new \stdclass); // Error, ok!
14--EXPECTF--
15Fatal error: Uncaught TypeError: Argument 1 passed to foobar\foo::bar() must be an instance of foobar\foo, instance of stdClass given, called in %sbug43332_1.php on line 10 and defined in %sbug43332_1.php:5
16Stack trace:
17#0 %s(%d): foobar\foo->bar(Object(stdClass))
18#1 {main}
19  thrown in %sbug43332_1.php on line 5
20