Skip to content

Commit

Permalink
Updated Rector to commit 2afa47cd68086b61cb2363bcfb5553eb8767b50c
Browse files Browse the repository at this point in the history
rectorphp/rector-src@2afa47c [StaticTypeMapper] Remove standalone false handling on StaticTypeMapper (#4582)
  • Loading branch information
TomasVotruba committed Jul 23, 2023
1 parent f955a2d commit 6ce5f37
Show file tree
Hide file tree
Showing 5 changed files with 14 additions and 42 deletions.
32 changes: 2 additions & 30 deletions packages/StaticTypeMapper/StaticTypeMapper.php
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@
use PhpParser\Node\ComplexType;
use PhpParser\Node\Identifier;
use PhpParser\Node\Name;
use PhpParser\Node\UnionType;
use PHPStan\PhpDocParser\Ast\PhpDoc\ParamTagValueNode;
use PHPStan\PhpDocParser\Ast\PhpDoc\PhpDocTagValueNode;
use PHPStan\PhpDocParser\Ast\PhpDoc\ReturnTagValueNode;
Expand All @@ -18,7 +17,6 @@
use PHPStan\Type\MixedType;
use PHPStan\Type\Type;
use Rector\Core\Exception\NotImplementedYetException;
use Rector\NodeNameResolver\NodeNameResolver;
use Rector\PHPStanStaticTypeMapper\Enum\TypeKind;
use Rector\PHPStanStaticTypeMapper\PHPStanStaticTypeMapper;
use Rector\StaticTypeMapper\Mapper\PhpParserNodeMapper;
Expand Down Expand Up @@ -50,22 +48,12 @@ final class StaticTypeMapper
* @var \Rector\StaticTypeMapper\Mapper\PhpParserNodeMapper
*/
private $phpParserNodeMapper;
/**
* @readonly
* @var \Rector\NodeNameResolver\NodeNameResolver
*/
private $nodeNameResolver;
/**
* @var array<string, string>
*/
private const STANDALONE_MAPS = ['false' => 'bool'];
public function __construct(NameScopeFactory $nameScopeFactory, PHPStanStaticTypeMapper $phpStanStaticTypeMapper, PhpDocTypeMapper $phpDocTypeMapper, PhpParserNodeMapper $phpParserNodeMapper, NodeNameResolver $nodeNameResolver)
public function __construct(NameScopeFactory $nameScopeFactory, PHPStanStaticTypeMapper $phpStanStaticTypeMapper, PhpDocTypeMapper $phpDocTypeMapper, PhpParserNodeMapper $phpParserNodeMapper)
{
$this->nameScopeFactory = $nameScopeFactory;
$this->phpStanStaticTypeMapper = $phpStanStaticTypeMapper;
$this->phpDocTypeMapper = $phpDocTypeMapper;
$this->phpParserNodeMapper = $phpParserNodeMapper;
$this->nodeNameResolver = $nodeNameResolver;
}
public function mapPHPStanTypeToPHPStanPhpDocTypeNode(Type $phpStanType) : TypeNode
{
Expand All @@ -77,23 +65,7 @@ public function mapPHPStanTypeToPHPStanPhpDocTypeNode(Type $phpStanType) : TypeN
*/
public function mapPHPStanTypeToPhpParserNode(Type $phpStanType, string $typeKind) : ?Node
{
$node = $this->phpStanStaticTypeMapper->mapToPhpParserNode($phpStanType, $typeKind);
if (!$node instanceof Node) {
return null;
}
if ($node instanceof UnionType) {
return $node;
}
if (!$node instanceof Name) {
return $node;
}
$nodeName = $this->nodeNameResolver->getName($node);
foreach (self::STANDALONE_MAPS as $key => $type) {
if ($nodeName === $key) {
return new Name($type);
}
}
return $node;
return $this->phpStanStaticTypeMapper->mapToPhpParserNode($phpStanType, $typeKind);
}
public function mapPhpParserNodePHPStanType(Node $node) : Type
{
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 = '07934c889213adc8a63a4db60b23575440da30c9';
public const PACKAGE_VERSION = '2afa47cd68086b61cb2363bcfb5553eb8767b50c';
/**
* @api
* @var string
*/
public const RELEASE_DATE = '2023-07-23 17:09:53';
public const RELEASE_DATE = '2023-07-23 17:10: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 ComposerAutoloaderInit5ca5cf93238327764a56963c242c2c00::getLoader();
return ComposerAutoloaderInit824bd8621e72888629f212d328a62f9a::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 ComposerAutoloaderInit5ca5cf93238327764a56963c242c2c00
class ComposerAutoloaderInit824bd8621e72888629f212d328a62f9a
{
private static $loader;

Expand All @@ -22,17 +22,17 @@ public static function getLoader()
return self::$loader;
}

spl_autoload_register(array('ComposerAutoloaderInit5ca5cf93238327764a56963c242c2c00', 'loadClassLoader'), true, true);
spl_autoload_register(array('ComposerAutoloaderInit824bd8621e72888629f212d328a62f9a', 'loadClassLoader'), true, true);
self::$loader = $loader = new \Composer\Autoload\ClassLoader(\dirname(__DIR__));
spl_autoload_unregister(array('ComposerAutoloaderInit5ca5cf93238327764a56963c242c2c00', 'loadClassLoader'));
spl_autoload_unregister(array('ComposerAutoloaderInit824bd8621e72888629f212d328a62f9a', 'loadClassLoader'));

require __DIR__ . '/autoload_static.php';
call_user_func(\Composer\Autoload\ComposerStaticInit5ca5cf93238327764a56963c242c2c00::getInitializer($loader));
call_user_func(\Composer\Autoload\ComposerStaticInit824bd8621e72888629f212d328a62f9a::getInitializer($loader));

$loader->setClassMapAuthoritative(true);
$loader->register(true);

$filesToLoad = \Composer\Autoload\ComposerStaticInit5ca5cf93238327764a56963c242c2c00::$files;
$filesToLoad = \Composer\Autoload\ComposerStaticInit824bd8621e72888629f212d328a62f9a::$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 ComposerStaticInit5ca5cf93238327764a56963c242c2c00
class ComposerStaticInit824bd8621e72888629f212d328a62f9a
{
public static $files = array (
'ad155f8f1cf0d418fe49e248db8c661b' => __DIR__ . '/..' . '/react/promise/src/functions_include.php',
Expand Down Expand Up @@ -3022,9 +3022,9 @@ class ComposerStaticInit5ca5cf93238327764a56963c242c2c00
public static function getInitializer(ClassLoader $loader)
{
return \Closure::bind(function () use ($loader) {
$loader->prefixLengthsPsr4 = ComposerStaticInit5ca5cf93238327764a56963c242c2c00::$prefixLengthsPsr4;
$loader->prefixDirsPsr4 = ComposerStaticInit5ca5cf93238327764a56963c242c2c00::$prefixDirsPsr4;
$loader->classMap = ComposerStaticInit5ca5cf93238327764a56963c242c2c00::$classMap;
$loader->prefixLengthsPsr4 = ComposerStaticInit824bd8621e72888629f212d328a62f9a::$prefixLengthsPsr4;
$loader->prefixDirsPsr4 = ComposerStaticInit824bd8621e72888629f212d328a62f9a::$prefixDirsPsr4;
$loader->classMap = ComposerStaticInit824bd8621e72888629f212d328a62f9a::$classMap;

}, null, ClassLoader::class);
}
Expand Down

0 comments on commit 6ce5f37

Please sign in to comment.