Updated Rector to commit 3450bed50204db27ca622d2056a82580a59914fb

3450bed502 [TypeDeclaration] Skip used by trait on PropertyTypeFromStrictSetterGetterRector (#3319)
This commit is contained in:
Tomas Votruba 2023-01-29 12:28:42 +00:00
parent 6d10127c95
commit 9dda9c3cc2
5 changed files with 23 additions and 13 deletions

View File

@ -9,6 +9,7 @@ use PhpParser\Node\Stmt\Property;
use PHPStan\Type\Type; use PHPStan\Type\Type;
use Rector\Core\Rector\AbstractRector; use Rector\Core\Rector\AbstractRector;
use Rector\Core\ValueObject\PhpVersionFeature; use Rector\Core\ValueObject\PhpVersionFeature;
use Rector\Php74\Guard\MakePropertyTypedGuard;
use Rector\PHPStanStaticTypeMapper\Enum\TypeKind; use Rector\PHPStanStaticTypeMapper\Enum\TypeKind;
use Rector\TypeDeclaration\TypeInferer\PropertyTypeInferer\GetterTypeDeclarationPropertyTypeInferer; use Rector\TypeDeclaration\TypeInferer\PropertyTypeInferer\GetterTypeDeclarationPropertyTypeInferer;
use Rector\TypeDeclaration\TypeInferer\PropertyTypeInferer\SetterTypeDeclarationPropertyTypeInferer; use Rector\TypeDeclaration\TypeInferer\PropertyTypeInferer\SetterTypeDeclarationPropertyTypeInferer;
@ -30,10 +31,16 @@ final class PropertyTypeFromStrictSetterGetterRector extends AbstractRector impl
* @var \Rector\TypeDeclaration\TypeInferer\PropertyTypeInferer\SetterTypeDeclarationPropertyTypeInferer * @var \Rector\TypeDeclaration\TypeInferer\PropertyTypeInferer\SetterTypeDeclarationPropertyTypeInferer
*/ */
private $setterTypeDeclarationPropertyTypeInferer; private $setterTypeDeclarationPropertyTypeInferer;
public function __construct(GetterTypeDeclarationPropertyTypeInferer $getterTypeDeclarationPropertyTypeInferer, SetterTypeDeclarationPropertyTypeInferer $setterTypeDeclarationPropertyTypeInferer) /**
* @readonly
* @var \Rector\Php74\Guard\MakePropertyTypedGuard
*/
private $makePropertyTypedGuard;
public function __construct(GetterTypeDeclarationPropertyTypeInferer $getterTypeDeclarationPropertyTypeInferer, SetterTypeDeclarationPropertyTypeInferer $setterTypeDeclarationPropertyTypeInferer, MakePropertyTypedGuard $makePropertyTypedGuard)
{ {
$this->getterTypeDeclarationPropertyTypeInferer = $getterTypeDeclarationPropertyTypeInferer; $this->getterTypeDeclarationPropertyTypeInferer = $getterTypeDeclarationPropertyTypeInferer;
$this->setterTypeDeclarationPropertyTypeInferer = $setterTypeDeclarationPropertyTypeInferer; $this->setterTypeDeclarationPropertyTypeInferer = $setterTypeDeclarationPropertyTypeInferer;
$this->makePropertyTypedGuard = $makePropertyTypedGuard;
} }
public function getRuleDefinition() : RuleDefinition public function getRuleDefinition() : RuleDefinition
{ {
@ -98,6 +105,9 @@ CODE_SAMPLE
if (!$this->isDefaultExprTypeCompatible($property, $getterSetterPropertyType)) { if (!$this->isDefaultExprTypeCompatible($property, $getterSetterPropertyType)) {
continue; continue;
} }
if (!$this->makePropertyTypedGuard->isLegal($property, \false)) {
continue;
}
$propertyTypeDclaration = $this->staticTypeMapper->mapPHPStanTypeToPhpParserNode($getterSetterPropertyType, TypeKind::PROPERTY); $propertyTypeDclaration = $this->staticTypeMapper->mapPHPStanTypeToPhpParserNode($getterSetterPropertyType, TypeKind::PROPERTY);
if (!$propertyTypeDclaration instanceof Node) { if (!$propertyTypeDclaration instanceof Node) {
continue; continue;

View File

@ -19,12 +19,12 @@ final class VersionResolver
* @api * @api
* @var string * @var string
*/ */
public const PACKAGE_VERSION = 'b98de3edc21312c2e5483b6a120ccb04642f5346'; public const PACKAGE_VERSION = '3450bed50204db27ca622d2056a82580a59914fb';
/** /**
* @api * @api
* @var string * @var string
*/ */
public const RELEASE_DATE = '2023-01-29 09:48:08'; public const RELEASE_DATE = '2023-01-29 12:24:32';
/** /**
* @var int * @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'; require_once __DIR__ . '/composer/autoload_real.php';
return ComposerAutoloaderInit8a543a3b9236ca4cd183a82b04f2636b::getLoader(); return ComposerAutoloaderInit237f60ed8c00a6a6ce0e2d6d91af6957::getLoader();

View File

@ -2,7 +2,7 @@
// autoload_real.php @generated by Composer // autoload_real.php @generated by Composer
class ComposerAutoloaderInit8a543a3b9236ca4cd183a82b04f2636b class ComposerAutoloaderInit237f60ed8c00a6a6ce0e2d6d91af6957
{ {
private static $loader; private static $loader;
@ -22,17 +22,17 @@ class ComposerAutoloaderInit8a543a3b9236ca4cd183a82b04f2636b
return self::$loader; return self::$loader;
} }
spl_autoload_register(array('ComposerAutoloaderInit8a543a3b9236ca4cd183a82b04f2636b', 'loadClassLoader'), true, true); spl_autoload_register(array('ComposerAutoloaderInit237f60ed8c00a6a6ce0e2d6d91af6957', '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('ComposerAutoloaderInit8a543a3b9236ca4cd183a82b04f2636b', 'loadClassLoader')); spl_autoload_unregister(array('ComposerAutoloaderInit237f60ed8c00a6a6ce0e2d6d91af6957', 'loadClassLoader'));
require __DIR__ . '/autoload_static.php'; require __DIR__ . '/autoload_static.php';
call_user_func(\Composer\Autoload\ComposerStaticInit8a543a3b9236ca4cd183a82b04f2636b::getInitializer($loader)); call_user_func(\Composer\Autoload\ComposerStaticInit237f60ed8c00a6a6ce0e2d6d91af6957::getInitializer($loader));
$loader->setClassMapAuthoritative(true); $loader->setClassMapAuthoritative(true);
$loader->register(true); $loader->register(true);
$filesToLoad = \Composer\Autoload\ComposerStaticInit8a543a3b9236ca4cd183a82b04f2636b::$files; $filesToLoad = \Composer\Autoload\ComposerStaticInit237f60ed8c00a6a6ce0e2d6d91af6957::$files;
$requireFile = static function ($fileIdentifier, $file) { $requireFile = 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;

View File

@ -4,7 +4,7 @@
namespace Composer\Autoload; namespace Composer\Autoload;
class ComposerStaticInit8a543a3b9236ca4cd183a82b04f2636b class ComposerStaticInit237f60ed8c00a6a6ce0e2d6d91af6957
{ {
public static $files = array ( public static $files = array (
'ad155f8f1cf0d418fe49e248db8c661b' => __DIR__ . '/..' . '/react/promise/src/functions_include.php', 'ad155f8f1cf0d418fe49e248db8c661b' => __DIR__ . '/..' . '/react/promise/src/functions_include.php',
@ -3080,9 +3080,9 @@ class ComposerStaticInit8a543a3b9236ca4cd183a82b04f2636b
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 = ComposerStaticInit8a543a3b9236ca4cd183a82b04f2636b::$prefixLengthsPsr4; $loader->prefixLengthsPsr4 = ComposerStaticInit237f60ed8c00a6a6ce0e2d6d91af6957::$prefixLengthsPsr4;
$loader->prefixDirsPsr4 = ComposerStaticInit8a543a3b9236ca4cd183a82b04f2636b::$prefixDirsPsr4; $loader->prefixDirsPsr4 = ComposerStaticInit237f60ed8c00a6a6ce0e2d6d91af6957::$prefixDirsPsr4;
$loader->classMap = ComposerStaticInit8a543a3b9236ca4cd183a82b04f2636b::$classMap; $loader->classMap = ComposerStaticInit237f60ed8c00a6a6ce0e2d6d91af6957::$classMap;
}, null, ClassLoader::class); }, null, ClassLoader::class);
} }