mirror of
https://github.com/rectorphp/rector.git
synced 2025-01-18 22:08:00 +01:00
Updated Rector to commit 3122f5ec7f47d275de30bfbc44f61607dbc9cc64
3122f5ec7f
[Php71] Remove parent lookup on CountableAnalyzer (#4251)
This commit is contained in:
parent
455a66f4b6
commit
e00ac02415
@ -10,6 +10,7 @@ use PhpParser\Node\Expr\StaticPropertyFetch;
|
||||
use PhpParser\Node\Stmt;
|
||||
use PhpParser\Node\Stmt\ClassLike;
|
||||
use PHPStan\Analyser\Scope;
|
||||
use PHPStan\Reflection\ClassReflection;
|
||||
use PHPStan\Reflection\Php\PhpPropertyReflection;
|
||||
use PHPStan\Reflection\ReflectionProvider;
|
||||
use PHPStan\Type\ArrayType;
|
||||
@ -18,7 +19,8 @@ use PHPStan\Type\Type;
|
||||
use PHPStan\Type\TypeWithClassName;
|
||||
use PHPStan\Type\UnionType;
|
||||
use Rector\Core\NodeAnalyzer\PropertyFetchAnalyzer;
|
||||
use Rector\Core\PhpParser\Node\BetterNodeFinder;
|
||||
use Rector\Core\PhpParser\AstResolver;
|
||||
use Rector\Core\Reflection\ReflectionResolver;
|
||||
use Rector\NodeNameResolver\NodeNameResolver;
|
||||
use Rector\NodeTypeResolver\NodeTypeResolver;
|
||||
use Rector\TypeDeclaration\AlreadyAssignDetector\ConstructorAssignDetector;
|
||||
@ -39,11 +41,6 @@ final class CountableAnalyzer
|
||||
* @var \PHPStan\Reflection\ReflectionProvider
|
||||
*/
|
||||
private $reflectionProvider;
|
||||
/**
|
||||
* @readonly
|
||||
* @var \Rector\Core\PhpParser\Node\BetterNodeFinder
|
||||
*/
|
||||
private $betterNodeFinder;
|
||||
/**
|
||||
* @readonly
|
||||
* @var \Rector\Core\NodeAnalyzer\PropertyFetchAnalyzer
|
||||
@ -54,14 +51,25 @@ final class CountableAnalyzer
|
||||
* @var \Rector\TypeDeclaration\AlreadyAssignDetector\ConstructorAssignDetector
|
||||
*/
|
||||
private $constructorAssignDetector;
|
||||
public function __construct(NodeTypeResolver $nodeTypeResolver, NodeNameResolver $nodeNameResolver, ReflectionProvider $reflectionProvider, BetterNodeFinder $betterNodeFinder, PropertyFetchAnalyzer $propertyFetchAnalyzer, ConstructorAssignDetector $constructorAssignDetector)
|
||||
/**
|
||||
* @readonly
|
||||
* @var \Rector\Core\Reflection\ReflectionResolver
|
||||
*/
|
||||
private $reflectionResolver;
|
||||
/**
|
||||
* @readonly
|
||||
* @var \Rector\Core\PhpParser\AstResolver
|
||||
*/
|
||||
private $astResolver;
|
||||
public function __construct(NodeTypeResolver $nodeTypeResolver, NodeNameResolver $nodeNameResolver, ReflectionProvider $reflectionProvider, PropertyFetchAnalyzer $propertyFetchAnalyzer, ConstructorAssignDetector $constructorAssignDetector, ReflectionResolver $reflectionResolver, AstResolver $astResolver)
|
||||
{
|
||||
$this->nodeTypeResolver = $nodeTypeResolver;
|
||||
$this->nodeNameResolver = $nodeNameResolver;
|
||||
$this->reflectionProvider = $reflectionProvider;
|
||||
$this->betterNodeFinder = $betterNodeFinder;
|
||||
$this->propertyFetchAnalyzer = $propertyFetchAnalyzer;
|
||||
$this->constructorAssignDetector = $constructorAssignDetector;
|
||||
$this->reflectionResolver = $reflectionResolver;
|
||||
$this->astResolver = $astResolver;
|
||||
}
|
||||
public function isCastableArrayType(Expr $expr, ArrayType $arrayType, Scope $scope) : bool
|
||||
{
|
||||
@ -119,11 +127,15 @@ final class CountableAnalyzer
|
||||
if ($nativeType->isIterable()->yes()) {
|
||||
return \true;
|
||||
}
|
||||
$classLike = $this->betterNodeFinder->findParentType($propertyFetch, ClassLike::class);
|
||||
if (!$classLike instanceof ClassLike) {
|
||||
if ($propertyFetch->name instanceof Expr) {
|
||||
return \false;
|
||||
}
|
||||
if ($propertyFetch->name instanceof Expr) {
|
||||
$classReflection = $this->reflectionResolver->resolveClassReflection($propertyFetch);
|
||||
if (!$classReflection instanceof ClassReflection) {
|
||||
return \false;
|
||||
}
|
||||
$classLike = $this->astResolver->resolveClassFromName($classReflection->getName());
|
||||
if (!$classLike instanceof ClassLike) {
|
||||
return \false;
|
||||
}
|
||||
$propertyName = (string) $this->nodeNameResolver->getName($propertyFetch->name);
|
||||
|
@ -19,12 +19,12 @@ final class VersionResolver
|
||||
* @api
|
||||
* @var string
|
||||
*/
|
||||
public const PACKAGE_VERSION = '628260708ccc40d17e1ef2147774170ac030597f';
|
||||
public const PACKAGE_VERSION = '3122f5ec7f47d275de30bfbc44f61607dbc9cc64';
|
||||
/**
|
||||
* @api
|
||||
* @var string
|
||||
*/
|
||||
public const RELEASE_DATE = '2023-06-17 14:41:44';
|
||||
public const RELEASE_DATE = '2023-06-17 16:33:24';
|
||||
/**
|
||||
* @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 ComposerAutoloaderInit6d42e8b0ef15f7135414b7766c2104e1::getLoader();
|
||||
return ComposerAutoloaderInit4d5ad76e5d632208ecd59f21bdd1a624::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 ComposerAutoloaderInit6d42e8b0ef15f7135414b7766c2104e1
|
||||
class ComposerAutoloaderInit4d5ad76e5d632208ecd59f21bdd1a624
|
||||
{
|
||||
private static $loader;
|
||||
|
||||
@ -22,17 +22,17 @@ class ComposerAutoloaderInit6d42e8b0ef15f7135414b7766c2104e1
|
||||
return self::$loader;
|
||||
}
|
||||
|
||||
spl_autoload_register(array('ComposerAutoloaderInit6d42e8b0ef15f7135414b7766c2104e1', 'loadClassLoader'), true, true);
|
||||
spl_autoload_register(array('ComposerAutoloaderInit4d5ad76e5d632208ecd59f21bdd1a624', 'loadClassLoader'), true, true);
|
||||
self::$loader = $loader = new \Composer\Autoload\ClassLoader(\dirname(__DIR__));
|
||||
spl_autoload_unregister(array('ComposerAutoloaderInit6d42e8b0ef15f7135414b7766c2104e1', 'loadClassLoader'));
|
||||
spl_autoload_unregister(array('ComposerAutoloaderInit4d5ad76e5d632208ecd59f21bdd1a624', 'loadClassLoader'));
|
||||
|
||||
require __DIR__ . '/autoload_static.php';
|
||||
call_user_func(\Composer\Autoload\ComposerStaticInit6d42e8b0ef15f7135414b7766c2104e1::getInitializer($loader));
|
||||
call_user_func(\Composer\Autoload\ComposerStaticInit4d5ad76e5d632208ecd59f21bdd1a624::getInitializer($loader));
|
||||
|
||||
$loader->setClassMapAuthoritative(true);
|
||||
$loader->register(true);
|
||||
|
||||
$filesToLoad = \Composer\Autoload\ComposerStaticInit6d42e8b0ef15f7135414b7766c2104e1::$files;
|
||||
$filesToLoad = \Composer\Autoload\ComposerStaticInit4d5ad76e5d632208ecd59f21bdd1a624::$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 ComposerStaticInit6d42e8b0ef15f7135414b7766c2104e1
|
||||
class ComposerStaticInit4d5ad76e5d632208ecd59f21bdd1a624
|
||||
{
|
||||
public static $files = array (
|
||||
'ad155f8f1cf0d418fe49e248db8c661b' => __DIR__ . '/..' . '/react/promise/src/functions_include.php',
|
||||
@ -3094,9 +3094,9 @@ class ComposerStaticInit6d42e8b0ef15f7135414b7766c2104e1
|
||||
public static function getInitializer(ClassLoader $loader)
|
||||
{
|
||||
return \Closure::bind(function () use ($loader) {
|
||||
$loader->prefixLengthsPsr4 = ComposerStaticInit6d42e8b0ef15f7135414b7766c2104e1::$prefixLengthsPsr4;
|
||||
$loader->prefixDirsPsr4 = ComposerStaticInit6d42e8b0ef15f7135414b7766c2104e1::$prefixDirsPsr4;
|
||||
$loader->classMap = ComposerStaticInit6d42e8b0ef15f7135414b7766c2104e1::$classMap;
|
||||
$loader->prefixLengthsPsr4 = ComposerStaticInit4d5ad76e5d632208ecd59f21bdd1a624::$prefixLengthsPsr4;
|
||||
$loader->prefixDirsPsr4 = ComposerStaticInit4d5ad76e5d632208ecd59f21bdd1a624::$prefixDirsPsr4;
|
||||
$loader->classMap = ComposerStaticInit4d5ad76e5d632208ecd59f21bdd1a624::$classMap;
|
||||
|
||||
}, null, ClassLoader::class);
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user