xref: /PHP-8.0/tests/classes/autoload_009.phpt (revision 960318ed)
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: f(): Argument #1 ($x) must be of type UndefClass, 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