diff --git a/accepted/PSR-12-extended-coding-style-guide.md b/accepted/PSR-12-extended-coding-style-guide.md index 8f3209c41..35e4f22e9 100644 --- a/accepted/PSR-12-extended-coding-style-guide.md +++ b/accepted/PSR-12-extended-coding-style-guide.md @@ -929,7 +929,7 @@ $variable = $foo ?: 'bar'; ## 7. Closures Closures MUST be declared with a space after the `function` keyword, and a -space before and after the `use` keyword. +space before and after the `use` keyword. This includes the use of the `shortform notation`. The opening brace MUST go on the same line, and the closing brace MUST go on the next line following the body. @@ -958,6 +958,10 @@ $closureWithArgs = function ($arg1, $arg2) { // body }; +$shortClosureWithoutArgs = fn () => /* body */; + +$shortClosureWithArgs = fn ($arg1, $arg2) => /* body */; + $closureWithArgsAndVars = function ($arg1, $arg2) use ($var1, $var2) { // body }; @@ -1050,24 +1054,27 @@ in the above section. ~~~php