From ba5360a30a119c20c98f6d0831cdd6cc5f2c0667 Mon Sep 17 00:00:00 2001 From: Abdul Malik Ikhsan Date: Wed, 25 Dec 2024 00:22:13 +0700 Subject: [PATCH] fix --- rules/TypeDeclaration/TypeAnalyzer/NullableTypeAnalyzer.php | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/rules/TypeDeclaration/TypeAnalyzer/NullableTypeAnalyzer.php b/rules/TypeDeclaration/TypeAnalyzer/NullableTypeAnalyzer.php index 5720329c936..c2eba428503 100644 --- a/rules/TypeDeclaration/TypeAnalyzer/NullableTypeAnalyzer.php +++ b/rules/TypeDeclaration/TypeAnalyzer/NullableTypeAnalyzer.php @@ -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; @@ -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);