Updated Rector to commit 6dea82deb1e64a47c0284a86b1b448dc8b1fc05f

6dea82deb1 Drop AttributeKey::SCOPE in Rector classes (#3791)
This commit is contained in:
Tomas Votruba 2023-05-13 16:50:14 +00:00
parent af39f1cc41
commit 900facbf32
8 changed files with 25 additions and 28 deletions

View File

@ -18,6 +18,7 @@ use PHPStan\Type\MixedType;
use PHPStan\Type\Type;
use PHPStan\Type\UnionType;
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;
@ -29,7 +30,7 @@ use Symplify\RuleDocGenerator\ValueObject\RuleDefinition;
/**
* @see \Rector\Tests\TypeDeclaration\Rector\Param\ParamTypeFromStrictTypedPropertyRector\ParamTypeFromStrictTypedPropertyRectorTest
*/
final class ParamTypeFromStrictTypedPropertyRector extends AbstractRector implements MinPhpVersionInterface
final class ParamTypeFromStrictTypedPropertyRector extends AbstractScopeAwareRector implements MinPhpVersionInterface
{
/**
* @readonly
@ -82,19 +83,19 @@ CODE_SAMPLE
/**
* @param Param $node
*/
public function refactor(Node $node) : ?Node
public function refactorWithScope(Node $node, Scope $scope) : ?Node
{
$parentNode = $node->getAttribute(AttributeKey::PARENT_NODE);
if (!$parentNode instanceof ClassMethod) {
return null;
}
return $this->decorateParamWithType($parentNode, $node);
return $this->decorateParamWithType($parentNode, $node, $scope);
}
public function provideMinPhpVersion() : int
{
return PhpVersionFeature::TYPED_PROPERTIES;
}
private function decorateParamWithType(ClassMethod $classMethod, Param $param) : ?Param
private function decorateParamWithType(ClassMethod $classMethod, Param $param, Scope $scope) : ?Param
{
if ($param->type !== null) {
return null;
@ -105,7 +106,7 @@ CODE_SAMPLE
if ($this->parentClassMethodTypeOverrideGuard->hasParentClassMethod($classMethod)) {
return null;
}
$originalParamType = $this->resolveParamOriginalType($param);
$originalParamType = $this->resolveParamOriginalType($param, $scope);
$paramName = $this->getName($param);
/** @var Assign[] $assigns */
$assigns = $this->betterNodeFinder->findInstanceOf((array) $classMethod->getStmts(), Assign::class);
@ -161,12 +162,8 @@ CODE_SAMPLE
$currentParamType = $scope->getVariableType($paramName);
return !$currentParamType->equals($originalType);
}
private function resolveParamOriginalType(Param $param) : Type
private function resolveParamOriginalType(Param $param, Scope $scope) : Type
{
$scope = $param->getAttribute(AttributeKey::SCOPE);
if (!$scope instanceof Scope) {
return new MixedType();
}
$paramName = $this->getName($param);
if (!$scope->hasVariableType($paramName)->yes()) {
return new MixedType();

View File

@ -19,12 +19,12 @@ final class VersionResolver
* @api
* @var string
*/
public const PACKAGE_VERSION = '56e13466c3ba3c23c0eb5e7e3af6908433c0c6af';
public const PACKAGE_VERSION = '6dea82deb1e64a47c0284a86b1b448dc8b1fc05f';
/**
* @api
* @var string
*/
public const RELEASE_DATE = '2023-05-13 16:40:51';
public const RELEASE_DATE = '2023-05-13 16:45:12';
/**
* @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 ComposerAutoloaderInit0b719f9a900fe844677d95a21f1699d1::getLoader();
return ComposerAutoloaderInita0b651f3450034e02afaa1bf3f06ce1f::getLoader();

View File

@ -2,7 +2,7 @@
// autoload_real.php @generated by Composer
class ComposerAutoloaderInit0b719f9a900fe844677d95a21f1699d1
class ComposerAutoloaderInita0b651f3450034e02afaa1bf3f06ce1f
{
private static $loader;
@ -22,17 +22,17 @@ class ComposerAutoloaderInit0b719f9a900fe844677d95a21f1699d1
return self::$loader;
}
spl_autoload_register(array('ComposerAutoloaderInit0b719f9a900fe844677d95a21f1699d1', 'loadClassLoader'), true, true);
spl_autoload_register(array('ComposerAutoloaderInita0b651f3450034e02afaa1bf3f06ce1f', 'loadClassLoader'), true, true);
self::$loader = $loader = new \Composer\Autoload\ClassLoader(\dirname(__DIR__));
spl_autoload_unregister(array('ComposerAutoloaderInit0b719f9a900fe844677d95a21f1699d1', 'loadClassLoader'));
spl_autoload_unregister(array('ComposerAutoloaderInita0b651f3450034e02afaa1bf3f06ce1f', 'loadClassLoader'));
require __DIR__ . '/autoload_static.php';
call_user_func(\Composer\Autoload\ComposerStaticInit0b719f9a900fe844677d95a21f1699d1::getInitializer($loader));
call_user_func(\Composer\Autoload\ComposerStaticInita0b651f3450034e02afaa1bf3f06ce1f::getInitializer($loader));
$loader->setClassMapAuthoritative(true);
$loader->register(true);
$filesToLoad = \Composer\Autoload\ComposerStaticInit0b719f9a900fe844677d95a21f1699d1::$files;
$filesToLoad = \Composer\Autoload\ComposerStaticInita0b651f3450034e02afaa1bf3f06ce1f::$files;
$requireFile = \Closure::bind(static function ($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 ComposerStaticInit0b719f9a900fe844677d95a21f1699d1
class ComposerStaticInita0b651f3450034e02afaa1bf3f06ce1f
{
public static $files = array (
'ad155f8f1cf0d418fe49e248db8c661b' => __DIR__ . '/..' . '/react/promise/src/functions_include.php',
@ -3111,9 +3111,9 @@ class ComposerStaticInit0b719f9a900fe844677d95a21f1699d1
public static function getInitializer(ClassLoader $loader)
{
return \Closure::bind(function () use ($loader) {
$loader->prefixLengthsPsr4 = ComposerStaticInit0b719f9a900fe844677d95a21f1699d1::$prefixLengthsPsr4;
$loader->prefixDirsPsr4 = ComposerStaticInit0b719f9a900fe844677d95a21f1699d1::$prefixDirsPsr4;
$loader->classMap = ComposerStaticInit0b719f9a900fe844677d95a21f1699d1::$classMap;
$loader->prefixLengthsPsr4 = ComposerStaticInita0b651f3450034e02afaa1bf3f06ce1f::$prefixLengthsPsr4;
$loader->prefixDirsPsr4 = ComposerStaticInita0b651f3450034e02afaa1bf3f06ce1f::$prefixDirsPsr4;
$loader->classMap = ComposerStaticInita0b651f3450034e02afaa1bf3f06ce1f::$classMap;
}, null, ClassLoader::class);
}

View File

@ -1924,12 +1924,12 @@
"source": {
"type": "git",
"url": "https:\/\/github.com\/rectorphp\/rector-downgrade-php.git",
"reference": "86a937c9c1b31ed702070cb39f2ee2d4748f545b"
"reference": "76125e6c40eec203e4f0e02dd52ef6c3e18cf0c5"
},
"dist": {
"type": "zip",
"url": "https:\/\/api.github.com\/repos\/rectorphp\/rector-downgrade-php\/zipball\/86a937c9c1b31ed702070cb39f2ee2d4748f545b",
"reference": "86a937c9c1b31ed702070cb39f2ee2d4748f545b",
"url": "https:\/\/api.github.com\/repos\/rectorphp\/rector-downgrade-php\/zipball\/76125e6c40eec203e4f0e02dd52ef6c3e18cf0c5",
"reference": "76125e6c40eec203e4f0e02dd52ef6c3e18cf0c5",
"shasum": ""
},
"require": {
@ -1953,7 +1953,7 @@
"tomasvotruba\/type-coverage": "^0.0.9",
"tomasvotruba\/unused-public": "^0.0.34"
},
"time": "2023-05-13T15:19:39+00:00",
"time": "2023-05-13T16:43:57+00:00",
"default-branch": true,
"type": "rector-extension",
"extra": {

File diff suppressed because one or more lines are too long

View File

@ -9,7 +9,7 @@ namespace Rector\RectorInstaller;
*/
final class GeneratedConfig
{
public const EXTENSIONS = array('rector/rector-doctrine' => array('install_path' => '/home/runner/work/rector-src/rector-src/vendor/rector/rector-doctrine', 'relative_install_path' => '../../rector-doctrine', 'extra' => array('includes' => array(0 => 'config/config.php')), 'version' => 'dev-main 03df9e3'), 'rector/rector-downgrade-php' => array('install_path' => '/home/runner/work/rector-src/rector-src/vendor/rector/rector-downgrade-php', 'relative_install_path' => '../../rector-downgrade-php', 'extra' => array('includes' => array(0 => 'config/config.php')), 'version' => 'dev-main 86a937c'), 'rector/rector-phpunit' => array('install_path' => '/home/runner/work/rector-src/rector-src/vendor/rector/rector-phpunit', 'relative_install_path' => '../../rector-phpunit', 'extra' => array('includes' => array(0 => 'config/config.php')), 'version' => 'dev-main 63d391e'), 'rector/rector-symfony' => array('install_path' => '/home/runner/work/rector-src/rector-src/vendor/rector/rector-symfony', 'relative_install_path' => '../../rector-symfony', 'extra' => array('includes' => array(0 => 'config/config.php')), 'version' => 'dev-main f385be4'));
public const EXTENSIONS = array('rector/rector-doctrine' => array('install_path' => '/home/runner/work/rector-src/rector-src/vendor/rector/rector-doctrine', 'relative_install_path' => '../../rector-doctrine', 'extra' => array('includes' => array(0 => 'config/config.php')), 'version' => 'dev-main 03df9e3'), 'rector/rector-downgrade-php' => array('install_path' => '/home/runner/work/rector-src/rector-src/vendor/rector/rector-downgrade-php', 'relative_install_path' => '../../rector-downgrade-php', 'extra' => array('includes' => array(0 => 'config/config.php')), 'version' => 'dev-main 76125e6'), 'rector/rector-phpunit' => array('install_path' => '/home/runner/work/rector-src/rector-src/vendor/rector/rector-phpunit', 'relative_install_path' => '../../rector-phpunit', 'extra' => array('includes' => array(0 => 'config/config.php')), 'version' => 'dev-main 63d391e'), 'rector/rector-symfony' => array('install_path' => '/home/runner/work/rector-src/rector-src/vendor/rector/rector-symfony', 'relative_install_path' => '../../rector-symfony', 'extra' => array('includes' => array(0 => 'config/config.php')), 'version' => 'dev-main f385be4'));
private function __construct()
{
}