Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
31 changes: 31 additions & 0 deletions spec.md
Original file line number Diff line number Diff line change
Expand Up @@ -297,6 +297,14 @@ there are no arguments passed to the constructor.
new Foo();
```

If class contains no additional declarations (such as an exception that exists only extend another exception with a new type),
then the body of the class SHOULD be abbreviated as `{}` and placed on the same line as the previous symbol,
separated by a space. For example:

```php
class MyException extends \RuntimeException {}
Comment thread
samdark marked this conversation as resolved.
```

### 4.1 Extends and Implements

The `extends` and `implements` keywords MUST be declared on the same line as
Expand Down Expand Up @@ -513,6 +521,29 @@ function fooBarBaz($arg1, &$arg2, $arg3 = [])
}
```

If a function or method contains no statements (such as a no-op implementation or when using
constructor property promotion), then the body SHOULD be abbreviated as `{}` and placed on the same
line as the previous symbol, separated by a space. For example:

```php
class Point
{
public function __construct(private int $x, private int $y) {}

// ...
}
```

```php
class Point
{
public function __construct(
public readonly int $x,
public readonly int $y,
) {}
Comment thread
samdark marked this conversation as resolved.
}
```

### 4.5 Method and Function Parameters

In the argument list, there MUST NOT be a space before each comma, and there
Expand Down