Skip to content

Commit

Permalink
Updated Rector to commit 3d165eb8ef551c6a3912bc664f5255ee572b3235
Browse files Browse the repository at this point in the history
rectorphp/rector-src@3d165eb [NodeTypeResolver] Remove unneded ReflectionProvider usage on StaticCallMethodCallTypeResolver (#4372)
  • Loading branch information
TomasVotruba committed Jun 28, 2023
1 parent a890ca9 commit ebbf202
Show file tree
Hide file tree
Showing 5 changed files with 17 additions and 27 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,8 @@
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;
Expand All @@ -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
Expand Down Expand Up @@ -78,8 +72,8 @@ public function resolve(Node $node) : Type
} 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;
}
Expand All @@ -89,12 +83,8 @@ public function resolve(Node $node) : Type
/**
* @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;
Expand Down
4 changes: 2 additions & 2 deletions src/Application/VersionResolver.php
Original file line number Diff line number Diff line change
Expand Up @@ -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
*/
Expand Down
2 changes: 1 addition & 1 deletion vendor/autoload.php
Original file line number Diff line number Diff line change
Expand Up @@ -22,4 +22,4 @@

require_once __DIR__ . '/composer/autoload_real.php';

return ComposerAutoloaderInit9f6c5876faf703862369649ae70309a3::getLoader();
return ComposerAutoloaderInitf133d4f5a8838c5c2354cbb64e7a1020::getLoader();
10 changes: 5 additions & 5 deletions vendor/composer/autoload_real.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

// autoload_real.php @generated by Composer

class ComposerAutoloaderInit9f6c5876faf703862369649ae70309a3
class ComposerAutoloaderInitf133d4f5a8838c5c2354cbb64e7a1020
{
private static $loader;

Expand All @@ -22,17 +22,17 @@ public static function getLoader()
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;
Expand Down
8 changes: 4 additions & 4 deletions vendor/composer/autoload_static.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@

namespace Composer\Autoload;

class ComposerStaticInit9f6c5876faf703862369649ae70309a3
class ComposerStaticInitf133d4f5a8838c5c2354cbb64e7a1020
{
public static $files = array (
'ad155f8f1cf0d418fe49e248db8c661b' => __DIR__ . '/..' . '/react/promise/src/functions_include.php',
Expand Down Expand Up @@ -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);
}
Expand Down

0 comments on commit ebbf202

Please sign in to comment.