diff --git a/spec.md b/spec.md index 50fc26e..7c82de6 100644 --- a/spec.md +++ b/spec.md @@ -1559,6 +1559,18 @@ $instance = new class ($a) extends \Foo implements }; ``` +If an anonymous class has attributes, they MUST be placed starting on the next line after the `new` keyword, indented +once, and otherwise follow the same rules as other attributes specified in section 12. The remaining anonymous class +declaration after the final attribute MUST start on a new line and keep the same indentation as the attributes: + +```php +$example = new + #[Attribute] + class { + ... + }; +``` + ## 9. Enumerations Enumerations (enums) MUST follow the same guidelines as classes, except where otherwise noted below.