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