bug43332_1.phpt 481 B

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