From c6f40053b8d7b5002740572716efdf59db4c788c Mon Sep 17 00:00:00 2001 From: Tomas Votruba Date: Sun, 22 Oct 2023 10:12:20 +0000 Subject: [PATCH] Updated Rector to commit a0d324465a4cbccb9236bc69f41069da89d01baf https://github.com/rectorphp/rector-src/commit/a0d324465a4cbccb9236bc69f41069da89d01baf [Php74][Php81] Allow mixed key on ArraySpreadInsteadOfArrayMergeRector on php 8.1 version feature enabled (#5190) --- .../FuncCall/ArraySpreadInsteadOfArrayMergeRector.php | 9 +++++---- src/Application/VersionResolver.php | 4 ++-- 2 files changed, 7 insertions(+), 6 deletions(-) diff --git a/rules/Php74/Rector/FuncCall/ArraySpreadInsteadOfArrayMergeRector.php b/rules/Php74/Rector/FuncCall/ArraySpreadInsteadOfArrayMergeRector.php index f39dee4f6767..1b3cd8a4dce8 100644 --- a/rules/Php74/Rector/FuncCall/ArraySpreadInsteadOfArrayMergeRector.php +++ b/rules/Php74/Rector/FuncCall/ArraySpreadInsteadOfArrayMergeRector.php @@ -96,6 +96,9 @@ public function provideMinPhpVersion() : int } private function refactorArray(FuncCall $funcCall) : ?Array_ { + if ($funcCall->isFirstClassCallable()) { + return null; + } $array = new Array_(); foreach ($funcCall->args as $arg) { if (!$arg instanceof Arg) { @@ -135,10 +138,8 @@ private function isArrayKeyTypeAllowed(ArrayType $arrayType) : bool if ($arrayType->getKeyType()->isInteger()->yes()) { return \true; } - if (!$this->phpVersionProvider->isAtLeastPhpVersion(PhpVersionFeature::ARRAY_SPREAD_STRING_KEYS)) { - return \false; - } - return $arrayType->getKeyType()->isString()->yes(); + // php 8.1+ allow mixed key: int, string, and null + return $this->phpVersionProvider->isAtLeastPhpVersion(PhpVersionFeature::ARRAY_SPREAD_STRING_KEYS); } private function resolveValue(Expr $expr) : Expr { diff --git a/src/Application/VersionResolver.php b/src/Application/VersionResolver.php index 761af7779df8..c7491c712efd 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 = '5ac3cb377abf968396c23573d8562e6ab6967f2a'; + public const PACKAGE_VERSION = 'a0d324465a4cbccb9236bc69f41069da89d01baf'; /** * @api * @var string */ - public const RELEASE_DATE = '2023-10-19 20:44:46'; + public const RELEASE_DATE = '2023-10-22 12:09:33'; /** * @var int */