Skip to content

Commit

Permalink
add assign condition to ensure patch on this specific use case
Browse files Browse the repository at this point in the history
  • Loading branch information
samsonasik committed Dec 30, 2024
1 parent 9cf83fb commit ad2defd
Showing 1 changed file with 2 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
namespace Rector\CodeQuality\Rector\LogicalAnd;

use PhpParser\Node;
use PhpParser\Node\Expr\Assign;
use PhpParser\Node\Expr\BinaryOp\BooleanAnd;
use PhpParser\Node\Expr\BinaryOp\BooleanOr;
use PhpParser\Node\Expr\BinaryOp\LogicalAnd;
Expand Down Expand Up @@ -55,7 +56,7 @@ public function refactor(Node $node): BooleanAnd|BooleanOr|null
{
$type = $this->nodeTypeResolver->getNativeType($node->left);

if (! $type->isBoolean()->yes()) {
if ($node->left instanceof Assign && ! $type->isBoolean()->yes()) {
return null;
}

Expand Down

0 comments on commit ad2defd

Please sign in to comment.