Updated Rector to commit b99b82abd47885409542fd867546a0e301e45400

b99b82abd4 [NodeTypeResolver] Remove autowire on ClassMethodOrClassConstTypeResolver (#4361)
This commit is contained in:
Tomas Votruba 2023-06-27 08:00:20 +00:00
parent a6ecff6865
commit 88bf1e0a97
5 changed files with 20 additions and 26 deletions

View File

@ -6,29 +6,18 @@ namespace Rector\NodeTypeResolver\NodeTypeResolver;
use PhpParser\Node;
use PhpParser\Node\Stmt\ClassConst;
use PhpParser\Node\Stmt\ClassMethod;
use PHPStan\Analyser\Scope;
use PHPStan\Reflection\ClassReflection;
use PHPStan\Type\ObjectType;
use PHPStan\Type\ObjectWithoutClassType;
use PHPStan\Type\Type;
use Rector\Core\Reflection\ReflectionResolver;
use Rector\NodeTypeResolver\Contract\NodeTypeResolverInterface;
use RectorPrefix202306\Symfony\Contracts\Service\Attribute\Required;
use Rector\NodeTypeResolver\Node\AttributeKey;
/**
* @implements NodeTypeResolverInterface<ClassMethod|ClassConst>
*/
final class ClassMethodOrClassConstTypeResolver implements NodeTypeResolverInterface
{
/**
* @var \Rector\Core\Reflection\ReflectionResolver
*/
private $reflectionResolver;
/**
* @required
*/
public function autowire(ReflectionResolver $reflectionResolver) : void
{
$this->reflectionResolver = $reflectionResolver;
}
/**
* @return array<class-string<Node>>
*/
@ -41,7 +30,12 @@ final class ClassMethodOrClassConstTypeResolver implements NodeTypeResolverInter
*/
public function resolve(Node $node) : Type
{
$classReflection = $this->reflectionResolver->resolveClassReflection($node);
$scope = $node->getAttribute(AttributeKey::SCOPE);
if (!$scope instanceof Scope) {
// anonymous class
return new ObjectWithoutClassType();
}
$classReflection = $scope->getClassReflection();
if (!$classReflection instanceof ClassReflection || $classReflection->isAnonymous()) {
// anonymous class
return new ObjectWithoutClassType();

View File

@ -19,12 +19,12 @@ final class VersionResolver
* @api
* @var string
*/
public const PACKAGE_VERSION = 'f1b74a41f07d1d8a30cf9b3e88380fc8614d80e9';
public const PACKAGE_VERSION = 'b99b82abd47885409542fd867546a0e301e45400';
/**
* @api
* @var string
*/
public const RELEASE_DATE = '2023-06-27 14:42:43';
public const RELEASE_DATE = '2023-06-27 14:55:25';
/**
* @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';
return ComposerAutoloaderInitcdd6c94178448b7635568178dab85738::getLoader();
return ComposerAutoloaderInitb0827cf52ae98d0aa5dbd8dd1ffb4c7c::getLoader();

View File

@ -2,7 +2,7 @@
// autoload_real.php @generated by Composer
class ComposerAutoloaderInitcdd6c94178448b7635568178dab85738
class ComposerAutoloaderInitb0827cf52ae98d0aa5dbd8dd1ffb4c7c
{
private static $loader;
@ -22,17 +22,17 @@ class ComposerAutoloaderInitcdd6c94178448b7635568178dab85738
return self::$loader;
}
spl_autoload_register(array('ComposerAutoloaderInitcdd6c94178448b7635568178dab85738', 'loadClassLoader'), true, true);
spl_autoload_register(array('ComposerAutoloaderInitb0827cf52ae98d0aa5dbd8dd1ffb4c7c', 'loadClassLoader'), true, true);
self::$loader = $loader = new \Composer\Autoload\ClassLoader(\dirname(__DIR__));
spl_autoload_unregister(array('ComposerAutoloaderInitcdd6c94178448b7635568178dab85738', 'loadClassLoader'));
spl_autoload_unregister(array('ComposerAutoloaderInitb0827cf52ae98d0aa5dbd8dd1ffb4c7c', 'loadClassLoader'));
require __DIR__ . '/autoload_static.php';
call_user_func(\Composer\Autoload\ComposerStaticInitcdd6c94178448b7635568178dab85738::getInitializer($loader));
call_user_func(\Composer\Autoload\ComposerStaticInitb0827cf52ae98d0aa5dbd8dd1ffb4c7c::getInitializer($loader));
$loader->setClassMapAuthoritative(true);
$loader->register(true);
$filesToLoad = \Composer\Autoload\ComposerStaticInitcdd6c94178448b7635568178dab85738::$files;
$filesToLoad = \Composer\Autoload\ComposerStaticInitb0827cf52ae98d0aa5dbd8dd1ffb4c7c::$files;
$requireFile = \Closure::bind(static function ($fileIdentifier, $file) {
if (empty($GLOBALS['__composer_autoload_files'][$fileIdentifier])) {
$GLOBALS['__composer_autoload_files'][$fileIdentifier] = true;

View File

@ -4,7 +4,7 @@
namespace Composer\Autoload;
class ComposerStaticInitcdd6c94178448b7635568178dab85738
class ComposerStaticInitb0827cf52ae98d0aa5dbd8dd1ffb4c7c
{
public static $files = array (
'ad155f8f1cf0d418fe49e248db8c661b' => __DIR__ . '/..' . '/react/promise/src/functions_include.php',
@ -3098,9 +3098,9 @@ class ComposerStaticInitcdd6c94178448b7635568178dab85738
public static function getInitializer(ClassLoader $loader)
{
return \Closure::bind(function () use ($loader) {
$loader->prefixLengthsPsr4 = ComposerStaticInitcdd6c94178448b7635568178dab85738::$prefixLengthsPsr4;
$loader->prefixDirsPsr4 = ComposerStaticInitcdd6c94178448b7635568178dab85738::$prefixDirsPsr4;
$loader->classMap = ComposerStaticInitcdd6c94178448b7635568178dab85738::$classMap;
$loader->prefixLengthsPsr4 = ComposerStaticInitb0827cf52ae98d0aa5dbd8dd1ffb4c7c::$prefixLengthsPsr4;
$loader->prefixDirsPsr4 = ComposerStaticInitb0827cf52ae98d0aa5dbd8dd1ffb4c7c::$prefixDirsPsr4;
$loader->classMap = ComposerStaticInitb0827cf52ae98d0aa5dbd8dd1ffb4c7c::$classMap;
}, null, ClassLoader::class);
}