From c2bf3c7249af2cc5c55fb584667a69b142128b60 Mon Sep 17 00:00:00 2001 From: Tomas Votruba Date: Wed, 11 Dec 2024 13:20:26 +0000 Subject: [PATCH] Updated Rector to commit 9bdfa766455d52f9894948f07cdb83a3579f3e39 https://github.com/rectorphp/rector-src/commit/9bdfa766455d52f9894948f07cdb83a3579f3e39 [CodeQuality] Handle crash array dim fetch on OptionalParametersAfterRequiredRector (#6549) --- src/Application/VersionResolver.php | 4 ++-- .../PHPStan/Scope/PHPStanNodeScopeResolver.php | 10 +++++++++- 2 files changed, 11 insertions(+), 3 deletions(-) diff --git a/src/Application/VersionResolver.php b/src/Application/VersionResolver.php index 268ea7d5a3f..d73e3131c5f 100644 --- a/src/Application/VersionResolver.php +++ b/src/Application/VersionResolver.php @@ -19,12 +19,12 @@ final class VersionResolver * @api * @var string */ - public const PACKAGE_VERSION = '0a235409f5f51a757dccc2dbbca0e695c9cb32a4'; + public const PACKAGE_VERSION = '9bdfa766455d52f9894948f07cdb83a3579f3e39'; /** * @api * @var string */ - public const RELEASE_DATE = '2024-12-11 19:50:02'; + public const RELEASE_DATE = '2024-12-11 13:17:55'; /** * @var int */ diff --git a/src/NodeTypeResolver/PHPStan/Scope/PHPStanNodeScopeResolver.php b/src/NodeTypeResolver/PHPStan/Scope/PHPStanNodeScopeResolver.php index a72f2abe5eb..0957a22f17e 100644 --- a/src/NodeTypeResolver/PHPStan/Scope/PHPStanNodeScopeResolver.php +++ b/src/NodeTypeResolver/PHPStan/Scope/PHPStanNodeScopeResolver.php @@ -196,8 +196,16 @@ final class PHPStanNodeScopeResolver $node->expr->setAttribute(AttributeKey::SCOPE, $mutatingScope); return; } - if ($node instanceof PostInc || $node instanceof PostDec || $node instanceof PreInc || $node instanceof PreDec || $node instanceof ArrayDimFetch) { + if ($node instanceof PostInc || $node instanceof PostDec || $node instanceof PreInc || $node instanceof PreDec) { $node->var->setAttribute(AttributeKey::SCOPE, $mutatingScope); + return; + } + if ($node instanceof ArrayDimFetch) { + $node->var->setAttribute(AttributeKey::SCOPE, $mutatingScope); + if ($node->dim instanceof Expr) { + $node->dim->setAttribute(AttributeKey::SCOPE, $mutatingScope); + } + return; } if ($node instanceof Assign || $node instanceof AssignOp) { $this->processAssign($node, $mutatingScope);