Skip to content

Commit

Permalink
Allow abbreviated empty bodies.
Browse files Browse the repository at this point in the history
  • Loading branch information
Crell committed Sep 12, 2022
1 parent 9dc210d commit 2441346
Showing 1 changed file with 23 additions and 0 deletions.
23 changes: 23 additions & 0 deletions spec.md
Original file line number Diff line number Diff line change
Expand Up @@ -513,6 +513,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,
) {}
}
```

### 4.5 Method and Function Arguments

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

0 comments on commit 2441346

Please sign in to comment.