1--TEST--
2Dynamic class constant fetch DIM order
3--FILE--
4<?php
5
6class Foo {
7    public const FOO = 'Foo';
8}
9
10function foo() {
11    echo "foo()\n";
12    return 'FOO';
13}
14
15function bar() {
16    echo "bar()\n";
17    return 'BAR';
18}
19
20function test($c) {
21    try {
22        echo $c(), "\n";
23    } catch (Throwable $e) {
24        echo $e->getMessage(), "\n";
25    }
26}
27
28test(fn() => Foo::{foo()}::{bar()});
29test(fn() => Foo::{bar()}::{foo()});
30
31?>
32--EXPECT--
33foo()
34bar()
35Undefined constant Foo::BAR
36bar()
37Undefined constant Foo::BAR
38