Skip to content

Commit 62ae7e7

Browse files
committed
Adds support for array closures in Squiz.Functions.FunctionDeclarationArgumentSpacing
Related to #2523
1 parent 80ebd4a commit 62ae7e7

File tree

4 files changed

+6
-0
lines changed

4 files changed

+6
-0
lines changed

src/Standards/Squiz/Sniffs/Functions/FunctionDeclarationArgumentSpacingSniff.php

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -48,6 +48,7 @@ public function register()
4848
return [
4949
T_FUNCTION,
5050
T_CLOSURE,
51+
T_FN,
5152
];
5253

5354
}//end register()

src/Standards/Squiz/Tests/Functions/FunctionDeclarationArgumentSpacingUnitTest.inc

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -107,3 +107,5 @@ $a = function ($var1, $var2=false) use (
107107
$longVar2 , &$longerVar2,
108108
$muchLongerVar3
109109
) {};
110+
111+
fn ($a,$b = null) => $a($b);

src/Standards/Squiz/Tests/Functions/FunctionDeclarationArgumentSpacingUnitTest.inc.fixed

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -107,3 +107,5 @@ $a = function ($var1, $var2=false) use (
107107
$longVar2, &$longerVar2,
108108
$muchLongerVar3
109109
) {};
110+
111+
fn ($a, $b=null) => $a($b);

src/Standards/Squiz/Tests/Functions/FunctionDeclarationArgumentSpacingUnitTest.php

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -62,6 +62,7 @@ public function getErrorList()
6262
102 => 2,
6363
106 => 1,
6464
107 => 2,
65+
111 => 3,
6566
];
6667

6768
}//end getErrorList()

0 commit comments

Comments
 (0)