Updated Rector to commit e546dbb45f

e546dbb45f [Php80] Handle optional, required, optional on OptionalParametersAfterRequiredRector (#1550)
This commit is contained in:
Tomas Votruba 2021-12-23 13:23:36 +00:00
parent 80c023c646
commit a2fdb61906
7 changed files with 28 additions and 28 deletions

View File

@ -113,7 +113,7 @@ CODE_SAMPLE
if (!$classMethodReflection instanceof \PHPStan\Reflection\MethodReflection) {
return null;
}
$expectedArgOrParamOrder = $this->resolveExpectedArgParamOrderIfDifferent($classMethodReflection, $classMethod->params);
$expectedArgOrParamOrder = $this->resolveExpectedArgParamOrderIfDifferent($classMethodReflection);
if ($expectedArgOrParamOrder === null) {
return null;
}
@ -131,7 +131,7 @@ CODE_SAMPLE
if (!$methodReflection instanceof \PHPStan\Reflection\MethodReflection) {
return null;
}
$expectedArgOrParamOrder = $this->resolveExpectedArgParamOrderIfDifferent($methodReflection, $new->args);
$expectedArgOrParamOrder = $this->resolveExpectedArgParamOrderIfDifferent($methodReflection);
if ($expectedArgOrParamOrder === null) {
return null;
}
@ -145,7 +145,7 @@ CODE_SAMPLE
if (!$methodReflection instanceof \PHPStan\Reflection\MethodReflection) {
return null;
}
$expectedArgOrParamOrder = $this->resolveExpectedArgParamOrderIfDifferent($methodReflection, $methodCall->args);
$expectedArgOrParamOrder = $this->resolveExpectedArgParamOrderIfDifferent($methodReflection);
if ($expectedArgOrParamOrder === null) {
return null;
}
@ -158,19 +158,15 @@ CODE_SAMPLE
return $methodCall;
}
/**
* @param array<Node\Arg|Node\Param> $argsOrParams
* @return int[]|null
*/
private function resolveExpectedArgParamOrderIfDifferent(\PHPStan\Reflection\MethodReflection $methodReflection, array $argsOrParams) : ?array
private function resolveExpectedArgParamOrderIfDifferent(\PHPStan\Reflection\MethodReflection $methodReflection) : ?array
{
if ($this->vendorLocationDetector->detectMethodReflection($methodReflection)) {
return null;
}
$parametersAcceptor = \PHPStan\Reflection\ParametersAcceptorSelector::selectSingle($methodReflection->getVariants());
$expectedParameterReflections = $this->requireOptionalParamResolver->resolveFromReflection($methodReflection);
if (\count($argsOrParams) !== \count($parametersAcceptor->getParameters())) {
return null;
}
if ($expectedParameterReflections === $parametersAcceptor->getParameters()) {
return null;
}

View File

@ -16,11 +16,11 @@ final class VersionResolver
/**
* @var string
*/
public const PACKAGE_VERSION = '8f8685af81fbb352f2e83e996efe91bda7f03308';
public const PACKAGE_VERSION = 'e546dbb45f59843b1a81685be05e5e1fb58b6ed9';
/**
* @var string
*/
public const RELEASE_DATE = '2021-12-23 17:23:58';
public const RELEASE_DATE = '2021-12-23 14:06:56';
public static function resolvePackageVersion() : string
{
$process = new \RectorPrefix20211223\Symfony\Component\Process\Process(['git', 'log', '--pretty="%H"', '-n1', 'HEAD'], __DIR__);

View File

@ -232,7 +232,7 @@ final class BetterNodeFinder
*/
public function findClassMethodAssignsToLocalProperty(\PhpParser\Node\Stmt\ClassMethod $classMethod, string $propertyName) : array
{
return $this->find((array) $classMethod->stmts, function (\PhpParser\Node $node) use($propertyName) : bool {
return $this->find((array) $classMethod->stmts, function (\PhpParser\Node $node) use($classMethod, $propertyName) : bool {
if (!$node instanceof \PhpParser\Node\Expr\Assign) {
return \false;
}
@ -243,6 +243,10 @@ final class BetterNodeFinder
if (!$this->nodeNameResolver->isName($propertyFetch->var, 'this')) {
return \false;
}
$parentFunctionLike = $this->findParentType($node, \PhpParser\Node\Stmt\ClassMethod::class);
if ($parentFunctionLike !== $classMethod) {
return \false;
}
return $this->nodeNameResolver->isName($propertyFetch->name, $propertyName);
});
}

2
vendor/autoload.php vendored
View File

@ -4,4 +4,4 @@
require_once __DIR__ . '/composer/autoload_real.php';
return ComposerAutoloaderInit7d3e48082965b027bc50b5884034c025::getLoader();
return ComposerAutoloaderInitd7fcce1cbd8e01b653b5cd87c02cf713::getLoader();

View File

@ -2,7 +2,7 @@
// autoload_real.php @generated by Composer
class ComposerAutoloaderInit7d3e48082965b027bc50b5884034c025
class ComposerAutoloaderInitd7fcce1cbd8e01b653b5cd87c02cf713
{
private static $loader;
@ -22,15 +22,15 @@ class ComposerAutoloaderInit7d3e48082965b027bc50b5884034c025
return self::$loader;
}
spl_autoload_register(array('ComposerAutoloaderInit7d3e48082965b027bc50b5884034c025', 'loadClassLoader'), true, true);
spl_autoload_register(array('ComposerAutoloaderInitd7fcce1cbd8e01b653b5cd87c02cf713', 'loadClassLoader'), true, true);
self::$loader = $loader = new \Composer\Autoload\ClassLoader(\dirname(\dirname(__FILE__)));
spl_autoload_unregister(array('ComposerAutoloaderInit7d3e48082965b027bc50b5884034c025', 'loadClassLoader'));
spl_autoload_unregister(array('ComposerAutoloaderInitd7fcce1cbd8e01b653b5cd87c02cf713', 'loadClassLoader'));
$useStaticLoader = PHP_VERSION_ID >= 50600 && !defined('HHVM_VERSION') && (!function_exists('zend_loader_file_encoded') || !zend_loader_file_encoded());
if ($useStaticLoader) {
require __DIR__ . '/autoload_static.php';
call_user_func(\Composer\Autoload\ComposerStaticInit7d3e48082965b027bc50b5884034c025::getInitializer($loader));
call_user_func(\Composer\Autoload\ComposerStaticInitd7fcce1cbd8e01b653b5cd87c02cf713::getInitializer($loader));
} else {
$classMap = require __DIR__ . '/autoload_classmap.php';
if ($classMap) {
@ -42,12 +42,12 @@ class ComposerAutoloaderInit7d3e48082965b027bc50b5884034c025
$loader->register(true);
if ($useStaticLoader) {
$includeFiles = Composer\Autoload\ComposerStaticInit7d3e48082965b027bc50b5884034c025::$files;
$includeFiles = Composer\Autoload\ComposerStaticInitd7fcce1cbd8e01b653b5cd87c02cf713::$files;
} else {
$includeFiles = require __DIR__ . '/autoload_files.php';
}
foreach ($includeFiles as $fileIdentifier => $file) {
composerRequire7d3e48082965b027bc50b5884034c025($fileIdentifier, $file);
composerRequired7fcce1cbd8e01b653b5cd87c02cf713($fileIdentifier, $file);
}
return $loader;
@ -59,7 +59,7 @@ class ComposerAutoloaderInit7d3e48082965b027bc50b5884034c025
* @param string $file
* @return void
*/
function composerRequire7d3e48082965b027bc50b5884034c025($fileIdentifier, $file)
function composerRequired7fcce1cbd8e01b653b5cd87c02cf713($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 ComposerStaticInit7d3e48082965b027bc50b5884034c025
class ComposerStaticInitd7fcce1cbd8e01b653b5cd87c02cf713
{
public static $files = array (
'0e6d7bf4a5811bfa5cf40c5ccd6fae6a' => __DIR__ . '/..' . '/symfony/polyfill-mbstring/bootstrap.php',
@ -3836,9 +3836,9 @@ class ComposerStaticInit7d3e48082965b027bc50b5884034c025
public static function getInitializer(ClassLoader $loader)
{
return \Closure::bind(function () use ($loader) {
$loader->prefixLengthsPsr4 = ComposerStaticInit7d3e48082965b027bc50b5884034c025::$prefixLengthsPsr4;
$loader->prefixDirsPsr4 = ComposerStaticInit7d3e48082965b027bc50b5884034c025::$prefixDirsPsr4;
$loader->classMap = ComposerStaticInit7d3e48082965b027bc50b5884034c025::$classMap;
$loader->prefixLengthsPsr4 = ComposerStaticInitd7fcce1cbd8e01b653b5cd87c02cf713::$prefixLengthsPsr4;
$loader->prefixDirsPsr4 = ComposerStaticInitd7fcce1cbd8e01b653b5cd87c02cf713::$prefixDirsPsr4;
$loader->classMap = ComposerStaticInitd7fcce1cbd8e01b653b5cd87c02cf713::$classMap;
}, null, ClassLoader::class);
}

View File

@ -9,8 +9,8 @@ $loader = require_once __DIR__.'/autoload.php';
if (!class_exists('AutoloadIncluder', false) && !interface_exists('AutoloadIncluder', false) && !trait_exists('AutoloadIncluder', false)) {
spl_autoload_call('RectorPrefix20211223\AutoloadIncluder');
}
if (!class_exists('ComposerAutoloaderInit7d3e48082965b027bc50b5884034c025', false) && !interface_exists('ComposerAutoloaderInit7d3e48082965b027bc50b5884034c025', false) && !trait_exists('ComposerAutoloaderInit7d3e48082965b027bc50b5884034c025', false)) {
spl_autoload_call('RectorPrefix20211223\ComposerAutoloaderInit7d3e48082965b027bc50b5884034c025');
if (!class_exists('ComposerAutoloaderInitd7fcce1cbd8e01b653b5cd87c02cf713', false) && !interface_exists('ComposerAutoloaderInitd7fcce1cbd8e01b653b5cd87c02cf713', false) && !trait_exists('ComposerAutoloaderInitd7fcce1cbd8e01b653b5cd87c02cf713', false)) {
spl_autoload_call('RectorPrefix20211223\ComposerAutoloaderInitd7fcce1cbd8e01b653b5cd87c02cf713');
}
if (!class_exists('Helmich\TypoScriptParser\Parser\AST\Statement', false) && !interface_exists('Helmich\TypoScriptParser\Parser\AST\Statement', false) && !trait_exists('Helmich\TypoScriptParser\Parser\AST\Statement', false)) {
spl_autoload_call('RectorPrefix20211223\Helmich\TypoScriptParser\Parser\AST\Statement');
@ -78,9 +78,9 @@ if (!function_exists('print_node')) {
return \RectorPrefix20211223\print_node(...func_get_args());
}
}
if (!function_exists('composerRequire7d3e48082965b027bc50b5884034c025')) {
function composerRequire7d3e48082965b027bc50b5884034c025() {
return \RectorPrefix20211223\composerRequire7d3e48082965b027bc50b5884034c025(...func_get_args());
if (!function_exists('composerRequired7fcce1cbd8e01b653b5cd87c02cf713')) {
function composerRequired7fcce1cbd8e01b653b5cd87c02cf713() {
return \RectorPrefix20211223\composerRequired7fcce1cbd8e01b653b5cd87c02cf713(...func_get_args());
}
}
if (!function_exists('scanPath')) {