Skip to content

Commit

Permalink
fix phpstan
Browse files Browse the repository at this point in the history
  • Loading branch information
samsonasik committed Aug 22, 2024
1 parent 809a706 commit 9411b0c
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion rules/Php84/Rector/Param/ExplicitNullableParamTypeRector.php
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
use PhpParser\Node;
use PhpParser\Node\ComplexType;
use PhpParser\Node\Expr\ConstFetch;
use PhpParser\Node\IntersectionType;
use PhpParser\Node\Name;
use PhpParser\Node\NullableType;
use PhpParser\Node\Param;
Expand Down Expand Up @@ -83,7 +84,9 @@ public function refactor(Node $node): ?Param
if ($node->type instanceof UnionType) {
$node->type->types[] = new Name('null');
} elseif ($node->type instanceof ComplexType) {
$node->type = new UnionType([$node->type, new Name('null')]);
/** @var IntersectionType $nodeType */
$nodeType = $node->type;
$node->type = new UnionType([$nodeType, new Name('null')]);
} else {
$node->type = new NullableType($node->type);
}
Expand Down

0 comments on commit 9411b0c

Please sign in to comment.