Updated Rector to commit 227186b39430fee40e5c6ba5ff7261700c9d5031

227186b394 [Performance] Reduce parent lookup on PropertyFetchAnalyzer (#4034)
This commit is contained in:
Tomas Votruba 2023-05-31 13:04:27 +00:00
parent c8207cff85
commit c0ad822683
9 changed files with 31 additions and 32 deletions

View File

@ -19,12 +19,12 @@ final class VersionResolver
* @api
* @var string
*/
public const PACKAGE_VERSION = 'b84fe9524aa20e200f743f13f6925d93225c6280';
public const PACKAGE_VERSION = '227186b39430fee40e5c6ba5ff7261700c9d5031';
/**
* @api
* @var string
*/
public const RELEASE_DATE = '2023-05-30 21:51:20';
public const RELEASE_DATE = '2023-05-31 13:00:19';
/**
* @var int
*/

View File

@ -16,8 +16,10 @@ use PhpParser\Node\Stmt\Class_;
use PhpParser\Node\Stmt\ClassLike;
use PhpParser\Node\Stmt\ClassMethod;
use PhpParser\Node\Stmt\Expression;
use PhpParser\Node\Stmt\Function_;
use PhpParser\Node\Stmt\Property;
use PhpParser\Node\Stmt\Trait_;
use PhpParser\NodeTraverser;
use PHPStan\Type\ObjectType;
use PHPStan\Type\ThisType;
use Rector\Core\Enum\ObjectReference;
@ -98,18 +100,15 @@ final class PropertyFetchAnalyzer
public function countLocalPropertyFetchName(Class_ $class, string $propertyName) : int
{
$total = 0;
$this->simpleCallableNodeTraverser->traverseNodesWithCallable($class->stmts, function (Node $subNode) use($class, $propertyName, &$total) : ?Node {
$this->simpleCallableNodeTraverser->traverseNodesWithCallable($class->getMethods(), function (Node $subNode) use($propertyName, &$total) {
// skip anonymous classes and inner function
if ($subNode instanceof Class_ || $subNode instanceof Function_) {
return NodeTraverser::DONT_TRAVERSE_CURRENT_AND_CHILDREN;
}
if (!$this->isLocalPropertyFetchName($subNode, $propertyName)) {
return null;
}
$parentClassLike = $this->betterNodeFinder->findParentType($subNode, ClassLike::class);
// property fetch in Trait cannot get parent ClassLike
if (!$parentClassLike instanceof ClassLike) {
++$total;
}
if ($parentClassLike === $class) {
++$total;
}
++$total;
return $subNode;
});
return $total;

2
vendor/autoload.php vendored
View File

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

View File

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

View File

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

View File

@ -1920,12 +1920,12 @@
"source": {
"type": "git",
"url": "https:\/\/github.com\/rectorphp\/rector-downgrade-php.git",
"reference": "58a1e247eb3266209cc7e5c3e1f614344a9679e3"
"reference": "c4e9d8b9ce6faca93a71126d0c2a7a55e6f5f7a3"
},
"dist": {
"type": "zip",
"url": "https:\/\/api.github.com\/repos\/rectorphp\/rector-downgrade-php\/zipball\/58a1e247eb3266209cc7e5c3e1f614344a9679e3",
"reference": "58a1e247eb3266209cc7e5c3e1f614344a9679e3",
"url": "https:\/\/api.github.com\/repos\/rectorphp\/rector-downgrade-php\/zipball\/c4e9d8b9ce6faca93a71126d0c2a7a55e6f5f7a3",
"reference": "c4e9d8b9ce6faca93a71126d0c2a7a55e6f5f7a3",
"shasum": ""
},
"require": {
@ -1949,7 +1949,7 @@
"tomasvotruba\/type-coverage": "^0.2",
"tomasvotruba\/unused-public": "^0.1"
},
"time": "2023-05-31T08:29:44+00:00",
"time": "2023-05-31T11:46:31+00:00",
"default-branch": true,
"type": "rector-extension",
"extra": {

File diff suppressed because one or more lines are too long

View File

@ -9,7 +9,7 @@ namespace Rector\RectorInstaller;
*/
final class GeneratedConfig
{
public const EXTENSIONS = array('rector/rector-doctrine' => array('install_path' => '/home/runner/work/rector-src/rector-src/vendor/rector/rector-doctrine', 'relative_install_path' => '../../rector-doctrine', 'extra' => array('includes' => array(0 => 'config/config.php')), 'version' => 'dev-main 7f0656f'), 'rector/rector-downgrade-php' => array('install_path' => '/home/runner/work/rector-src/rector-src/vendor/rector/rector-downgrade-php', 'relative_install_path' => '../../rector-downgrade-php', 'extra' => array('includes' => array(0 => 'config/config.php')), 'version' => 'dev-main 58a1e24'), 'rector/rector-phpunit' => array('install_path' => '/home/runner/work/rector-src/rector-src/vendor/rector/rector-phpunit', 'relative_install_path' => '../../rector-phpunit', 'extra' => array('includes' => array(0 => 'config/config.php')), 'version' => 'dev-main e276dee'), 'rector/rector-symfony' => array('install_path' => '/home/runner/work/rector-src/rector-src/vendor/rector/rector-symfony', 'relative_install_path' => '../../rector-symfony', 'extra' => array('includes' => array(0 => 'config/config.php')), 'version' => 'dev-main 2348d4f'));
public const EXTENSIONS = array('rector/rector-doctrine' => array('install_path' => '/home/runner/work/rector-src/rector-src/vendor/rector/rector-doctrine', 'relative_install_path' => '../../rector-doctrine', 'extra' => array('includes' => array(0 => 'config/config.php')), 'version' => 'dev-main 7f0656f'), 'rector/rector-downgrade-php' => array('install_path' => '/home/runner/work/rector-src/rector-src/vendor/rector/rector-downgrade-php', 'relative_install_path' => '../../rector-downgrade-php', 'extra' => array('includes' => array(0 => 'config/config.php')), 'version' => 'dev-main c4e9d8b'), 'rector/rector-phpunit' => array('install_path' => '/home/runner/work/rector-src/rector-src/vendor/rector/rector-phpunit', 'relative_install_path' => '../../rector-phpunit', 'extra' => array('includes' => array(0 => 'config/config.php')), 'version' => 'dev-main e276dee'), 'rector/rector-symfony' => array('install_path' => '/home/runner/work/rector-src/rector-src/vendor/rector/rector-symfony', 'relative_install_path' => '../../rector-symfony', 'extra' => array('includes' => array(0 => 'config/config.php')), 'version' => 'dev-main 2348d4f'));
private function __construct()
{
}

View File

@ -41,18 +41,18 @@ vendor/bin/rector
It's simple in the nature. Read these *how-to* posts to get the idea:
* [How all Frameworks can Bump to PHP 8.1 and You can Keep Using Older PHP](https://getrector.org/blog/how-all-frameworks-can-bump-to-php-81-and-you-can-use-older-php)
* [How all Frameworks can Bump to PHP 8.1 and You can Keep Using Older PHP](https://getrector.com/blog/how-all-frameworks-can-bump-to-php-81-and-you-can-use-older-php)
* [Introducing ECS Prefixed and Downgraded to PHP 7.1](https://tomasvotruba.com/blog/introducing-ecs-prefixed-and-downgraded-to-php-71/)
* [How to bump Minimal PHP Version without Leaving Anyone Behind?](https://getrector.org/blog/how-to-bump-minimal-version-without-leaving-anyone-behind)
* [Rector 0.10 Released - with PHP 7.1 Support](https://getrector.org/blog/2021/03/22/rector-010-released-with-php71-support)
* [How to bump Minimal PHP Version without Leaving Anyone Behind?](https://getrector.com/blog/how-to-bump-minimal-version-without-leaving-anyone-behind)
* [Rector 0.10 Released - with PHP 7.1 Support](https://getrector.com/blog/rector-010-released-with-php71-support)
<br>
## Learn Rector Faster
Rector is a tool that [we develop](https://getrector.org/) and share for free, so anyone can save hundreds of hours on refactoring. But not everyone has time to understand Rector and AST complexity. You have 2 ways to speed this process up:
Rector is a tool that [we develop](https://getrector.com/) and share for free, so anyone can save hundreds of hours on refactoring. But not everyone has time to understand Rector and AST complexity. You have 2 ways to speed this process up:
* read a book - <a href="https://leanpub.com/rector-the-power-of-automated-refactoring">The Power of Automated Refactoring</a>
* hire our experienced team to <a href="https://getrector.org/contact">improve your code base</a>
* hire our experienced team to <a href="https://getrector.com/contact">improve your code base</a>
Both ways support us to and improve Rector in sustainable way by learning from practical projects.