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
11871187wraps, the brace MUST be placed on the line immediately following the last
11881188interface.
11891189
1190+ If the anonymous class has no arguments, the ` () ` after ` class ` MUST be omitted.
1191+
11901192``` php
11911193<?php
11921194
11931195// Brace on the same line
1196+ // No arguments
11941197$instance = new class extends \Foo implements \HandleableInterface {
11951198 // Class content
11961199};
11971200
11981201// Brace on the next line
1199- $instance = new class extends \Foo implements
1202+ // Constructor arguments
1203+ $instance = new class($a) extends \Foo implements
12001204 \ArrayAccess,
12011205 \Countable,
12021206 \Serializable
12031207{
1208+ public function __construct(public int $a)
1209+ {
1210+ }
12041211 // Class content
12051212};
12061213```
You can’t perform that action at this time.
0 commit comments