1--TEST--
2RHS gets evaluated before throwing error when accessing properties on non-enums in constant expressions
3--FILE--
4<?php
5
6class A {
7    public $prop = 42;
8}
9
10class Printer {
11    public function __construct() {
12        echo "Printer\n";
13        return 'printer';
14    }
15}
16
17const A_prop = (new A)->{new Printer ? 'printer' : null};
18
19?>
20--EXPECTF--
21Printer
22
23Fatal error: Uncaught Error: Fetching properties on non-enums in constant expressions is not allowed in %s:%d
24Stack trace:
25#0 {main}
26  thrown in %s on line %d
27