1<?php
2
3spl_autoload_register(function($class) {
4    if ($class == 'Bar') {
5        class Bar {
6            const BAZ = 42;
7
8            public self $x;
9            public Foo $y;
10        }
11    } else if ($class == 'Foo') {
12        class Foo {}
13    }
14});
15
16class Test {
17    const FOO = Bar::BAZ;
18}
19