autoload_009.phpt 460 B

1234567891011121314151617181920
  1. --TEST--
  2. Ensure type hints for unknown types do not trigger autoload.
  3. --FILE--
  4. <?php
  5. spl_autoload_register(function ($name) {
  6. echo "In autoload: ";
  7. var_dump($name);
  8. });
  9. function f(UndefClass $x)
  10. {
  11. }
  12. f(new stdClass);
  13. ?>
  14. --EXPECTF--
  15. Fatal error: Uncaught TypeError: f(): Argument #1 ($x) must be of type UndefClass, stdClass given, called in %s on line %d and defined in %s:%d
  16. Stack trace:
  17. #0 %s(%d): f(Object(stdClass))
  18. #1 {main}
  19. thrown in %s on line %d