ns_071.phpt 499 B

12345678910111213141516171819202122232425
  1. --TEST--
  2. Testing parameter type-hinted (array) with default value inside namespace
  3. --FILE--
  4. <?php
  5. namespace foo;
  6. class bar {
  7. public function __construct(array $x = NULL) {
  8. var_dump($x);
  9. }
  10. }
  11. new bar(null);
  12. new bar(new \stdclass);
  13. ?>
  14. --EXPECTF--
  15. NULL
  16. Fatal error: Uncaught TypeError: foo\bar::__construct(): Argument #1 ($x) must be of type ?array, stdClass given, called in %s:%d
  17. Stack trace:
  18. #0 %s(%d): foo\bar->__construct(Object(stdClass))
  19. #1 {main}
  20. thrown in %s on line %d