Skip to content

Commit 2f4244d

Browse files
committed
Hotfix: PHP 7.4 fn keyword should be lowercase
Updated sniffs: - Generic.PHP.LowerCaseKeyword - Squiz.Functions.LowercaseFunctionKeywords
1 parent 119a702 commit 2f4244d

8 files changed

+10
-0
lines changed

src/Standards/Generic/Sniffs/PHP/LowerCaseKeywordSniff.php

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -56,6 +56,7 @@ public function register()
5656
T_EXTENDS,
5757
T_FINAL,
5858
T_FINALLY,
59+
T_FN,
5960
T_FOR,
6061
T_FOREACH,
6162
T_FUNCTION,

src/Standards/Generic/Tests/PHP/LowerCaseKeywordUnitTest.inc

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,4 +28,5 @@ class X extends Y {
2828
Self::n();
2929
}
3030
}
31+
FN ($x) => $x;
3132
function

src/Standards/Generic/Tests/PHP/LowerCaseKeywordUnitTest.inc.fixed

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,4 +28,5 @@ class X extends Y {
2828
self::n();
2929
}
3030
}
31+
fn ($x) => $x;
3132
function

src/Standards/Generic/Tests/PHP/LowerCaseKeywordUnitTest.php

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,7 @@ public function getErrorList()
3737
21 => 1,
3838
25 => 1,
3939
28 => 1,
40+
31 => 1,
4041
];
4142

4243
}//end getErrorList()

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

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,7 @@ public function register()
2727
$tokens = Tokens::$methodPrefixes;
2828
$tokens[] = T_FUNCTION;
2929
$tokens[] = T_CLOSURE;
30+
$tokens[] = T_FN;
3031

3132
return $tokens;
3233

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

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,3 +24,5 @@ abstract class Bar {
2424
ABSTRACT proTECted FUNCTION AbstractProtectedFunction();
2525
Final STATIC PUBLIC Function FinalStaticPublicFunction() {}
2626
}
27+
28+
$a = FN($x) => $x;

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

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,3 +24,5 @@ abstract class Bar {
2424
abstract protected function AbstractProtectedFunction();
2525
final static public function FinalStaticPublicFunction() {}
2626
}
27+
28+
$a = fn($x) => $x;

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

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,7 @@ public function getErrorList()
3434
23 => 1,
3535
24 => 3,
3636
25 => 4,
37+
28 => 1,
3738
];
3839

3940
}//end getErrorList()

0 commit comments

Comments
 (0)