diff --git a/src/Tokenizers/PHP.php b/src/Tokenizers/PHP.php index 2fc86a86d6..7224fb27ec 100644 --- a/src/Tokenizers/PHP.php +++ b/src/Tokenizers/PHP.php @@ -1829,6 +1829,7 @@ protected function processAdditional() T_CALLABLE => T_CALLABLE, T_PARENT => T_PARENT, T_SELF => T_SELF, + T_STATIC => T_STATIC, ]; $closer = $this->tokens[$x]['parenthesis_closer']; diff --git a/tests/Core/Tokenizer/BackfillFnTokenTest.inc b/tests/Core/Tokenizer/BackfillFnTokenTest.inc index 7714a78680..083fe6979c 100644 --- a/tests/Core/Tokenizer/BackfillFnTokenTest.inc +++ b/tests/Core/Tokenizer/BackfillFnTokenTest.inc @@ -75,6 +75,9 @@ fn(callable $a) : callable => $a; /* testArrayReturnType */ fn(array $a) : array => $a; +/* testStaticReturnType */ +fn(array $a) : static => $a; + /* testTernary */ $fn = fn($a) => $a ? /* testTernaryThen */ fn() : string => 'a' : /* testTernaryElse */ fn() : string => 'b'; diff --git a/tests/Core/Tokenizer/BackfillFnTokenTest.php b/tests/Core/Tokenizer/BackfillFnTokenTest.php index 4dbb8b43c4..45bbbb4415 100644 --- a/tests/Core/Tokenizer/BackfillFnTokenTest.php +++ b/tests/Core/Tokenizer/BackfillFnTokenTest.php @@ -466,7 +466,7 @@ public function testNullableNamespace() /** - * Test arrow functions that use self/parent/callable return types. + * Test arrow functions that use self/parent/callable/array/static return types. * * @covers PHP_CodeSniffer\Tokenizers\PHP::processAdditional * @@ -481,6 +481,7 @@ public function testKeywordReturnTypes() 'Parent', 'Callable', 'Array', + 'Static', ]; foreach ($testMarkers as $marker) {