mirror of
https://github.com/rectorphp/rector.git
synced 2024-06-08 04:10:51 +00:00
Updated Rector to commit 6dea82deb1e64a47c0284a86b1b448dc8b1fc05f
6dea82deb1
Drop AttributeKey::SCOPE in Rector classes (#3791)
This commit is contained in:
parent
af39f1cc41
commit
900facbf32
|
@ -18,6 +18,7 @@ use PHPStan\Type\MixedType;
|
||||||
use PHPStan\Type\Type;
|
use PHPStan\Type\Type;
|
||||||
use PHPStan\Type\UnionType;
|
use PHPStan\Type\UnionType;
|
||||||
use Rector\Core\Rector\AbstractRector;
|
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;
|
||||||
|
@ -29,7 +30,7 @@ use Symplify\RuleDocGenerator\ValueObject\RuleDefinition;
|
||||||
/**
|
/**
|
||||||
* @see \Rector\Tests\TypeDeclaration\Rector\Param\ParamTypeFromStrictTypedPropertyRector\ParamTypeFromStrictTypedPropertyRectorTest
|
* @see \Rector\Tests\TypeDeclaration\Rector\Param\ParamTypeFromStrictTypedPropertyRector\ParamTypeFromStrictTypedPropertyRectorTest
|
||||||
*/
|
*/
|
||||||
final class ParamTypeFromStrictTypedPropertyRector extends AbstractRector implements MinPhpVersionInterface
|
final class ParamTypeFromStrictTypedPropertyRector extends AbstractScopeAwareRector implements MinPhpVersionInterface
|
||||||
{
|
{
|
||||||
/**
|
/**
|
||||||
* @readonly
|
* @readonly
|
||||||
|
@ -82,19 +83,19 @@ CODE_SAMPLE
|
||||||
/**
|
/**
|
||||||
* @param Param $node
|
* @param Param $node
|
||||||
*/
|
*/
|
||||||
public function refactor(Node $node) : ?Node
|
public function refactorWithScope(Node $node, Scope $scope) : ?Node
|
||||||
{
|
{
|
||||||
$parentNode = $node->getAttribute(AttributeKey::PARENT_NODE);
|
$parentNode = $node->getAttribute(AttributeKey::PARENT_NODE);
|
||||||
if (!$parentNode instanceof ClassMethod) {
|
if (!$parentNode instanceof ClassMethod) {
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
return $this->decorateParamWithType($parentNode, $node);
|
return $this->decorateParamWithType($parentNode, $node, $scope);
|
||||||
}
|
}
|
||||||
public function provideMinPhpVersion() : int
|
public function provideMinPhpVersion() : int
|
||||||
{
|
{
|
||||||
return PhpVersionFeature::TYPED_PROPERTIES;
|
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) {
|
if ($param->type !== null) {
|
||||||
return null;
|
return null;
|
||||||
|
@ -105,7 +106,7 @@ CODE_SAMPLE
|
||||||
if ($this->parentClassMethodTypeOverrideGuard->hasParentClassMethod($classMethod)) {
|
if ($this->parentClassMethodTypeOverrideGuard->hasParentClassMethod($classMethod)) {
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
$originalParamType = $this->resolveParamOriginalType($param);
|
$originalParamType = $this->resolveParamOriginalType($param, $scope);
|
||||||
$paramName = $this->getName($param);
|
$paramName = $this->getName($param);
|
||||||
/** @var Assign[] $assigns */
|
/** @var Assign[] $assigns */
|
||||||
$assigns = $this->betterNodeFinder->findInstanceOf((array) $classMethod->getStmts(), Assign::class);
|
$assigns = $this->betterNodeFinder->findInstanceOf((array) $classMethod->getStmts(), Assign::class);
|
||||||
|
@ -161,12 +162,8 @@ CODE_SAMPLE
|
||||||
$currentParamType = $scope->getVariableType($paramName);
|
$currentParamType = $scope->getVariableType($paramName);
|
||||||
return !$currentParamType->equals($originalType);
|
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);
|
$paramName = $this->getName($param);
|
||||||
if (!$scope->hasVariableType($paramName)->yes()) {
|
if (!$scope->hasVariableType($paramName)->yes()) {
|
||||||
return new MixedType();
|
return new MixedType();
|
||||||
|
|
|
@ -19,12 +19,12 @@ final class VersionResolver
|
||||||
* @api
|
* @api
|
||||||
* @var string
|
* @var string
|
||||||
*/
|
*/
|
||||||
public const PACKAGE_VERSION = '56e13466c3ba3c23c0eb5e7e3af6908433c0c6af';
|
public const PACKAGE_VERSION = '6dea82deb1e64a47c0284a86b1b448dc8b1fc05f';
|
||||||
/**
|
/**
|
||||||
* @api
|
* @api
|
||||||
* @var string
|
* @var string
|
||||||
*/
|
*/
|
||||||
public const RELEASE_DATE = '2023-05-13 16:40:51';
|
public const RELEASE_DATE = '2023-05-13 16:45:12';
|
||||||
/**
|
/**
|
||||||
* @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 ComposerAutoloaderInit0b719f9a900fe844677d95a21f1699d1::getLoader();
|
return ComposerAutoloaderInita0b651f3450034e02afaa1bf3f06ce1f::getLoader();
|
||||||
|
|
10
vendor/composer/autoload_real.php
vendored
10
vendor/composer/autoload_real.php
vendored
|
@ -2,7 +2,7 @@
|
||||||
|
|
||||||
// autoload_real.php @generated by Composer
|
// autoload_real.php @generated by Composer
|
||||||
|
|
||||||
class ComposerAutoloaderInit0b719f9a900fe844677d95a21f1699d1
|
class ComposerAutoloaderInita0b651f3450034e02afaa1bf3f06ce1f
|
||||||
{
|
{
|
||||||
private static $loader;
|
private static $loader;
|
||||||
|
|
||||||
|
@ -22,17 +22,17 @@ class ComposerAutoloaderInit0b719f9a900fe844677d95a21f1699d1
|
||||||
return self::$loader;
|
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__));
|
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';
|
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->setClassMapAuthoritative(true);
|
||||||
$loader->register(true);
|
$loader->register(true);
|
||||||
|
|
||||||
$filesToLoad = \Composer\Autoload\ComposerStaticInit0b719f9a900fe844677d95a21f1699d1::$files;
|
$filesToLoad = \Composer\Autoload\ComposerStaticInita0b651f3450034e02afaa1bf3f06ce1f::$files;
|
||||||
$requireFile = \Closure::bind(static function ($fileIdentifier, $file) {
|
$requireFile = \Closure::bind(static function ($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 ComposerStaticInit0b719f9a900fe844677d95a21f1699d1
|
class ComposerStaticInita0b651f3450034e02afaa1bf3f06ce1f
|
||||||
{
|
{
|
||||||
public static $files = array (
|
public static $files = array (
|
||||||
'ad155f8f1cf0d418fe49e248db8c661b' => __DIR__ . '/..' . '/react/promise/src/functions_include.php',
|
'ad155f8f1cf0d418fe49e248db8c661b' => __DIR__ . '/..' . '/react/promise/src/functions_include.php',
|
||||||
|
@ -3111,9 +3111,9 @@ class ComposerStaticInit0b719f9a900fe844677d95a21f1699d1
|
||||||
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 = ComposerStaticInit0b719f9a900fe844677d95a21f1699d1::$prefixLengthsPsr4;
|
$loader->prefixLengthsPsr4 = ComposerStaticInita0b651f3450034e02afaa1bf3f06ce1f::$prefixLengthsPsr4;
|
||||||
$loader->prefixDirsPsr4 = ComposerStaticInit0b719f9a900fe844677d95a21f1699d1::$prefixDirsPsr4;
|
$loader->prefixDirsPsr4 = ComposerStaticInita0b651f3450034e02afaa1bf3f06ce1f::$prefixDirsPsr4;
|
||||||
$loader->classMap = ComposerStaticInit0b719f9a900fe844677d95a21f1699d1::$classMap;
|
$loader->classMap = ComposerStaticInita0b651f3450034e02afaa1bf3f06ce1f::$classMap;
|
||||||
|
|
||||||
}, null, ClassLoader::class);
|
}, null, ClassLoader::class);
|
||||||
}
|
}
|
||||||
|
|
8
vendor/composer/installed.json
vendored
8
vendor/composer/installed.json
vendored
|
@ -1924,12 +1924,12 @@
|
||||||
"source": {
|
"source": {
|
||||||
"type": "git",
|
"type": "git",
|
||||||
"url": "https:\/\/github.com\/rectorphp\/rector-downgrade-php.git",
|
"url": "https:\/\/github.com\/rectorphp\/rector-downgrade-php.git",
|
||||||
"reference": "86a937c9c1b31ed702070cb39f2ee2d4748f545b"
|
"reference": "76125e6c40eec203e4f0e02dd52ef6c3e18cf0c5"
|
||||||
},
|
},
|
||||||
"dist": {
|
"dist": {
|
||||||
"type": "zip",
|
"type": "zip",
|
||||||
"url": "https:\/\/api.github.com\/repos\/rectorphp\/rector-downgrade-php\/zipball\/86a937c9c1b31ed702070cb39f2ee2d4748f545b",
|
"url": "https:\/\/api.github.com\/repos\/rectorphp\/rector-downgrade-php\/zipball\/76125e6c40eec203e4f0e02dd52ef6c3e18cf0c5",
|
||||||
"reference": "86a937c9c1b31ed702070cb39f2ee2d4748f545b",
|
"reference": "76125e6c40eec203e4f0e02dd52ef6c3e18cf0c5",
|
||||||
"shasum": ""
|
"shasum": ""
|
||||||
},
|
},
|
||||||
"require": {
|
"require": {
|
||||||
|
@ -1953,7 +1953,7 @@
|
||||||
"tomasvotruba\/type-coverage": "^0.0.9",
|
"tomasvotruba\/type-coverage": "^0.0.9",
|
||||||
"tomasvotruba\/unused-public": "^0.0.34"
|
"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,
|
"default-branch": true,
|
||||||
"type": "rector-extension",
|
"type": "rector-extension",
|
||||||
"extra": {
|
"extra": {
|
||||||
|
|
2
vendor/composer/installed.php
vendored
2
vendor/composer/installed.php
vendored
File diff suppressed because one or more lines are too long
|
@ -9,7 +9,7 @@ namespace Rector\RectorInstaller;
|
||||||
*/
|
*/
|
||||||
final class GeneratedConfig
|
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()
|
private function __construct()
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue
Block a user