From f77e8b8450642aabe75d7af2d4114d31bfdfc1a0 Mon Sep 17 00:00:00 2001 From: Tomas Votruba Date: Sat, 23 Dec 2023 20:44:18 +0000 Subject: [PATCH] Updated Rector to commit 16f8d19db32108740794a68a011c78328bb69aed https://github.com/rectorphp/rector-src/commit/16f8d19db32108740794a68a011c78328bb69aed Fix StrictArrayParamDimFetchRector for string access (#5383) --- .../Rector/ClassMethod/StrictArrayParamDimFetchRector.php | 8 ++++++++ src/Application/VersionResolver.php | 4 ++-- 2 files changed, 10 insertions(+), 2 deletions(-) diff --git a/rules/TypeDeclaration/Rector/ClassMethod/StrictArrayParamDimFetchRector.php b/rules/TypeDeclaration/Rector/ClassMethod/StrictArrayParamDimFetchRector.php index 58beb0a3cda..30897c099d6 100644 --- a/rules/TypeDeclaration/Rector/ClassMethod/StrictArrayParamDimFetchRector.php +++ b/rules/TypeDeclaration/Rector/ClassMethod/StrictArrayParamDimFetchRector.php @@ -118,6 +118,9 @@ CODE_SAMPLE if (!$node instanceof ArrayDimFetch) { return null; } + if (!$node->dim instanceof Expr) { + return null; + } if (!$node->var instanceof Variable) { return null; } @@ -129,6 +132,11 @@ CODE_SAMPLE if ($variableType->isString()->yes()) { return null; } + // skip integer in possibly string type as string can be accessed via int + $dimType = $this->getType($node->dim); + if ($dimType->isInteger()->yes() && $variableType->isString()->maybe()) { + return null; + } $isParamAccessedArrayDimFetch = \true; return null; }); diff --git a/src/Application/VersionResolver.php b/src/Application/VersionResolver.php index a411587669c..cc610d425e3 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 = 'a644d0d4a2f1e457f77cf8e384fd32b78b5ff388'; + public const PACKAGE_VERSION = '16f8d19db32108740794a68a011c78328bb69aed'; /** * @api * @var string */ - public const RELEASE_DATE = '2023-12-23 20:42:09'; + public const RELEASE_DATE = '2023-12-23 20:41:53'; /** * @var int */