Skip to content

Commit

Permalink
Add type
Browse files Browse the repository at this point in the history
  • Loading branch information
sayuprc committed Mar 16, 2024
1 parent ebf927e commit a4b1455
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion src/Rules/FunctionDefinitionCheck.php
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,8 @@
use PhpParser\Node\Expr\Variable;
use PhpParser\Node\FunctionLike;
use PhpParser\Node\Identifier;
use PhpParser\Node\IntersectionType;
use PhpParser\Node\Name;
use PhpParser\Node\NullableType;
use PhpParser\Node\Param;
use PhpParser\Node\Stmt\ClassMethod;
Expand Down Expand Up @@ -425,7 +427,7 @@ private function checkRequiredParameterAfterOptional(array $parameterNodes): arr
default => [],
};

$nullOrMixed = array_filter($types, static fn ($type) => $type instanceof Identifier && (in_array($type->name, ['null', 'mixed'], true)));
$nullOrMixed = array_filter($types, static fn (Identifier|Name|IntersectionType $type): bool => $type instanceof Identifier && (in_array($type->name, ['null', 'mixed'], true)));

if (0 < count($nullOrMixed)) {
$targetPhpVersion = '8.3';
Expand Down

0 comments on commit a4b1455

Please sign in to comment.