Skip to content

Commit

Permalink
Updated Rector to commit cec3a1183d0a82e38dfdb06ecfa9b9b5d97125de
Browse files Browse the repository at this point in the history
rectorphp/rector-src@cec3a11 [Php73] Skip prev() call on items after key called on ArrayKeyFirstLastRector (#3293)
  • Loading branch information
TomasVotruba committed Jan 17, 2023
1 parent 78a094b commit c67791b
Show file tree
Hide file tree
Showing 9 changed files with 51 additions and 33 deletions.
18 changes: 18 additions & 0 deletions rules/Php73/Rector/FuncCall/ArrayKeyFirstLastRector.php
Original file line number Diff line number Diff line change
Expand Up @@ -95,6 +95,9 @@ public function refactor(Node $node) : ?Node
if (!$keyFuncCall instanceof FuncCall) {
return null;
}
if ($this->hasPrevCallNext($keyFuncCall)) {
return null;
}
$newName = self::PREVIOUS_TO_NEW_FUNCTIONS[$this->getName($node)];
$keyFuncCall->name = new Name($newName);
$this->removeNode($node);
Expand All @@ -104,6 +107,21 @@ public function provideMinPhpVersion() : int
{
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
{
if (!$this->isNames($funcCall, ['reset', 'end'])) {
Expand Down
4 changes: 2 additions & 2 deletions src/Application/VersionResolver.php
Original file line number Diff line number Diff line change
Expand Up @@ -19,12 +19,12 @@ final class VersionResolver
* @api
* @var string
*/
public const PACKAGE_VERSION = 'fc77aa08f716935ceb22db7ec32f4a45fabf6cf1';
public const PACKAGE_VERSION = 'cec3a1183d0a82e38dfdb06ecfa9b9b5d97125de';
/**
* @api
* @var string
*/
public const RELEASE_DATE = '2023-01-17 04:19:11';
public const RELEASE_DATE = '2023-01-17 15:03:18';
/**
* @var int
*/
Expand Down
2 changes: 1 addition & 1 deletion vendor/autoload.php
Original file line number Diff line number Diff line change
Expand Up @@ -22,4 +22,4 @@

require_once __DIR__ . '/composer/autoload_real.php';

return ComposerAutoloaderInit80cffdabf6aa441f3cff0b5ada8c9697::getLoader();
return ComposerAutoloaderInit457c26c5e7dd8ff321817c1d2df5fb7f::getLoader();
10 changes: 5 additions & 5 deletions vendor/composer/autoload_real.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

// autoload_real.php @generated by Composer

class ComposerAutoloaderInit80cffdabf6aa441f3cff0b5ada8c9697
class ComposerAutoloaderInit457c26c5e7dd8ff321817c1d2df5fb7f
{
private static $loader;

Expand All @@ -22,17 +22,17 @@ public static function getLoader()
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__));
spl_autoload_unregister(array('ComposerAutoloaderInit80cffdabf6aa441f3cff0b5ada8c9697', 'loadClassLoader'));
spl_autoload_unregister(array('ComposerAutoloaderInit457c26c5e7dd8ff321817c1d2df5fb7f', 'loadClassLoader'));

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->register(true);

$filesToLoad = \Composer\Autoload\ComposerStaticInit80cffdabf6aa441f3cff0b5ada8c9697::$files;
$filesToLoad = \Composer\Autoload\ComposerStaticInit457c26c5e7dd8ff321817c1d2df5fb7f::$files;
$requireFile = static function ($fileIdentifier, $file) {
if (empty($GLOBALS['__composer_autoload_files'][$fileIdentifier])) {
$GLOBALS['__composer_autoload_files'][$fileIdentifier] = true;
Expand Down
8 changes: 4 additions & 4 deletions vendor/composer/autoload_static.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@

namespace Composer\Autoload;

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

}, null, ClassLoader::class);
}
Expand Down
14 changes: 7 additions & 7 deletions vendor/composer/installed.json
Original file line number Diff line number Diff line change
Expand Up @@ -797,17 +797,17 @@
},
{
"name": "phpstan\/phpstan",
"version": "1.9.11",
"version_normalized": "1.9.11.0",
"version": "1.9.12",
"version_normalized": "1.9.12.0",
"source": {
"type": "git",
"url": "https:\/\/github.com\/phpstan\/phpstan.git",
"reference": "60f3d68481eef216199eae7a2603cd5fe124d464"
"reference": "44a338ff0d5572c13fd77dfd91addb96e48c29f8"
},
"dist": {
"type": "zip",
"url": "https:\/\/api.github.com\/repos\/phpstan\/phpstan\/zipball\/60f3d68481eef216199eae7a2603cd5fe124d464",
"reference": "60f3d68481eef216199eae7a2603cd5fe124d464",
"url": "https:\/\/api.github.com\/repos\/phpstan\/phpstan\/zipball\/44a338ff0d5572c13fd77dfd91addb96e48c29f8",
"reference": "44a338ff0d5572c13fd77dfd91addb96e48c29f8",
"shasum": ""
},
"require": {
Expand All @@ -816,7 +816,7 @@
"conflict": {
"phpstan\/phpstan-shim": "*"
},
"time": "2023-01-12T14:04:13+00:00",
"time": "2023-01-17T10:44:04+00:00",
"bin": [
"phpstan",
"phpstan.phar"
Expand All @@ -839,7 +839,7 @@
],
"support": {
"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": [
{
Expand Down
Loading

0 comments on commit c67791b

Please sign in to comment.