mirror of
https://github.com/rectorphp/rector.git
synced 2025-04-04 07:32:39 +02:00
Updated Rector to commit 3d165eb8ef551c6a3912bc664f5255ee572b3235
3d165eb8ef
[NodeTypeResolver] Remove unneded ReflectionProvider usage on StaticCallMethodCallTypeResolver (#4372)
This commit is contained in:
parent
a890ca90e8
commit
ebbf202379
packages/NodeTypeResolver/NodeTypeResolver
src/Application
vendor
@ -7,8 +7,8 @@ use PhpParser\Node;
|
||||
use PhpParser\Node\Expr\MethodCall;
|
||||
use PhpParser\Node\Expr\StaticCall;
|
||||
use PHPStan\Analyser\Scope;
|
||||
use PHPStan\Reflection\ClassReflection;
|
||||
use PHPStan\Reflection\Php\PhpMethodReflection;
|
||||
use PHPStan\Reflection\ReflectionProvider;
|
||||
use PHPStan\Type\MixedType;
|
||||
use PHPStan\Type\Type;
|
||||
use Rector\NodeNameResolver\NodeNameResolver;
|
||||
@ -27,19 +27,13 @@ final class StaticCallMethodCallTypeResolver implements NodeTypeResolverInterfac
|
||||
* @var \Rector\NodeNameResolver\NodeNameResolver
|
||||
*/
|
||||
private $nodeNameResolver;
|
||||
/**
|
||||
* @readonly
|
||||
* @var \PHPStan\Reflection\ReflectionProvider
|
||||
*/
|
||||
private $reflectionProvider;
|
||||
/**
|
||||
* @var \Rector\NodeTypeResolver\NodeTypeResolver
|
||||
*/
|
||||
private $nodeTypeResolver;
|
||||
public function __construct(NodeNameResolver $nodeNameResolver, ReflectionProvider $reflectionProvider)
|
||||
public function __construct(NodeNameResolver $nodeNameResolver)
|
||||
{
|
||||
$this->nodeNameResolver = $nodeNameResolver;
|
||||
$this->reflectionProvider = $reflectionProvider;
|
||||
}
|
||||
/**
|
||||
* @required
|
||||
@ -78,8 +72,8 @@ final class StaticCallMethodCallTypeResolver implements NodeTypeResolverInterfac
|
||||
} else {
|
||||
$callerType = $this->nodeTypeResolver->getType($node->class);
|
||||
}
|
||||
foreach ($callerType->getReferencedClasses() as $referencedClass) {
|
||||
$classMethodReturnType = $this->resolveClassMethodReturnType($referencedClass, $node, $methodName, $scope);
|
||||
foreach ($callerType->getObjectClassReflections() as $classReflection) {
|
||||
$classMethodReturnType = $this->resolveClassMethodReturnType($classReflection, $node, $methodName, $scope);
|
||||
if (!$classMethodReturnType instanceof MixedType) {
|
||||
return $classMethodReturnType;
|
||||
}
|
||||
@ -89,12 +83,8 @@ final class StaticCallMethodCallTypeResolver implements NodeTypeResolverInterfac
|
||||
/**
|
||||
* @param \PhpParser\Node\Expr\StaticCall|\PhpParser\Node\Expr\MethodCall $node
|
||||
*/
|
||||
private function resolveClassMethodReturnType(string $referencedClass, $node, string $methodName, Scope $scope) : Type
|
||||
private function resolveClassMethodReturnType(ClassReflection $classReflection, $node, string $methodName, Scope $scope) : Type
|
||||
{
|
||||
if (!$this->reflectionProvider->hasClass($referencedClass)) {
|
||||
return new MixedType();
|
||||
}
|
||||
$classReflection = $this->reflectionProvider->getClass($referencedClass);
|
||||
foreach ($classReflection->getAncestors() as $ancestorClassReflection) {
|
||||
if (!$ancestorClassReflection->hasMethod($methodName)) {
|
||||
continue;
|
||||
|
@ -19,12 +19,12 @@ final class VersionResolver
|
||||
* @api
|
||||
* @var string
|
||||
*/
|
||||
public const PACKAGE_VERSION = '7ee89b326702a0b51e3165fc478615834de50fe1';
|
||||
public const PACKAGE_VERSION = '3d165eb8ef551c6a3912bc664f5255ee572b3235';
|
||||
/**
|
||||
* @api
|
||||
* @var string
|
||||
*/
|
||||
public const RELEASE_DATE = '2023-06-28 23:11:18';
|
||||
public const RELEASE_DATE = '2023-06-29 00:00:16';
|
||||
/**
|
||||
* @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 ComposerAutoloaderInit9f6c5876faf703862369649ae70309a3::getLoader();
|
||||
return ComposerAutoloaderInitf133d4f5a8838c5c2354cbb64e7a1020::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 ComposerAutoloaderInit9f6c5876faf703862369649ae70309a3
|
||||
class ComposerAutoloaderInitf133d4f5a8838c5c2354cbb64e7a1020
|
||||
{
|
||||
private static $loader;
|
||||
|
||||
@ -22,17 +22,17 @@ class ComposerAutoloaderInit9f6c5876faf703862369649ae70309a3
|
||||
return self::$loader;
|
||||
}
|
||||
|
||||
spl_autoload_register(array('ComposerAutoloaderInit9f6c5876faf703862369649ae70309a3', 'loadClassLoader'), true, true);
|
||||
spl_autoload_register(array('ComposerAutoloaderInitf133d4f5a8838c5c2354cbb64e7a1020', 'loadClassLoader'), true, true);
|
||||
self::$loader = $loader = new \Composer\Autoload\ClassLoader(\dirname(__DIR__));
|
||||
spl_autoload_unregister(array('ComposerAutoloaderInit9f6c5876faf703862369649ae70309a3', 'loadClassLoader'));
|
||||
spl_autoload_unregister(array('ComposerAutoloaderInitf133d4f5a8838c5c2354cbb64e7a1020', 'loadClassLoader'));
|
||||
|
||||
require __DIR__ . '/autoload_static.php';
|
||||
call_user_func(\Composer\Autoload\ComposerStaticInit9f6c5876faf703862369649ae70309a3::getInitializer($loader));
|
||||
call_user_func(\Composer\Autoload\ComposerStaticInitf133d4f5a8838c5c2354cbb64e7a1020::getInitializer($loader));
|
||||
|
||||
$loader->setClassMapAuthoritative(true);
|
||||
$loader->register(true);
|
||||
|
||||
$filesToLoad = \Composer\Autoload\ComposerStaticInit9f6c5876faf703862369649ae70309a3::$files;
|
||||
$filesToLoad = \Composer\Autoload\ComposerStaticInitf133d4f5a8838c5c2354cbb64e7a1020::$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 ComposerStaticInit9f6c5876faf703862369649ae70309a3
|
||||
class ComposerStaticInitf133d4f5a8838c5c2354cbb64e7a1020
|
||||
{
|
||||
public static $files = array (
|
||||
'ad155f8f1cf0d418fe49e248db8c661b' => __DIR__ . '/..' . '/react/promise/src/functions_include.php',
|
||||
@ -3098,9 +3098,9 @@ class ComposerStaticInit9f6c5876faf703862369649ae70309a3
|
||||
public static function getInitializer(ClassLoader $loader)
|
||||
{
|
||||
return \Closure::bind(function () use ($loader) {
|
||||
$loader->prefixLengthsPsr4 = ComposerStaticInit9f6c5876faf703862369649ae70309a3::$prefixLengthsPsr4;
|
||||
$loader->prefixDirsPsr4 = ComposerStaticInit9f6c5876faf703862369649ae70309a3::$prefixDirsPsr4;
|
||||
$loader->classMap = ComposerStaticInit9f6c5876faf703862369649ae70309a3::$classMap;
|
||||
$loader->prefixLengthsPsr4 = ComposerStaticInitf133d4f5a8838c5c2354cbb64e7a1020::$prefixLengthsPsr4;
|
||||
$loader->prefixDirsPsr4 = ComposerStaticInitf133d4f5a8838c5c2354cbb64e7a1020::$prefixDirsPsr4;
|
||||
$loader->classMap = ComposerStaticInitf133d4f5a8838c5c2354cbb64e7a1020::$classMap;
|
||||
|
||||
}, null, ClassLoader::class);
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user