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
22 changes: 22 additions & 0 deletions spec.md
Original file line number Diff line number Diff line change
Expand Up @@ -1066,6 +1066,28 @@ MUST follow the same style rules as other binary [comparison][] operators:
$variable = $foo ?: 'bar';
```

### 6.4. Operator's placement

A statement that includes an operator MAY be split across multiple lines, where
each subsequent line is indented once. When doing so, the operator MUST be
placed at the beginning of the new line; ternaries MUST occupy 3 lines, never 2.

For example:

```php
<?php

$variable1 = $ternaryOperatorExpr
? 'fizz'
: 'buzz';

$variable2 = $possibleNullableExpr
?? 'fallback';

$variable3 = $elvisExpr
?: 'qix';
```

## 7. Closures

Closures, also known as anonymous functions, MUST be declared with a space
Expand Down