mirror of
https://github.com/rectorphp/rector.git
synced 2025-01-17 21:38:22 +01:00
Updated Rector to commit 91f4caeba4b8fbaeb8928fcd1f9d526b076154f5
91f4caeba4
[PHP 8.1] Skip trait in NullToStrictStringFuncCallArgRector as unknown context (#3180)
This commit is contained in:
parent
c4151416ec
commit
7cccf103fd
@ -16,11 +16,12 @@ use PhpParser\Node\Scalar\Encapsed;
|
|||||||
use PhpParser\Node\Scalar\String_;
|
use PhpParser\Node\Scalar\String_;
|
||||||
use PhpParser\Node\Stmt\Trait_;
|
use PhpParser\Node\Stmt\Trait_;
|
||||||
use PHPStan\Analyser\Scope;
|
use PHPStan\Analyser\Scope;
|
||||||
|
use PHPStan\Reflection\ClassReflection;
|
||||||
use PHPStan\Reflection\Native\NativeFunctionReflection;
|
use PHPStan\Reflection\Native\NativeFunctionReflection;
|
||||||
use PHPStan\Type\ErrorType;
|
use PHPStan\Type\ErrorType;
|
||||||
use PHPStan\Type\MixedType;
|
use PHPStan\Type\MixedType;
|
||||||
use Rector\Core\NodeAnalyzer\ArgsAnalyzer;
|
use Rector\Core\NodeAnalyzer\ArgsAnalyzer;
|
||||||
use Rector\Core\Rector\AbstractRector;
|
use Rector\Core\Rector\AbstractScopeAwareRector;
|
||||||
use Rector\Core\Reflection\ReflectionResolver;
|
use Rector\Core\Reflection\ReflectionResolver;
|
||||||
use Rector\Core\ValueObject\PhpVersionFeature;
|
use Rector\Core\ValueObject\PhpVersionFeature;
|
||||||
use Rector\NodeTypeResolver\Node\AttributeKey;
|
use Rector\NodeTypeResolver\Node\AttributeKey;
|
||||||
@ -31,7 +32,7 @@ use Symplify\RuleDocGenerator\ValueObject\RuleDefinition;
|
|||||||
/**
|
/**
|
||||||
* @see \Rector\Tests\Php81\Rector\FuncCall\NullToStrictStringFuncCallArgRector\NullToStrictStringFuncCallArgRectorTest
|
* @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[]>
|
* @var array<string, string[]>
|
||||||
@ -84,9 +85,9 @@ CODE_SAMPLE
|
|||||||
/**
|
/**
|
||||||
* @param FuncCall $node
|
* @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;
|
return null;
|
||||||
}
|
}
|
||||||
$args = $node->getArgs();
|
$args = $node->getArgs();
|
||||||
@ -217,12 +218,16 @@ CODE_SAMPLE
|
|||||||
}
|
}
|
||||||
return $positions;
|
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);
|
$functionNames = \array_keys(self::ARG_POSITION_NAME_NULL_TO_STRICT_STRING);
|
||||||
if (!$this->nodeNameResolver->isNames($funcCall, $functionNames)) {
|
if (!$this->nodeNameResolver->isNames($funcCall, $functionNames)) {
|
||||||
return \true;
|
return \true;
|
||||||
}
|
}
|
||||||
|
$classReflection = $scope->getClassReflection();
|
||||||
|
if ($classReflection instanceof ClassReflection && $classReflection->isTrait()) {
|
||||||
|
return \true;
|
||||||
|
}
|
||||||
return $funcCall->isFirstClassCallable();
|
return $funcCall->isFirstClassCallable();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -17,12 +17,12 @@ final class VersionResolver
|
|||||||
* @api
|
* @api
|
||||||
* @var string
|
* @var string
|
||||||
*/
|
*/
|
||||||
public const PACKAGE_VERSION = '44ebacea719f64590b4644081e862437be7ce466';
|
public const PACKAGE_VERSION = '91f4caeba4b8fbaeb8928fcd1f9d526b076154f5';
|
||||||
/**
|
/**
|
||||||
* @api
|
* @api
|
||||||
* @var string
|
* @var string
|
||||||
*/
|
*/
|
||||||
public const RELEASE_DATE = '2022-12-10 12:53:20';
|
public const RELEASE_DATE = '2022-12-10 12:45:02';
|
||||||
/**
|
/**
|
||||||
* @var int
|
* @var int
|
||||||
*/
|
*/
|
||||||
|
2
vendor/autoload.php
vendored
2
vendor/autoload.php
vendored
@ -22,4 +22,4 @@ if (PHP_VERSION_ID < 50600) {
|
|||||||
|
|
||||||
require_once __DIR__ . '/composer/autoload_real.php';
|
require_once __DIR__ . '/composer/autoload_real.php';
|
||||||
|
|
||||||
return ComposerAutoloaderInit9d692db4d0c49ad7d38b4ed0f996ba58::getLoader();
|
return ComposerAutoloaderInit39aaafed15f1af35e93f14162c5e252c::getLoader();
|
||||||
|
14
vendor/composer/autoload_real.php
vendored
14
vendor/composer/autoload_real.php
vendored
@ -2,7 +2,7 @@
|
|||||||
|
|
||||||
// autoload_real.php @generated by Composer
|
// autoload_real.php @generated by Composer
|
||||||
|
|
||||||
class ComposerAutoloaderInit9d692db4d0c49ad7d38b4ed0f996ba58
|
class ComposerAutoloaderInit39aaafed15f1af35e93f14162c5e252c
|
||||||
{
|
{
|
||||||
private static $loader;
|
private static $loader;
|
||||||
|
|
||||||
@ -22,19 +22,19 @@ class ComposerAutoloaderInit9d692db4d0c49ad7d38b4ed0f996ba58
|
|||||||
return self::$loader;
|
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__));
|
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';
|
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->setClassMapAuthoritative(true);
|
||||||
$loader->register(true);
|
$loader->register(true);
|
||||||
|
|
||||||
$includeFiles = \Composer\Autoload\ComposerStaticInit9d692db4d0c49ad7d38b4ed0f996ba58::$files;
|
$includeFiles = \Composer\Autoload\ComposerStaticInit39aaafed15f1af35e93f14162c5e252c::$files;
|
||||||
foreach ($includeFiles as $fileIdentifier => $file) {
|
foreach ($includeFiles as $fileIdentifier => $file) {
|
||||||
composerRequire9d692db4d0c49ad7d38b4ed0f996ba58($fileIdentifier, $file);
|
composerRequire39aaafed15f1af35e93f14162c5e252c($fileIdentifier, $file);
|
||||||
}
|
}
|
||||||
|
|
||||||
return $loader;
|
return $loader;
|
||||||
@ -46,7 +46,7 @@ class ComposerAutoloaderInit9d692db4d0c49ad7d38b4ed0f996ba58
|
|||||||
* @param string $file
|
* @param string $file
|
||||||
* @return void
|
* @return void
|
||||||
*/
|
*/
|
||||||
function composerRequire9d692db4d0c49ad7d38b4ed0f996ba58($fileIdentifier, $file)
|
function composerRequire39aaafed15f1af35e93f14162c5e252c($fileIdentifier, $file)
|
||||||
{
|
{
|
||||||
if (empty($GLOBALS['__composer_autoload_files'][$fileIdentifier])) {
|
if (empty($GLOBALS['__composer_autoload_files'][$fileIdentifier])) {
|
||||||
$GLOBALS['__composer_autoload_files'][$fileIdentifier] = true;
|
$GLOBALS['__composer_autoload_files'][$fileIdentifier] = true;
|
||||||
|
8
vendor/composer/autoload_static.php
vendored
8
vendor/composer/autoload_static.php
vendored
@ -4,7 +4,7 @@
|
|||||||
|
|
||||||
namespace Composer\Autoload;
|
namespace Composer\Autoload;
|
||||||
|
|
||||||
class ComposerStaticInit9d692db4d0c49ad7d38b4ed0f996ba58
|
class ComposerStaticInit39aaafed15f1af35e93f14162c5e252c
|
||||||
{
|
{
|
||||||
public static $files = array (
|
public static $files = array (
|
||||||
'ad155f8f1cf0d418fe49e248db8c661b' => __DIR__ . '/..' . '/react/promise/src/functions_include.php',
|
'ad155f8f1cf0d418fe49e248db8c661b' => __DIR__ . '/..' . '/react/promise/src/functions_include.php',
|
||||||
@ -3026,9 +3026,9 @@ class ComposerStaticInit9d692db4d0c49ad7d38b4ed0f996ba58
|
|||||||
public static function getInitializer(ClassLoader $loader)
|
public static function getInitializer(ClassLoader $loader)
|
||||||
{
|
{
|
||||||
return \Closure::bind(function () use ($loader) {
|
return \Closure::bind(function () use ($loader) {
|
||||||
$loader->prefixLengthsPsr4 = ComposerStaticInit9d692db4d0c49ad7d38b4ed0f996ba58::$prefixLengthsPsr4;
|
$loader->prefixLengthsPsr4 = ComposerStaticInit39aaafed15f1af35e93f14162c5e252c::$prefixLengthsPsr4;
|
||||||
$loader->prefixDirsPsr4 = ComposerStaticInit9d692db4d0c49ad7d38b4ed0f996ba58::$prefixDirsPsr4;
|
$loader->prefixDirsPsr4 = ComposerStaticInit39aaafed15f1af35e93f14162c5e252c::$prefixDirsPsr4;
|
||||||
$loader->classMap = ComposerStaticInit9d692db4d0c49ad7d38b4ed0f996ba58::$classMap;
|
$loader->classMap = ComposerStaticInit39aaafed15f1af35e93f14162c5e252c::$classMap;
|
||||||
|
|
||||||
}, null, ClassLoader::class);
|
}, null, ClassLoader::class);
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user