1--TEST--
2Immediate access on new object with constructor arguments' parentheses
3--FILE--
4<?php
5
6class A implements ArrayAccess
7{
8    const C = 'constant' . PHP_EOL;
9    public $property = 'property' . PHP_EOL;
10    public static $staticProperty = 'static property' . PHP_EOL;
11
12    public function __invoke(): void
13    {
14        echo '__invoke' . PHP_EOL;
15    }
16
17    public function method(): void
18    {
19        echo 'method' . PHP_EOL;
20    }
21
22    public static function staticMethod(): void
23    {
24        echo 'static method' . PHP_EOL;
25    }
26
27    public function offsetExists(mixed $offset): bool
28    {
29        echo 'offsetExists' . PHP_EOL;
30
31        return true;
32    }
33
34    public function offsetGet(mixed $offset): mixed
35    {
36        echo 'offsetGet' . PHP_EOL;
37
38        return null;
39    }
40
41    public function offsetSet(mixed $offset, mixed $value): void {}
42
43    public function offsetUnset(mixed $offset): void {}
44}
45
46$class = A::class;
47
48echo new A()::C;
49echo new A()::{'C'};
50echo new $class()::C;
51echo new $class()::{'C'};
52echo new (trim(' A '))()::C;
53echo new (trim(' A '))()::{'C'};
54
55echo new A()->property;
56echo new $class()->property;
57echo new (trim(' A '))()->property;
58
59echo new A()::$staticProperty;
60echo new $class()::$staticProperty;
61echo new (trim(' A '))()::$staticProperty;
62
63new A()();
64new $class()();
65new (trim(' A '))()();
66
67new A()->method();
68new $class()->method();
69new (trim(' A '))()->method();
70
71new A()::staticMethod();
72new $class()::staticMethod();
73new (trim(' A '))()::staticMethod();
74
75new A()['key'];
76new $class()['key'];
77new (trim(' A '))()['key'];
78
79isset(new A()['key']);
80isset(new $class()['key']);
81isset(new (trim(' A '))()['key']);
82
83?>
84--EXPECT--
85constant
86constant
87constant
88constant
89constant
90constant
91property
92property
93property
94static property
95static property
96static property
97__invoke
98__invoke
99__invoke
100method
101method
102method
103static method
104static method
105static method
106offsetGet
107offsetGet
108offsetGet
109offsetExists
110offsetExists
111offsetExists
112