1--TEST--
2Nullsafe property constant expression
3--FILE--
4<?php
5
6class Printer {
7    public function __construct() {
8        echo "Printer\n";
9    }
10}
11
12const A = (null)?->test;
13var_dump(A);
14
15const B = (null)?->test->test;
16var_dump(B);
17
18const C = (null)->test?->test;
19var_dump(C);
20
21const D = (null)?->test['test'];
22var_dump(D);
23
24const E = (null)['test']?->test;
25var_dump(E);
26
27const F = (null)?->{new Printer};
28var_dump(F);
29
30const G = (null)?->test + (new Printer ? 1 : 0);
31var_dump(G);
32
33?>
34--EXPECTF--
35NULL
36NULL
37
38Warning: Attempt to read property "test" on null in %s on line %d
39NULL
40NULL
41
42Warning: Trying to access array offset on null in %s on line %d
43NULL
44NULL
45Printer
46int(1)
47