Skip to content

Commit

Permalink
fix
Browse files Browse the repository at this point in the history
  • Loading branch information
samsonasik committed Dec 24, 2024
1 parent 7525e9d commit ba5360a
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions rules/TypeDeclaration/TypeAnalyzer/NullableTypeAnalyzer.php
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,8 @@
namespace Rector\TypeDeclaration\TypeAnalyzer;

use PhpParser\Node\Expr;
use PhpParser\Node\Expr\Assign;
use PhpParser\Node\Expr\BinaryOp;
use PHPStan\Type\ObjectType;
use PHPStan\Type\TypeCombinator;
use Rector\NodeTypeResolver\NodeTypeResolver;
Expand All @@ -18,6 +20,10 @@ public function __construct(

public function resolveNullableObjectType(Expr $expr): ObjectType|null
{
if ($expr instanceof Assign) {
return null;
}

$exprType = $this->nodeTypeResolver->getNativeType($expr);

$baseType = TypeCombinator::removeNull($exprType);
Expand Down

0 comments on commit ba5360a

Please sign in to comment.