Updated Rector to commit 09148f1362885429bd766199425c510d6a2629d3

09148f1362 [StaticTypeMapper] Remove #[Required] on UnionTypeNodeMapper (#4689)
This commit is contained in:
Tomas Votruba 2023-08-07 03:37:55 +00:00
parent 9fac241be1
commit 76dd6da79d
5 changed files with 51 additions and 25 deletions

View File

@ -4,12 +4,13 @@ declare (strict_types=1);
namespace Rector\StaticTypeMapper\PhpParser;
use PhpParser\Node;
use PhpParser\Node\Identifier;
use PhpParser\Node\Name;
use PhpParser\Node\Name\FullyQualified;
use PhpParser\Node\UnionType;
use PHPStan\Type\Type;
use Rector\NodeTypeResolver\PHPStan\Type\TypeFactory;
use Rector\StaticTypeMapper\Contract\PhpParser\PhpParserNodeMapperInterface;
use Rector\StaticTypeMapper\Mapper\PhpParserNodeMapper;
use RectorPrefix202308\Symfony\Contracts\Service\Attribute\Required;
/**
* @implements PhpParserNodeMapperInterface<UnionType>
*/
@ -21,19 +22,32 @@ final class UnionTypeNodeMapper implements PhpParserNodeMapperInterface
*/
private $typeFactory;
/**
* @var \Rector\StaticTypeMapper\Mapper\PhpParserNodeMapper
* @readonly
* @var \Rector\StaticTypeMapper\PhpParser\FullyQualifiedNodeMapper
*/
private $phpParserNodeMapper;
public function __construct(TypeFactory $typeFactory)
private $fullyQualifiedNodeMapper;
/**
* @readonly
* @var \Rector\StaticTypeMapper\PhpParser\NameNodeMapper
*/
private $nameNodeMapper;
/**
* @readonly
* @var \Rector\StaticTypeMapper\PhpParser\IdentifierNodeMapper
*/
private $identifierNodeMapper;
/**
* @readonly
* @var \Rector\StaticTypeMapper\PhpParser\IntersectionTypeNodeMapper
*/
private $intersectionTypeNodeMapper;
public function __construct(TypeFactory $typeFactory, \Rector\StaticTypeMapper\PhpParser\FullyQualifiedNodeMapper $fullyQualifiedNodeMapper, \Rector\StaticTypeMapper\PhpParser\NameNodeMapper $nameNodeMapper, \Rector\StaticTypeMapper\PhpParser\IdentifierNodeMapper $identifierNodeMapper, \Rector\StaticTypeMapper\PhpParser\IntersectionTypeNodeMapper $intersectionTypeNodeMapper)
{
$this->typeFactory = $typeFactory;
}
/**
* @required
*/
public function autowire(PhpParserNodeMapper $phpParserNodeMapper) : void
{
$this->phpParserNodeMapper = $phpParserNodeMapper;
$this->fullyQualifiedNodeMapper = $fullyQualifiedNodeMapper;
$this->nameNodeMapper = $nameNodeMapper;
$this->identifierNodeMapper = $identifierNodeMapper;
$this->intersectionTypeNodeMapper = $intersectionTypeNodeMapper;
}
public function getNodeType() : string
{
@ -46,7 +60,19 @@ final class UnionTypeNodeMapper implements PhpParserNodeMapperInterface
{
$types = [];
foreach ($node->types as $unionedType) {
$types[] = $this->phpParserNodeMapper->mapToPHPStanType($unionedType);
if ($unionedType instanceof FullyQualified) {
$types[] = $this->fullyQualifiedNodeMapper->mapToPHPStan($unionedType);
continue;
}
if ($unionedType instanceof Name) {
$types[] = $this->nameNodeMapper->mapToPHPStan($unionedType);
continue;
}
if ($unionedType instanceof Identifier) {
$types[] = $this->identifierNodeMapper->mapToPHPStan($unionedType);
continue;
}
$types[] = $this->intersectionTypeNodeMapper->mapToPHPStan($unionedType);
}
return $this->typeFactory->createMixedPassedOrUnionType($types, \true);
}

View File

@ -19,12 +19,12 @@ final class VersionResolver
* @api
* @var string
*/
public const PACKAGE_VERSION = 'e9a97469558e5e154a185bae388f214e1f0d5c56';
public const PACKAGE_VERSION = '09148f1362885429bd766199425c510d6a2629d3';
/**
* @api
* @var string
*/
public const RELEASE_DATE = '2023-08-07 10:23:22';
public const RELEASE_DATE = '2023-08-07 10:34:09';
/**
* @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 ComposerAutoloaderInit7b9ebafad62d778c7997530cbc2e2992::getLoader();
return ComposerAutoloaderInitd82ebde5b09672b50020c0e958d9064e::getLoader();

View File

@ -2,7 +2,7 @@
// autoload_real.php @generated by Composer
class ComposerAutoloaderInit7b9ebafad62d778c7997530cbc2e2992
class ComposerAutoloaderInitd82ebde5b09672b50020c0e958d9064e
{
private static $loader;
@ -22,17 +22,17 @@ class ComposerAutoloaderInit7b9ebafad62d778c7997530cbc2e2992
return self::$loader;
}
spl_autoload_register(array('ComposerAutoloaderInit7b9ebafad62d778c7997530cbc2e2992', 'loadClassLoader'), true, true);
spl_autoload_register(array('ComposerAutoloaderInitd82ebde5b09672b50020c0e958d9064e', 'loadClassLoader'), true, true);
self::$loader = $loader = new \Composer\Autoload\ClassLoader(\dirname(__DIR__));
spl_autoload_unregister(array('ComposerAutoloaderInit7b9ebafad62d778c7997530cbc2e2992', 'loadClassLoader'));
spl_autoload_unregister(array('ComposerAutoloaderInitd82ebde5b09672b50020c0e958d9064e', 'loadClassLoader'));
require __DIR__ . '/autoload_static.php';
call_user_func(\Composer\Autoload\ComposerStaticInit7b9ebafad62d778c7997530cbc2e2992::getInitializer($loader));
call_user_func(\Composer\Autoload\ComposerStaticInitd82ebde5b09672b50020c0e958d9064e::getInitializer($loader));
$loader->setClassMapAuthoritative(true);
$loader->register(true);
$filesToLoad = \Composer\Autoload\ComposerStaticInit7b9ebafad62d778c7997530cbc2e2992::$files;
$filesToLoad = \Composer\Autoload\ComposerStaticInitd82ebde5b09672b50020c0e958d9064e::$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 ComposerStaticInit7b9ebafad62d778c7997530cbc2e2992
class ComposerStaticInitd82ebde5b09672b50020c0e958d9064e
{
public static $files = array (
'ad155f8f1cf0d418fe49e248db8c661b' => __DIR__ . '/..' . '/react/promise/src/functions_include.php',
@ -3010,9 +3010,9 @@ class ComposerStaticInit7b9ebafad62d778c7997530cbc2e2992
public static function getInitializer(ClassLoader $loader)
{
return \Closure::bind(function () use ($loader) {
$loader->prefixLengthsPsr4 = ComposerStaticInit7b9ebafad62d778c7997530cbc2e2992::$prefixLengthsPsr4;
$loader->prefixDirsPsr4 = ComposerStaticInit7b9ebafad62d778c7997530cbc2e2992::$prefixDirsPsr4;
$loader->classMap = ComposerStaticInit7b9ebafad62d778c7997530cbc2e2992::$classMap;
$loader->prefixLengthsPsr4 = ComposerStaticInitd82ebde5b09672b50020c0e958d9064e::$prefixLengthsPsr4;
$loader->prefixDirsPsr4 = ComposerStaticInitd82ebde5b09672b50020c0e958d9064e::$prefixDirsPsr4;
$loader->classMap = ComposerStaticInitd82ebde5b09672b50020c0e958d9064e::$classMap;
}, null, ClassLoader::class);
}