From 4cf16f617fa7c953e7609d841bb669a952558324 Mon Sep 17 00:00:00 2001 From: Tomas Votruba Date: Sat, 18 Nov 2023 13:41:50 +0000 Subject: [PATCH] Updated Rector to commit 03c7ab7a0f3b7a2ba106bef1ccf508d1b9b63850 https://github.com/rectorphp/rector-src/commit/03c7ab7a0f3b7a2ba106bef1ccf508d1b9b63850 [TypeDeclaration] Skip default not array type on StrictArrayParamDimFetchRector (#5259) --- .../Rector/ClassMethod/StrictArrayParamDimFetchRector.php | 4 ++++ src/Application/VersionResolver.php | 4 ++-- 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/rules/TypeDeclaration/Rector/ClassMethod/StrictArrayParamDimFetchRector.php b/rules/TypeDeclaration/Rector/ClassMethod/StrictArrayParamDimFetchRector.php index a28a4181ac2..253d90323b0 100644 --- a/rules/TypeDeclaration/Rector/ClassMethod/StrictArrayParamDimFetchRector.php +++ b/rules/TypeDeclaration/Rector/ClassMethod/StrictArrayParamDimFetchRector.php @@ -4,6 +4,7 @@ declare (strict_types=1); namespace Rector\TypeDeclaration\Rector\ClassMethod; use PhpParser\Node; +use PhpParser\Node\Expr; use PhpParser\Node\Expr\ArrayDimFetch; use PhpParser\Node\Expr\AssignOp\Coalesce as AssignOpCoalesce; use PhpParser\Node\Expr\BinaryOp\Coalesce; @@ -79,6 +80,9 @@ CODE_SAMPLE if ($param->type instanceof Node) { continue; } + if ($param->default instanceof Expr && !$this->getType($param->default)->isArray()->yes()) { + continue; + } if (!$this->isParamAccessedArrayDimFetch($param, $node)) { continue; } diff --git a/src/Application/VersionResolver.php b/src/Application/VersionResolver.php index 897531c9551..7e137890726 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 = '4a3e6982647ce4fdc84b1232557eaeae7e914bde'; + public const PACKAGE_VERSION = '03c7ab7a0f3b7a2ba106bef1ccf508d1b9b63850'; /** * @api * @var string */ - public const RELEASE_DATE = '2023-11-18 09:17:20'; + public const RELEASE_DATE = '2023-11-18 20:39:36'; /** * @var int */