diff --git a/composer.json b/composer.json index 5386520..a9a6a2a 100644 --- a/composer.json +++ b/composer.json @@ -37,7 +37,7 @@ "roave/backward-compatibility-check": "^8.0", "testo/bridge-infection": "^0.1.6", "testo/testo": "^0.10.25", - "vimeo/psalm": "^6.16" + "vimeo/psalm": "^7.0" }, "autoload": { "psr-4": { diff --git a/src/LostDateTimeMutationRector.php b/src/LostDateTimeMutationRector.php index d295419..89fb2f7 100644 --- a/src/LostDateTimeMutationRector.php +++ b/src/LostDateTimeMutationRector.php @@ -396,10 +396,8 @@ private function forgetAssignedVariables(?Expr $expr, Node $context): void return; } - foreach ($expr->items as $item) { - if ($item !== null) { - $this->forgetAssignedVariables($item->value, $context); - } + foreach (array_filter($expr->items) as $item) { + $this->forgetAssignedVariables($item->value, $context); } }