Skip to content

Commit

Permalink
Updated Rector to commit 227186b39430fee40e5c6ba5ff7261700c9d5031
Browse files Browse the repository at this point in the history
rectorphp/rector-src@227186b [Performance] Reduce parent lookup on PropertyFetchAnalyzer (#4034)
  • Loading branch information
TomasVotruba committed May 31, 2023
1 parent c8207cf commit c0ad822
Show file tree
Hide file tree
Showing 9 changed files with 31 additions and 32 deletions.
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 = '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
*/
Expand Down
17 changes: 8 additions & 9 deletions src/NodeAnalyzer/PropertyFetchAnalyzer.php
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,10 @@
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;
Expand Down Expand Up @@ -98,18 +100,15 @@ public function isLocalPropertyFetchName(Node $node, string $desiredPropertyName
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;
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 ComposerAutoloaderInit466df9ae5fdd4f32b9bfd4ec384bf238::getLoader();
return ComposerAutoloaderInit240e2a823014eaffbeecb0be6de24226::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 ComposerAutoloaderInit466df9ae5fdd4f32b9bfd4ec384bf238
class ComposerAutoloaderInit240e2a823014eaffbeecb0be6de24226
{
private static $loader;

Expand All @@ -22,17 +22,17 @@ public static function getLoader()
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;
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 ComposerStaticInit466df9ae5fdd4f32b9bfd4ec384bf238
class ComposerStaticInit240e2a823014eaffbeecb0be6de24226
{
public static $files = array (
'ad155f8f1cf0d418fe49e248db8c661b' => __DIR__ . '/..' . '/react/promise/src/functions_include.php',
Expand Down Expand Up @@ -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);
}
Expand Down
8 changes: 4 additions & 4 deletions vendor/composer/installed.json
Original file line number Diff line number Diff line change
Expand Up @@ -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": {
Expand All @@ -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": {
Expand Down
Loading

0 comments on commit c0ad822

Please sign in to comment.