Compare commits

...

3 Commits

Author SHA1 Message Date
Tomas Votruba
584e892a51 Updated Rector to commit 068799f59b289bef06b9c1f384df4301b19e726e
068799f59b [Performance] Early skip func call name on ClassRenamer (#5837)
2024-04-20 20:05:57 +00:00
Tomas Votruba
b9839a24cb Updated Rector to commit 068799f59b289bef06b9c1f384df4301b19e726e
068799f59b [Performance] Early skip func call name on ClassRenamer (#5837)
2024-04-20 19:29:23 +00:00
Tomas Votruba
1e8aeb3de9 Updated Rector to commit 9ce6af83b6996631fe2a13cca64d25142dc9fb15
9ce6af83b6 [Performance] Early skip NativeFunctionReflection on OptionalParametersAfterRequiredRector (#5836)
2024-04-20 19:24:39 +00:00
7 changed files with 23 additions and 10 deletions

View File

@ -13,6 +13,7 @@ use PhpParser\Node\Stmt\Function_;
use PHPStan\Analyser\Scope; use PHPStan\Analyser\Scope;
use PHPStan\Reflection\FunctionReflection; use PHPStan\Reflection\FunctionReflection;
use PHPStan\Reflection\MethodReflection; use PHPStan\Reflection\MethodReflection;
use PHPStan\Reflection\Native\NativeFunctionReflection;
use Rector\CodingStyle\Reflection\VendorLocationDetector; use Rector\CodingStyle\Reflection\VendorLocationDetector;
use Rector\NodeTypeResolver\PHPStan\ParametersAcceptorSelectorVariantsWrapper; use Rector\NodeTypeResolver\PHPStan\ParametersAcceptorSelectorVariantsWrapper;
use Rector\Php80\NodeResolver\ArgumentSorter; use Rector\Php80\NodeResolver\ArgumentSorter;
@ -178,6 +179,9 @@ CODE_SAMPLE
*/ */
private function resolveExpectedArgParamOrderIfDifferent($reflection, $node, Scope $scope) : ?array private function resolveExpectedArgParamOrderIfDifferent($reflection, $node, Scope $scope) : ?array
{ {
if ($reflection instanceof NativeFunctionReflection) {
return null;
}
if ($reflection instanceof MethodReflection && $this->vendorLocationDetector->detectMethodReflection($reflection)) { if ($reflection instanceof MethodReflection && $this->vendorLocationDetector->detectMethodReflection($reflection)) {
return null; return null;
} }

View File

@ -121,13 +121,16 @@ final class ClassRenamer
$classReflection = $this->reflectionProvider->getClass($newName); $classReflection = $this->reflectionProvider->getClass($newName);
return $classReflection->isInterface(); return $classReflection->isInterface();
} }
return $fullyQualified->getAttribute(AttributeKey::IS_FUNCCALL_NAME) === \true; return \false;
} }
/** /**
* @param array<string, string> $oldToNewClasses * @param array<string, string> $oldToNewClasses
*/ */
private function refactorName(FullyQualified $fullyQualified, array $oldToNewClasses) : ?FullyQualified private function refactorName(FullyQualified $fullyQualified, array $oldToNewClasses) : ?FullyQualified
{ {
if ($fullyQualified->getAttribute(AttributeKey::IS_FUNCCALL_NAME) === \true) {
return null;
}
$stringName = $fullyQualified->toString(); $stringName = $fullyQualified->toString();
$newName = $oldToNewClasses[$stringName] ?? null; $newName = $oldToNewClasses[$stringName] ?? null;
if ($newName === null) { if ($newName === null) {

View File

@ -19,12 +19,12 @@ final class VersionResolver
* @api * @api
* @var string * @var string
*/ */
public const PACKAGE_VERSION = '1374e15d742f4f36f0bef45db9f8920a589865b3'; public const PACKAGE_VERSION = '068799f59b289bef06b9c1f384df4301b19e726e';
/** /**
* @api * @api
* @var string * @var string
*/ */
public const RELEASE_DATE = '2024-04-20 17:59:14'; public const RELEASE_DATE = '2024-04-21 02:27:01';
/** /**
* @var int * @var int
*/ */

View File

@ -1866,12 +1866,12 @@
"source": { "source": {
"type": "git", "type": "git",
"url": "https:\/\/github.com\/rectorphp\/rector-symfony.git", "url": "https:\/\/github.com\/rectorphp\/rector-symfony.git",
"reference": "607447eab503bea12913c9ddce690c6055424acd" "reference": "b8126e8bf6e239fd53329fcd715ea117a4b4c34c"
}, },
"dist": { "dist": {
"type": "zip", "type": "zip",
"url": "https:\/\/api.github.com\/repos\/rectorphp\/rector-symfony\/zipball\/607447eab503bea12913c9ddce690c6055424acd", "url": "https:\/\/api.github.com\/repos\/rectorphp\/rector-symfony\/zipball\/b8126e8bf6e239fd53329fcd715ea117a4b4c34c",
"reference": "607447eab503bea12913c9ddce690c6055424acd", "reference": "b8126e8bf6e239fd53329fcd715ea117a4b4c34c",
"shasum": "" "shasum": ""
}, },
"require": { "require": {
@ -1900,7 +1900,7 @@
"tomasvotruba\/class-leak": "^0.2.6", "tomasvotruba\/class-leak": "^0.2.6",
"tracy\/tracy": "^2.10" "tracy\/tracy": "^2.10"
}, },
"time": "2024-04-09T22:40:17+00:00", "time": "2024-04-20T20:01:42+00:00",
"default-branch": true, "default-branch": true,
"type": "rector-extension", "type": "rector-extension",
"extra": { "extra": {

File diff suppressed because one or more lines are too long

View File

@ -9,7 +9,7 @@ namespace Rector\RectorInstaller;
*/ */
final class GeneratedConfig final class GeneratedConfig
{ {
public const EXTENSIONS = array('rector/rector-doctrine' => array('install_path' => '/home/runner/work/rector-src/rector-src/rector-build/vendor/rector/rector-doctrine', 'relative_install_path' => '../../rector-doctrine', 'extra' => NULL, 'version' => 'dev-main b3da143'), 'rector/rector-downgrade-php' => array('install_path' => '/home/runner/work/rector-src/rector-src/rector-build/vendor/rector/rector-downgrade-php', 'relative_install_path' => '../../rector-downgrade-php', 'extra' => NULL, 'version' => 'dev-main 05e44cf'), 'rector/rector-phpunit' => array('install_path' => '/home/runner/work/rector-src/rector-src/rector-build/vendor/rector/rector-phpunit', 'relative_install_path' => '../../rector-phpunit', 'extra' => NULL, 'version' => 'dev-main e8af39b'), 'rector/rector-symfony' => array('install_path' => '/home/runner/work/rector-src/rector-src/rector-build/vendor/rector/rector-symfony', 'relative_install_path' => '../../rector-symfony', 'extra' => NULL, 'version' => 'dev-main 607447e')); public const EXTENSIONS = array('rector/rector-doctrine' => array('install_path' => '/home/runner/work/rector-src/rector-src/rector-build/vendor/rector/rector-doctrine', 'relative_install_path' => '../../rector-doctrine', 'extra' => NULL, 'version' => 'dev-main b3da143'), 'rector/rector-downgrade-php' => array('install_path' => '/home/runner/work/rector-src/rector-src/rector-build/vendor/rector/rector-downgrade-php', 'relative_install_path' => '../../rector-downgrade-php', 'extra' => NULL, 'version' => 'dev-main 05e44cf'), 'rector/rector-phpunit' => array('install_path' => '/home/runner/work/rector-src/rector-src/rector-build/vendor/rector/rector-phpunit', 'relative_install_path' => '../../rector-phpunit', 'extra' => NULL, 'version' => 'dev-main e8af39b'), 'rector/rector-symfony' => array('install_path' => '/home/runner/work/rector-src/rector-src/rector-build/vendor/rector/rector-symfony', 'relative_install_path' => '../../rector-symfony', 'extra' => NULL, 'version' => 'dev-main b8126e8'));
private function __construct() private function __construct()
{ {
} }

View File

@ -137,12 +137,15 @@ CODE_SAMPLE
} }
$configVariable = $this->createConfigVariable($configClass); $configVariable = $this->createConfigVariable($configClass);
$stmts = $this->createMethodCallStmts($extensionKeyAndConfiguration->getArray(), $configVariable); $stmts = $this->createMethodCallStmts($extensionKeyAndConfiguration->getArray(), $configVariable);
if ($stmts === null) {
return null;
}
return $this->symfonyClosureFactory->create($configClass, $node, $stmts); return $this->symfonyClosureFactory->create($configClass, $node, $stmts);
} }
/** /**
* @return array<Expression<MethodCall>> * @return array<Expression<MethodCall>>
*/ */
private function createMethodCallStmts(Array_ $configurationArray, Variable $configVariable) : array private function createMethodCallStmts(Array_ $configurationArray, Variable $configVariable) : ?array
{ {
$methodCallStmts = []; $methodCallStmts = [];
$configurationValues = $this->valueResolver->getValue($configurationArray); $configurationValues = $this->valueResolver->getValue($configurationArray);
@ -180,6 +183,9 @@ CODE_SAMPLE
} else { } else {
$currentConfigCaller = $configVariable; $currentConfigCaller = $configVariable;
} }
if (!\is_array($value)) {
return null;
}
foreach ($value as $itemName => $itemConfiguration) { foreach ($value as $itemName => $itemConfiguration) {
if ($nested && \is_array($itemConfiguration)) { if ($nested && \is_array($itemConfiguration)) {
$methodCallName = $itemName; $methodCallName = $itemName;