Updated Rector to commit 91f4caeba4b8fbaeb8928fcd1f9d526b076154f5

91f4caeba4 [PHP 8.1] Skip trait in NullToStrictStringFuncCallArgRector as unknown context (#3180)
This commit is contained in:
Tomas Votruba 2022-12-10 12:49:18 +00:00
parent c4151416ec
commit 7cccf103fd
5 changed files with 24 additions and 19 deletions

View File

@ -16,11 +16,12 @@ use PhpParser\Node\Scalar\Encapsed;
use PhpParser\Node\Scalar\String_;
use PhpParser\Node\Stmt\Trait_;
use PHPStan\Analyser\Scope;
use PHPStan\Reflection\ClassReflection;
use PHPStan\Reflection\Native\NativeFunctionReflection;
use PHPStan\Type\ErrorType;
use PHPStan\Type\MixedType;
use Rector\Core\NodeAnalyzer\ArgsAnalyzer;
use Rector\Core\Rector\AbstractRector;
use Rector\Core\Rector\AbstractScopeAwareRector;
use Rector\Core\Reflection\ReflectionResolver;
use Rector\Core\ValueObject\PhpVersionFeature;
use Rector\NodeTypeResolver\Node\AttributeKey;
@ -31,7 +32,7 @@ use Symplify\RuleDocGenerator\ValueObject\RuleDefinition;
/**
* @see \Rector\Tests\Php81\Rector\FuncCall\NullToStrictStringFuncCallArgRector\NullToStrictStringFuncCallArgRectorTest
*/
final class NullToStrictStringFuncCallArgRector extends AbstractRector implements MinPhpVersionInterface
final class NullToStrictStringFuncCallArgRector extends AbstractScopeAwareRector implements MinPhpVersionInterface
{
/**
* @var array<string, string[]>
@ -84,9 +85,9 @@ CODE_SAMPLE
/**
* @param FuncCall $node
*/
public function refactor(Node $node) : ?Node
public function refactorWithScope(Node $node, Scope $scope) : ?Node
{
if ($this->shouldSkip($node)) {
if ($this->shouldSkip($node, $scope)) {
return null;
}
$args = $node->getArgs();
@ -217,12 +218,16 @@ CODE_SAMPLE
}
return $positions;
}
private function shouldSkip(FuncCall $funcCall) : bool
private function shouldSkip(FuncCall $funcCall, Scope $scope) : bool
{
$functionNames = \array_keys(self::ARG_POSITION_NAME_NULL_TO_STRICT_STRING);
if (!$this->nodeNameResolver->isNames($funcCall, $functionNames)) {
return \true;
}
$classReflection = $scope->getClassReflection();
if ($classReflection instanceof ClassReflection && $classReflection->isTrait()) {
return \true;
}
return $funcCall->isFirstClassCallable();
}
}

View File

@ -17,12 +17,12 @@ final class VersionResolver
* @api
* @var string
*/
public const PACKAGE_VERSION = '44ebacea719f64590b4644081e862437be7ce466';
public const PACKAGE_VERSION = '91f4caeba4b8fbaeb8928fcd1f9d526b076154f5';
/**
* @api
* @var string
*/
public const RELEASE_DATE = '2022-12-10 12:53:20';
public const RELEASE_DATE = '2022-12-10 12:45:02';
/**
* @var int
*/

2
vendor/autoload.php vendored
View File

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

View File

@ -2,7 +2,7 @@
// autoload_real.php @generated by Composer
class ComposerAutoloaderInit9d692db4d0c49ad7d38b4ed0f996ba58
class ComposerAutoloaderInit39aaafed15f1af35e93f14162c5e252c
{
private static $loader;
@ -22,19 +22,19 @@ class ComposerAutoloaderInit9d692db4d0c49ad7d38b4ed0f996ba58
return self::$loader;
}
spl_autoload_register(array('ComposerAutoloaderInit9d692db4d0c49ad7d38b4ed0f996ba58', 'loadClassLoader'), true, true);
spl_autoload_register(array('ComposerAutoloaderInit39aaafed15f1af35e93f14162c5e252c', 'loadClassLoader'), true, true);
self::$loader = $loader = new \Composer\Autoload\ClassLoader(\dirname(__DIR__));
spl_autoload_unregister(array('ComposerAutoloaderInit9d692db4d0c49ad7d38b4ed0f996ba58', 'loadClassLoader'));
spl_autoload_unregister(array('ComposerAutoloaderInit39aaafed15f1af35e93f14162c5e252c', 'loadClassLoader'));
require __DIR__ . '/autoload_static.php';
call_user_func(\Composer\Autoload\ComposerStaticInit9d692db4d0c49ad7d38b4ed0f996ba58::getInitializer($loader));
call_user_func(\Composer\Autoload\ComposerStaticInit39aaafed15f1af35e93f14162c5e252c::getInitializer($loader));
$loader->setClassMapAuthoritative(true);
$loader->register(true);
$includeFiles = \Composer\Autoload\ComposerStaticInit9d692db4d0c49ad7d38b4ed0f996ba58::$files;
$includeFiles = \Composer\Autoload\ComposerStaticInit39aaafed15f1af35e93f14162c5e252c::$files;
foreach ($includeFiles as $fileIdentifier => $file) {
composerRequire9d692db4d0c49ad7d38b4ed0f996ba58($fileIdentifier, $file);
composerRequire39aaafed15f1af35e93f14162c5e252c($fileIdentifier, $file);
}
return $loader;
@ -46,7 +46,7 @@ class ComposerAutoloaderInit9d692db4d0c49ad7d38b4ed0f996ba58
* @param string $file
* @return void
*/
function composerRequire9d692db4d0c49ad7d38b4ed0f996ba58($fileIdentifier, $file)
function composerRequire39aaafed15f1af35e93f14162c5e252c($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 ComposerStaticInit9d692db4d0c49ad7d38b4ed0f996ba58
class ComposerStaticInit39aaafed15f1af35e93f14162c5e252c
{
public static $files = array (
'ad155f8f1cf0d418fe49e248db8c661b' => __DIR__ . '/..' . '/react/promise/src/functions_include.php',
@ -3026,9 +3026,9 @@ class ComposerStaticInit9d692db4d0c49ad7d38b4ed0f996ba58
public static function getInitializer(ClassLoader $loader)
{
return \Closure::bind(function () use ($loader) {
$loader->prefixLengthsPsr4 = ComposerStaticInit9d692db4d0c49ad7d38b4ed0f996ba58::$prefixLengthsPsr4;
$loader->prefixDirsPsr4 = ComposerStaticInit9d692db4d0c49ad7d38b4ed0f996ba58::$prefixDirsPsr4;
$loader->classMap = ComposerStaticInit9d692db4d0c49ad7d38b4ed0f996ba58::$classMap;
$loader->prefixLengthsPsr4 = ComposerStaticInit39aaafed15f1af35e93f14162c5e252c::$prefixLengthsPsr4;
$loader->prefixDirsPsr4 = ComposerStaticInit39aaafed15f1af35e93f14162c5e252c::$prefixDirsPsr4;
$loader->classMap = ComposerStaticInit39aaafed15f1af35e93f14162c5e252c::$classMap;
}, null, ClassLoader::class);
}