@@ -1292,18 +1292,29 @@ $intValue = (int) $input;
12921292
12931293### 6.2. Binary operators
12941294
1295- All binary [ arithmetic] [ ] , [ comparison] [ ] , [ assignment] [ ] , [ bitwise] [ ] ,
1296- [ logical] [ ] , [ string] [ ] , and [ type] [ ] operators MUST be preceded and
1297- followed by at least one space:
1295+ All binary operators MUST be preceded and followed by at least one space:
12981296
12991297``` php
13001298if ($a === $b) {
13011299 $foo = $bar ?? $a ?? $b;
13021300} elseif ($a > $b) {
13031301 $foo = $a + $b * $c;
1302+ } else {
1303+ $foo = $a |> log(...) |> round(...);
13041304}
13051305```
13061306
1307+ As of writing, this applies to:
1308+
1309+ * ` ** * / % + - ` [ arithmetic] [ ] operators
1310+ * ` < <= > >= == != === !== <> <=> ` [ comparison] [ ] operators
1311+ * ` = += -= *= **= /= .= %= &= |= ^= <<= >>= ??= ` [ assignment] [ ] operators
1312+ * ` << >> & ^ | ` [ bitwise] [ ] operators
1313+ * ` && || and xor or ` [ logical] [ ] operators
1314+ * ` . ` [ string] [ ] operator ("concatenation")
1315+ * ` instanceof ` [ type] [ ] operator
1316+ * ` |> ` [ functional] [ ] operator ("pipe")
1317+
13071318### 6.3. Ternary operators
13081319
13091320The conditional operator, also known simply as the ternary operator, MUST be
@@ -1341,6 +1352,10 @@ $variable2 = $possibleNullableExpr
13411352
13421353$variable3 = $elvisExpr
13431354 ?: 'qix';
1355+
1356+ $variable4 = '<foo >'
1357+ |> strtoupper(...)
1358+ |> htmlspecialchars(...);
13441359```
13451360
13461361## 7. Closures
@@ -1782,12 +1797,13 @@ class Demo
17821797
17831798[ PSR-1 ] : https://www.php-fig.org/psr/psr-1/
17841799[ PSR-12 ] : https://www.php-fig.org/psr/psr-12/
1785- [ keywords ] : http://php.net/manual/en/reserved.keywords.php
1786- [ types ] : http://php.net/manual/en/reserved.other-reserved-words.php
1787- [ arithmetic ] : http://php.net/manual/en/language.operators.arithmetic.php
1788- [ assignment ] : http://php.net/manual/en/language.operators.assignment.php
1789- [ comparison ] : http://php.net/manual/en/language.operators.comparison.php
1790- [ bitwise ] : http://php.net/manual/en/language.operators.bitwise.php
1791- [ logical ] : http://php.net/manual/en/language.operators.logical.php
1792- [ string ] : http://php.net/manual/en/language.operators.string.php
1793- [ type ] : http://php.net/manual/en/language.operators.type.php
1800+ [ keywords ] : https://php.net/manual/en/reserved.keywords.php
1801+ [ types ] : https://php.net/manual/en/reserved.other-reserved-words.php
1802+ [ arithmetic ] : https://php.net/manual/en/language.operators.arithmetic.php
1803+ [ assignment ] : https://php.net/manual/en/language.operators.assignment.php
1804+ [ comparison ] : https://php.net/manual/en/language.operators.comparison.php
1805+ [ bitwise ] : https://php.net/manual/en/language.operators.bitwise.php
1806+ [ logical ] : https://php.net/manual/en/language.operators.logical.php
1807+ [ string ] : https://php.net/manual/en/language.operators.string.php
1808+ [ type ] : https://php.net/manual/en/language.operators.type.php
1809+ [ functional ] : https://php.net/manual/en/language.operators.functional.php
0 commit comments