Skip to content

Commit

Permalink
Merge pull request #167 from PHPCSStandards/functiondeclarations/arro…
Browse files Browse the repository at this point in the history
…wfunctions-support-static-return-type

FunctionDeclarations::isArrowFunction(): add test with PHP 8 "static" return type
  • Loading branch information
jrfnl committed Jul 15, 2020
2 parents a07fd2e + 744119d commit 568b6c9
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 0 deletions.
3 changes: 3 additions & 0 deletions Tests/Utils/FunctionDeclarations/IsArrowFunctionTest.inc
Expand Up @@ -76,6 +76,9 @@ $fn = fn(callable $a) : callable => $a;
/* testReturnTypeArray */
$fn = fn(array $a) : array => $a;

/* testReturnTypeStatic */
$fn = fn(array $a) : static => $a;

/* testReturnTypeArrayBug2773 */
$fn = fn(): array => [a($a, $b)];

Expand Down
12 changes: 12 additions & 0 deletions Tests/Utils/FunctionDeclarations/IsArrowFunctionTest.php
Expand Up @@ -396,6 +396,18 @@ public function dataArrowFunction()
],
],
],
'arrow-function-with-return-type-static' => [
'/* testReturnTypeStatic */',
[
'is' => true,
'get' => [
'parenthesis_opener' => 1,
'parenthesis_closer' => 5,
'scope_opener' => 11,
'scope_closer' => 14,
],
],
],
'arrow-function-with-return-type-array-bug-2773' => [
'/* testReturnTypeArrayBug2773 */',
[
Expand Down

0 comments on commit 568b6c9

Please sign in to comment.