File tree Expand file tree Collapse file tree 1 file changed +8
-1
lines changed Expand file tree Collapse file tree 1 file changed +8
-1
lines changed Original file line number Diff line number Diff line change @@ -1187,20 +1187,27 @@ the list of `implements` interfaces does not wrap. If the list of interfaces
1187
1187
wraps, the brace MUST be placed on the line immediately following the last
1188
1188
interface.
1189
1189
1190
+ If the anonymous class has no arguments, the ` () ` after ` class ` MUST be omitted.
1191
+
1190
1192
``` php
1191
1193
<?php
1192
1194
1193
1195
// Brace on the same line
1196
+ // No arguments
1194
1197
$instance = new class extends \Foo implements \HandleableInterface {
1195
1198
// Class content
1196
1199
};
1197
1200
1198
1201
// Brace on the next line
1199
- $instance = new class extends \Foo implements
1202
+ // Constructor arguments
1203
+ $instance = new class($a) extends \Foo implements
1200
1204
\ArrayAccess,
1201
1205
\Countable,
1202
1206
\Serializable
1203
1207
{
1208
+ public function __construct(public int $a)
1209
+ {
1210
+ }
1204
1211
// Class content
1205
1212
};
1206
1213
```
You can’t perform that action at this time.
0 commit comments