mirror of https://github.com/rectorphp/rector.git
Updated Rector to commit 5b990ff50f851726e5d3a28590572c8e3f99bb04
5b990ff50f
Bump symplify/phpstan-rules deps (#3894)
This commit is contained in:
parent
4d2dd37572
commit
6f986503de
|
@ -8,6 +8,7 @@ use PhpParser\Node;
|
|||
use PhpParser\Node\Expr;
|
||||
use PhpParser\Node\Expr\ArrowFunction;
|
||||
use PhpParser\Node\Expr\Closure;
|
||||
use PhpParser\Node\Expr\Error;
|
||||
use PhpParser\Node\Expr\Variable;
|
||||
use PhpParser\Node\Param;
|
||||
use PhpParser\Node\Stmt\ClassMethod;
|
||||
|
@ -125,6 +126,9 @@ final class BreakingVariableRenameGuard
|
|||
if ($this->overridenExistingNamesResolver->hasNameInFunctionLikeForParam($expectedName, $classMethod)) {
|
||||
return \true;
|
||||
}
|
||||
if ($param->var instanceof Error) {
|
||||
return \true;
|
||||
}
|
||||
if ($this->isVariableAlreadyDefined($param->var, $currentName)) {
|
||||
return \true;
|
||||
}
|
||||
|
|
|
@ -3,6 +3,8 @@
|
|||
declare (strict_types=1);
|
||||
namespace Rector\Naming\PropertyRenamer;
|
||||
|
||||
use PhpParser\Node\Expr\Error;
|
||||
use PhpParser\Node\Expr\Variable;
|
||||
use PhpParser\Node\Param;
|
||||
use PhpParser\Node\Stmt\Class_;
|
||||
use PhpParser\Node\Stmt\ClassLike;
|
||||
|
@ -111,13 +113,16 @@ final class PropertyPromotionRenamer
|
|||
}
|
||||
private function renameParamVarNameAndVariableUsage(ClassLike $classLike, ClassMethod $classMethod, string $desiredPropertyName, Param $param) : void
|
||||
{
|
||||
if ($param->var instanceof Error) {
|
||||
return;
|
||||
}
|
||||
$classMethodPhpDocInfo = $this->phpDocInfoFactory->createFromNodeOrEmpty($classMethod);
|
||||
$currentParamName = $this->nodeNameResolver->getName($param);
|
||||
$this->propertyFetchRenamer->renamePropertyFetchesInClass($classLike, $currentParamName, $desiredPropertyName);
|
||||
/** @var string $paramVarName */
|
||||
$paramVarName = $param->var->name;
|
||||
$this->renameParamDoc($classMethodPhpDocInfo, $param, $paramVarName, $desiredPropertyName);
|
||||
$param->var->name = $desiredPropertyName;
|
||||
$param->var = new Variable($desiredPropertyName);
|
||||
$this->variableRenamer->renameVariableInFunctionLike($classMethod, $paramVarName, $desiredPropertyName);
|
||||
}
|
||||
private function renameParamDoc(PhpDocInfo $phpDocInfo, Param $param, string $paramVarName, string $desiredPropertyName) : void
|
||||
|
|
|
@ -5,6 +5,7 @@ namespace Rector\Naming\ValueObjectFactory;
|
|||
|
||||
use PhpParser\Node\Expr\ArrowFunction;
|
||||
use PhpParser\Node\Expr\Closure;
|
||||
use PhpParser\Node\Expr\Error;
|
||||
use PhpParser\Node\FunctionLike;
|
||||
use PhpParser\Node\Param;
|
||||
use PhpParser\Node\Stmt\ClassMethod;
|
||||
|
@ -32,6 +33,9 @@ final class ParamRenameFactory
|
|||
}
|
||||
public function createFromResolvedExpectedName(Param $param, string $expectedName) : ?ParamRename
|
||||
{
|
||||
if ($param->var instanceof Error) {
|
||||
return null;
|
||||
}
|
||||
/** @var ClassMethod|Function_|Closure|ArrowFunction|null $functionLike */
|
||||
$functionLike = $this->betterNodeFinder->findParentType($param, FunctionLike::class);
|
||||
if ($functionLike === null) {
|
||||
|
|
|
@ -63,6 +63,9 @@ final class ClosureNestedUsesDecorator
|
|||
private function collectUsesEqual(Closure $closure, array $uses, Variable $useVariable) : array
|
||||
{
|
||||
foreach ($closure->params as $param) {
|
||||
if (!$param->var instanceof Variable) {
|
||||
continue;
|
||||
}
|
||||
if ($this->nodeComparator->areNodesEqual($param->var, $useVariable)) {
|
||||
$uses[] = new ClosureUse($param->var);
|
||||
}
|
||||
|
|
|
@ -5,6 +5,7 @@ namespace Rector\Php80\Rector\Class_;
|
|||
|
||||
use PhpParser\Node;
|
||||
use PhpParser\Node\Expr;
|
||||
use PhpParser\Node\Expr\Variable;
|
||||
use PhpParser\Node\Identifier;
|
||||
use PhpParser\Node\NullableType;
|
||||
use PhpParser\Node\Param;
|
||||
|
@ -166,7 +167,8 @@ CODE_SAMPLE
|
|||
$paramTagValueNode->setAttribute(PhpDocAttributeKey::ORIG_NODE, null);
|
||||
}
|
||||
// property name has higher priority
|
||||
$param->var->name = $this->getName($property);
|
||||
$paramName = $this->getName($property);
|
||||
$param->var = new Variable($paramName);
|
||||
$param->flags = $property->flags;
|
||||
// Copy over attributes of the "old" property
|
||||
$param->attrGroups = \array_merge($param->attrGroups, $property->attrGroups);
|
||||
|
|
|
@ -19,12 +19,12 @@ final class VersionResolver
|
|||
* @api
|
||||
* @var string
|
||||
*/
|
||||
public const PACKAGE_VERSION = 'e6d869b35e2e5785d8691408b490fa6283abb784';
|
||||
public const PACKAGE_VERSION = '5b990ff50f851726e5d3a28590572c8e3f99bb04';
|
||||
/**
|
||||
* @api
|
||||
* @var string
|
||||
*/
|
||||
public const RELEASE_DATE = '2023-05-19 12:19:41';
|
||||
public const RELEASE_DATE = '2023-05-19 14:26:35';
|
||||
/**
|
||||
* @var int
|
||||
*/
|
||||
|
|
|
@ -3,10 +3,10 @@
|
|||
declare (strict_types=1);
|
||||
namespace Rector\Core\Kernel;
|
||||
|
||||
use Throwable;
|
||||
use UnitEnum;
|
||||
use Rector\Core\Exception\Cache\StaleContainerCacheException;
|
||||
use RectorPrefix202305\Symfony\Component\DependencyInjection\ContainerInterface;
|
||||
use Throwable;
|
||||
use UnitEnum;
|
||||
final class CacheInvalidatingContainer implements ContainerInterface
|
||||
{
|
||||
/**
|
||||
|
|
|
@ -8,6 +8,7 @@ use PhpParser\Node\Expr\Assign;
|
|||
use PhpParser\Node\Expr\CallLike;
|
||||
use PhpParser\Node\Expr\Closure;
|
||||
use PhpParser\Node\Expr\ConstFetch;
|
||||
use PhpParser\Node\Expr\Error;
|
||||
use PhpParser\Node\Expr\FuncCall;
|
||||
use PhpParser\Node\Expr\New_;
|
||||
use PhpParser\Node\Expr\Variable;
|
||||
|
@ -68,6 +69,9 @@ final class ParamAnalyzer
|
|||
public function isParamUsedInClassMethod(ClassMethod $classMethod, Param $param) : bool
|
||||
{
|
||||
$isParamUsed = \false;
|
||||
if ($param->var instanceof Error) {
|
||||
return \false;
|
||||
}
|
||||
$this->simpleCallableNodeTraverser->traverseNodesWithCallable($classMethod->stmts, function (Node $node) use(&$isParamUsed, $param) : ?int {
|
||||
if ($isParamUsed) {
|
||||
return NodeTraverser::STOP_TRAVERSAL;
|
||||
|
|
|
@ -5,6 +5,7 @@ namespace Rector\Core\NodeManipulator\Dependency;
|
|||
|
||||
use PhpParser\Node;
|
||||
use PhpParser\Node\Expr;
|
||||
use PhpParser\Node\Expr\Variable;
|
||||
use PhpParser\Node\Param;
|
||||
use PhpParser\Node\Stmt\Class_;
|
||||
use PhpParser\Node\Stmt\ClassMethod;
|
||||
|
@ -179,8 +180,8 @@ final class DependencyClassMethodDecorator
|
|||
}
|
||||
}
|
||||
if ($name !== $newName) {
|
||||
$param->var = clone $param->var;
|
||||
$param->var->name = $name;
|
||||
// $param->var = clone $param->var;
|
||||
$param->var = new Variable($name);
|
||||
}
|
||||
}
|
||||
private function areMaybeTypesEqual(?Type $type1, ?Type $type2) : bool
|
||||
|
|
|
@ -22,4 +22,4 @@ if (PHP_VERSION_ID < 50600) {
|
|||
|
||||
require_once __DIR__ . '/composer/autoload_real.php';
|
||||
|
||||
return ComposerAutoloaderInit61157adf679a3a61c07fee4a0014248a::getLoader();
|
||||
return ComposerAutoloaderInit2c903c5adb159e85b0f056c018f70110::getLoader();
|
||||
|
|
|
@ -2,7 +2,7 @@
|
|||
|
||||
// autoload_real.php @generated by Composer
|
||||
|
||||
class ComposerAutoloaderInit61157adf679a3a61c07fee4a0014248a
|
||||
class ComposerAutoloaderInit2c903c5adb159e85b0f056c018f70110
|
||||
{
|
||||
private static $loader;
|
||||
|
||||
|
@ -22,17 +22,17 @@ class ComposerAutoloaderInit61157adf679a3a61c07fee4a0014248a
|
|||
return self::$loader;
|
||||
}
|
||||
|
||||
spl_autoload_register(array('ComposerAutoloaderInit61157adf679a3a61c07fee4a0014248a', 'loadClassLoader'), true, true);
|
||||
spl_autoload_register(array('ComposerAutoloaderInit2c903c5adb159e85b0f056c018f70110', 'loadClassLoader'), true, true);
|
||||
self::$loader = $loader = new \Composer\Autoload\ClassLoader(\dirname(__DIR__));
|
||||
spl_autoload_unregister(array('ComposerAutoloaderInit61157adf679a3a61c07fee4a0014248a', 'loadClassLoader'));
|
||||
spl_autoload_unregister(array('ComposerAutoloaderInit2c903c5adb159e85b0f056c018f70110', 'loadClassLoader'));
|
||||
|
||||
require __DIR__ . '/autoload_static.php';
|
||||
call_user_func(\Composer\Autoload\ComposerStaticInit61157adf679a3a61c07fee4a0014248a::getInitializer($loader));
|
||||
call_user_func(\Composer\Autoload\ComposerStaticInit2c903c5adb159e85b0f056c018f70110::getInitializer($loader));
|
||||
|
||||
$loader->setClassMapAuthoritative(true);
|
||||
$loader->register(true);
|
||||
|
||||
$filesToLoad = \Composer\Autoload\ComposerStaticInit61157adf679a3a61c07fee4a0014248a::$files;
|
||||
$filesToLoad = \Composer\Autoload\ComposerStaticInit2c903c5adb159e85b0f056c018f70110::$files;
|
||||
$requireFile = \Closure::bind(static function ($fileIdentifier, $file) {
|
||||
if (empty($GLOBALS['__composer_autoload_files'][$fileIdentifier])) {
|
||||
$GLOBALS['__composer_autoload_files'][$fileIdentifier] = true;
|
||||
|
|
|
@ -4,7 +4,7 @@
|
|||
|
||||
namespace Composer\Autoload;
|
||||
|
||||
class ComposerStaticInit61157adf679a3a61c07fee4a0014248a
|
||||
class ComposerStaticInit2c903c5adb159e85b0f056c018f70110
|
||||
{
|
||||
public static $files = array (
|
||||
'ad155f8f1cf0d418fe49e248db8c661b' => __DIR__ . '/..' . '/react/promise/src/functions_include.php',
|
||||
|
@ -3114,9 +3114,9 @@ class ComposerStaticInit61157adf679a3a61c07fee4a0014248a
|
|||
public static function getInitializer(ClassLoader $loader)
|
||||
{
|
||||
return \Closure::bind(function () use ($loader) {
|
||||
$loader->prefixLengthsPsr4 = ComposerStaticInit61157adf679a3a61c07fee4a0014248a::$prefixLengthsPsr4;
|
||||
$loader->prefixDirsPsr4 = ComposerStaticInit61157adf679a3a61c07fee4a0014248a::$prefixDirsPsr4;
|
||||
$loader->classMap = ComposerStaticInit61157adf679a3a61c07fee4a0014248a::$classMap;
|
||||
$loader->prefixLengthsPsr4 = ComposerStaticInit2c903c5adb159e85b0f056c018f70110::$prefixLengthsPsr4;
|
||||
$loader->prefixDirsPsr4 = ComposerStaticInit2c903c5adb159e85b0f056c018f70110::$prefixDirsPsr4;
|
||||
$loader->classMap = ComposerStaticInit2c903c5adb159e85b0f056c018f70110::$classMap;
|
||||
|
||||
}, null, ClassLoader::class);
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue