mirror of
https://github.com/rectorphp/rector.git
synced 2025-01-18 22:08:00 +01:00
Updated Rector to commit d036eeb6e6a09eed0286272da58299a90c818675
d036eeb6e6
[TypeDeclaration] Remove parent lookup on AllAssignNodePropertyTypeInferer (#4264)
This commit is contained in:
parent
c363d3ea16
commit
f157e8fdfc
@ -5,8 +5,10 @@ namespace Rector\TypeDeclaration\TypeInferer\PropertyTypeInferer;
|
||||
|
||||
use PhpParser\Node\Stmt\ClassLike;
|
||||
use PhpParser\Node\Stmt\Property;
|
||||
use PHPStan\Reflection\ClassReflection;
|
||||
use PHPStan\Type\Type;
|
||||
use Rector\Core\PhpParser\Node\BetterNodeFinder;
|
||||
use Rector\Core\PhpParser\ClassLikeAstResolver;
|
||||
use Rector\Core\Reflection\ReflectionResolver;
|
||||
use Rector\NodeNameResolver\NodeNameResolver;
|
||||
use Rector\TypeDeclaration\TypeInferer\AssignToPropertyTypeInferer;
|
||||
final class AllAssignNodePropertyTypeInferer
|
||||
@ -23,21 +25,29 @@ final class AllAssignNodePropertyTypeInferer
|
||||
private $nodeNameResolver;
|
||||
/**
|
||||
* @readonly
|
||||
* @var \Rector\Core\PhpParser\Node\BetterNodeFinder
|
||||
* @var \Rector\Core\Reflection\ReflectionResolver
|
||||
*/
|
||||
private $betterNodeFinder;
|
||||
public function __construct(AssignToPropertyTypeInferer $assignToPropertyTypeInferer, NodeNameResolver $nodeNameResolver, BetterNodeFinder $betterNodeFinder)
|
||||
private $reflectionResolver;
|
||||
/**
|
||||
* @readonly
|
||||
* @var \Rector\Core\PhpParser\ClassLikeAstResolver
|
||||
*/
|
||||
private $classLikeAstResolver;
|
||||
public function __construct(AssignToPropertyTypeInferer $assignToPropertyTypeInferer, NodeNameResolver $nodeNameResolver, ReflectionResolver $reflectionResolver, ClassLikeAstResolver $classLikeAstResolver)
|
||||
{
|
||||
$this->assignToPropertyTypeInferer = $assignToPropertyTypeInferer;
|
||||
$this->nodeNameResolver = $nodeNameResolver;
|
||||
$this->betterNodeFinder = $betterNodeFinder;
|
||||
$this->reflectionResolver = $reflectionResolver;
|
||||
$this->classLikeAstResolver = $classLikeAstResolver;
|
||||
}
|
||||
public function inferProperty(Property $property) : ?Type
|
||||
{
|
||||
$classLike = $this->betterNodeFinder->findParentType($property, ClassLike::class);
|
||||
if (!$classLike instanceof ClassLike) {
|
||||
$classReflection = $this->reflectionResolver->resolveClassReflection($property);
|
||||
if (!$classReflection instanceof ClassReflection) {
|
||||
return null;
|
||||
}
|
||||
/** @var ClassLike $classLike */
|
||||
$classLike = $this->classLikeAstResolver->resolveClassFromClassReflection($classReflection);
|
||||
$propertyName = $this->nodeNameResolver->getName($property);
|
||||
return $this->assignToPropertyTypeInferer->inferPropertyInClassLike($property, $propertyName, $classLike);
|
||||
}
|
||||
|
@ -19,12 +19,12 @@ final class VersionResolver
|
||||
* @api
|
||||
* @var string
|
||||
*/
|
||||
public const PACKAGE_VERSION = '5f976fa8c3eccf209e17e16d36fb6eb68c782ab4';
|
||||
public const PACKAGE_VERSION = 'd036eeb6e6a09eed0286272da58299a90c818675';
|
||||
/**
|
||||
* @api
|
||||
* @var string
|
||||
*/
|
||||
public const RELEASE_DATE = '2023-06-18 03:12:56';
|
||||
public const RELEASE_DATE = '2023-06-17 20:32:26';
|
||||
/**
|
||||
* @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';
|
||||
|
||||
return ComposerAutoloaderInit4a8167255d24e2d319fa9c0d2dfb312f::getLoader();
|
||||
return ComposerAutoloaderInit7e306566bd44a4f4eeebccf7abf1230a::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
|
||||
|
||||
class ComposerAutoloaderInit4a8167255d24e2d319fa9c0d2dfb312f
|
||||
class ComposerAutoloaderInit7e306566bd44a4f4eeebccf7abf1230a
|
||||
{
|
||||
private static $loader;
|
||||
|
||||
@ -22,17 +22,17 @@ class ComposerAutoloaderInit4a8167255d24e2d319fa9c0d2dfb312f
|
||||
return self::$loader;
|
||||
}
|
||||
|
||||
spl_autoload_register(array('ComposerAutoloaderInit4a8167255d24e2d319fa9c0d2dfb312f', 'loadClassLoader'), true, true);
|
||||
spl_autoload_register(array('ComposerAutoloaderInit7e306566bd44a4f4eeebccf7abf1230a', 'loadClassLoader'), true, true);
|
||||
self::$loader = $loader = new \Composer\Autoload\ClassLoader(\dirname(__DIR__));
|
||||
spl_autoload_unregister(array('ComposerAutoloaderInit4a8167255d24e2d319fa9c0d2dfb312f', 'loadClassLoader'));
|
||||
spl_autoload_unregister(array('ComposerAutoloaderInit7e306566bd44a4f4eeebccf7abf1230a', 'loadClassLoader'));
|
||||
|
||||
require __DIR__ . '/autoload_static.php';
|
||||
call_user_func(\Composer\Autoload\ComposerStaticInit4a8167255d24e2d319fa9c0d2dfb312f::getInitializer($loader));
|
||||
call_user_func(\Composer\Autoload\ComposerStaticInit7e306566bd44a4f4eeebccf7abf1230a::getInitializer($loader));
|
||||
|
||||
$loader->setClassMapAuthoritative(true);
|
||||
$loader->register(true);
|
||||
|
||||
$filesToLoad = \Composer\Autoload\ComposerStaticInit4a8167255d24e2d319fa9c0d2dfb312f::$files;
|
||||
$filesToLoad = \Composer\Autoload\ComposerStaticInit7e306566bd44a4f4eeebccf7abf1230a::$files;
|
||||
$requireFile = \Closure::bind(static function ($fileIdentifier, $file) {
|
||||
if (empty($GLOBALS['__composer_autoload_files'][$fileIdentifier])) {
|
||||
$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;
|
||||
|
||||
class ComposerStaticInit4a8167255d24e2d319fa9c0d2dfb312f
|
||||
class ComposerStaticInit7e306566bd44a4f4eeebccf7abf1230a
|
||||
{
|
||||
public static $files = array (
|
||||
'ad155f8f1cf0d418fe49e248db8c661b' => __DIR__ . '/..' . '/react/promise/src/functions_include.php',
|
||||
@ -3094,9 +3094,9 @@ class ComposerStaticInit4a8167255d24e2d319fa9c0d2dfb312f
|
||||
public static function getInitializer(ClassLoader $loader)
|
||||
{
|
||||
return \Closure::bind(function () use ($loader) {
|
||||
$loader->prefixLengthsPsr4 = ComposerStaticInit4a8167255d24e2d319fa9c0d2dfb312f::$prefixLengthsPsr4;
|
||||
$loader->prefixDirsPsr4 = ComposerStaticInit4a8167255d24e2d319fa9c0d2dfb312f::$prefixDirsPsr4;
|
||||
$loader->classMap = ComposerStaticInit4a8167255d24e2d319fa9c0d2dfb312f::$classMap;
|
||||
$loader->prefixLengthsPsr4 = ComposerStaticInit7e306566bd44a4f4eeebccf7abf1230a::$prefixLengthsPsr4;
|
||||
$loader->prefixDirsPsr4 = ComposerStaticInit7e306566bd44a4f4eeebccf7abf1230a::$prefixDirsPsr4;
|
||||
$loader->classMap = ComposerStaticInit7e306566bd44a4f4eeebccf7abf1230a::$classMap;
|
||||
|
||||
}, null, ClassLoader::class);
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user