Updated Rector to commit cec3a1183d0a82e38dfdb06ecfa9b9b5d97125de

cec3a1183d [Php73] Skip prev() call on items after key called on ArrayKeyFirstLastRector (#3293)
This commit is contained in:
Tomas Votruba 2023-01-17 15:07:40 +00:00
parent 78a094be89
commit c67791b001
9 changed files with 51 additions and 33 deletions

View File

@ -95,6 +95,9 @@ CODE_SAMPLE
if (!$keyFuncCall instanceof FuncCall) { if (!$keyFuncCall instanceof FuncCall) {
return null; return null;
} }
if ($this->hasPrevCallNext($keyFuncCall)) {
return null;
}
$newName = self::PREVIOUS_TO_NEW_FUNCTIONS[$this->getName($node)]; $newName = self::PREVIOUS_TO_NEW_FUNCTIONS[$this->getName($node)];
$keyFuncCall->name = new Name($newName); $keyFuncCall->name = new Name($newName);
$this->removeNode($node); $this->removeNode($node);
@ -104,6 +107,21 @@ CODE_SAMPLE
{ {
return PhpVersionFeature::ARRAY_KEY_FIRST_LAST; return PhpVersionFeature::ARRAY_KEY_FIRST_LAST;
} }
private function hasPrevCallNext(FuncCall $funcCall) : bool
{
return (bool) $this->betterNodeFinder->findFirstNext($funcCall, function (Node $subNode) use($funcCall) : bool {
if (!$subNode instanceof FuncCall) {
return \false;
}
if (!$this->isName($subNode, 'prev')) {
return \false;
}
if ($subNode->isFirstClassCallable()) {
return \true;
}
return $this->nodeComparator->areNodesEqual($subNode->args[0]->value, $funcCall->args[0]->value);
});
}
private function shouldSkip(FuncCall $funcCall) : bool private function shouldSkip(FuncCall $funcCall) : bool
{ {
if (!$this->isNames($funcCall, ['reset', 'end'])) { if (!$this->isNames($funcCall, ['reset', 'end'])) {

View File

@ -19,12 +19,12 @@ final class VersionResolver
* @api * @api
* @var string * @var string
*/ */
public const PACKAGE_VERSION = 'fc77aa08f716935ceb22db7ec32f4a45fabf6cf1'; public const PACKAGE_VERSION = 'cec3a1183d0a82e38dfdb06ecfa9b9b5d97125de';
/** /**
* @api * @api
* @var string * @var string
*/ */
public const RELEASE_DATE = '2023-01-17 04:19:11'; public const RELEASE_DATE = '2023-01-17 15:03:18';
/** /**
* @var int * @var int
*/ */

2
vendor/autoload.php vendored
View File

@ -22,4 +22,4 @@ if (PHP_VERSION_ID < 50600) {
require_once __DIR__ . '/composer/autoload_real.php'; require_once __DIR__ . '/composer/autoload_real.php';
return ComposerAutoloaderInit80cffdabf6aa441f3cff0b5ada8c9697::getLoader(); return ComposerAutoloaderInit457c26c5e7dd8ff321817c1d2df5fb7f::getLoader();

View File

@ -2,7 +2,7 @@
// autoload_real.php @generated by Composer // autoload_real.php @generated by Composer
class ComposerAutoloaderInit80cffdabf6aa441f3cff0b5ada8c9697 class ComposerAutoloaderInit457c26c5e7dd8ff321817c1d2df5fb7f
{ {
private static $loader; private static $loader;
@ -22,17 +22,17 @@ class ComposerAutoloaderInit80cffdabf6aa441f3cff0b5ada8c9697
return self::$loader; return self::$loader;
} }
spl_autoload_register(array('ComposerAutoloaderInit80cffdabf6aa441f3cff0b5ada8c9697', 'loadClassLoader'), true, true); spl_autoload_register(array('ComposerAutoloaderInit457c26c5e7dd8ff321817c1d2df5fb7f', 'loadClassLoader'), true, true);
self::$loader = $loader = new \Composer\Autoload\ClassLoader(\dirname(__DIR__)); self::$loader = $loader = new \Composer\Autoload\ClassLoader(\dirname(__DIR__));
spl_autoload_unregister(array('ComposerAutoloaderInit80cffdabf6aa441f3cff0b5ada8c9697', 'loadClassLoader')); spl_autoload_unregister(array('ComposerAutoloaderInit457c26c5e7dd8ff321817c1d2df5fb7f', 'loadClassLoader'));
require __DIR__ . '/autoload_static.php'; require __DIR__ . '/autoload_static.php';
call_user_func(\Composer\Autoload\ComposerStaticInit80cffdabf6aa441f3cff0b5ada8c9697::getInitializer($loader)); call_user_func(\Composer\Autoload\ComposerStaticInit457c26c5e7dd8ff321817c1d2df5fb7f::getInitializer($loader));
$loader->setClassMapAuthoritative(true); $loader->setClassMapAuthoritative(true);
$loader->register(true); $loader->register(true);
$filesToLoad = \Composer\Autoload\ComposerStaticInit80cffdabf6aa441f3cff0b5ada8c9697::$files; $filesToLoad = \Composer\Autoload\ComposerStaticInit457c26c5e7dd8ff321817c1d2df5fb7f::$files;
$requireFile = static function ($fileIdentifier, $file) { $requireFile = static function ($fileIdentifier, $file) {
if (empty($GLOBALS['__composer_autoload_files'][$fileIdentifier])) { if (empty($GLOBALS['__composer_autoload_files'][$fileIdentifier])) {
$GLOBALS['__composer_autoload_files'][$fileIdentifier] = true; $GLOBALS['__composer_autoload_files'][$fileIdentifier] = true;

View File

@ -4,7 +4,7 @@
namespace Composer\Autoload; namespace Composer\Autoload;
class ComposerStaticInit80cffdabf6aa441f3cff0b5ada8c9697 class ComposerStaticInit457c26c5e7dd8ff321817c1d2df5fb7f
{ {
public static $files = array ( public static $files = array (
'ad155f8f1cf0d418fe49e248db8c661b' => __DIR__ . '/..' . '/react/promise/src/functions_include.php', 'ad155f8f1cf0d418fe49e248db8c661b' => __DIR__ . '/..' . '/react/promise/src/functions_include.php',
@ -3067,9 +3067,9 @@ class ComposerStaticInit80cffdabf6aa441f3cff0b5ada8c9697
public static function getInitializer(ClassLoader $loader) public static function getInitializer(ClassLoader $loader)
{ {
return \Closure::bind(function () use ($loader) { return \Closure::bind(function () use ($loader) {
$loader->prefixLengthsPsr4 = ComposerStaticInit80cffdabf6aa441f3cff0b5ada8c9697::$prefixLengthsPsr4; $loader->prefixLengthsPsr4 = ComposerStaticInit457c26c5e7dd8ff321817c1d2df5fb7f::$prefixLengthsPsr4;
$loader->prefixDirsPsr4 = ComposerStaticInit80cffdabf6aa441f3cff0b5ada8c9697::$prefixDirsPsr4; $loader->prefixDirsPsr4 = ComposerStaticInit457c26c5e7dd8ff321817c1d2df5fb7f::$prefixDirsPsr4;
$loader->classMap = ComposerStaticInit80cffdabf6aa441f3cff0b5ada8c9697::$classMap; $loader->classMap = ComposerStaticInit457c26c5e7dd8ff321817c1d2df5fb7f::$classMap;
}, null, ClassLoader::class); }, null, ClassLoader::class);
} }

View File

@ -797,17 +797,17 @@
}, },
{ {
"name": "phpstan\/phpstan", "name": "phpstan\/phpstan",
"version": "1.9.11", "version": "1.9.12",
"version_normalized": "1.9.11.0", "version_normalized": "1.9.12.0",
"source": { "source": {
"type": "git", "type": "git",
"url": "https:\/\/github.com\/phpstan\/phpstan.git", "url": "https:\/\/github.com\/phpstan\/phpstan.git",
"reference": "60f3d68481eef216199eae7a2603cd5fe124d464" "reference": "44a338ff0d5572c13fd77dfd91addb96e48c29f8"
}, },
"dist": { "dist": {
"type": "zip", "type": "zip",
"url": "https:\/\/api.github.com\/repos\/phpstan\/phpstan\/zipball\/60f3d68481eef216199eae7a2603cd5fe124d464", "url": "https:\/\/api.github.com\/repos\/phpstan\/phpstan\/zipball\/44a338ff0d5572c13fd77dfd91addb96e48c29f8",
"reference": "60f3d68481eef216199eae7a2603cd5fe124d464", "reference": "44a338ff0d5572c13fd77dfd91addb96e48c29f8",
"shasum": "" "shasum": ""
}, },
"require": { "require": {
@ -816,7 +816,7 @@
"conflict": { "conflict": {
"phpstan\/phpstan-shim": "*" "phpstan\/phpstan-shim": "*"
}, },
"time": "2023-01-12T14:04:13+00:00", "time": "2023-01-17T10:44:04+00:00",
"bin": [ "bin": [
"phpstan", "phpstan",
"phpstan.phar" "phpstan.phar"
@ -839,7 +839,7 @@
], ],
"support": { "support": {
"issues": "https:\/\/github.com\/phpstan\/phpstan\/issues", "issues": "https:\/\/github.com\/phpstan\/phpstan\/issues",
"source": "https:\/\/github.com\/phpstan\/phpstan\/tree\/1.9.11" "source": "https:\/\/github.com\/phpstan\/phpstan\/tree\/1.9.12"
}, },
"funding": [ "funding": [
{ {

File diff suppressed because one or more lines are too long

Binary file not shown.

View File

@ -1,16 +1,16 @@
-----BEGIN PGP SIGNATURE----- -----BEGIN PGP SIGNATURE-----
iQIzBAABCgAdFiEE0yaA1ZV9xxFr4pwUzxoQjQ565yAFAmPAE0cACgkQzxoQjQ56 iQIzBAABCgAdFiEE0yaA1ZV9xxFr4pwUzxoQjQ565yAFAmPGe94ACgkQzxoQjQ56
5yDo2g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