mirror of
https://github.com/rectorphp/rector.git
synced 2025-04-09 01:52:37 +02:00
Updated Rector to commit 00a51146a06566467292db72c8e231330c7e41d9
00a51146a0
[PHPStanStaticTypeMapper] Allow standalone null type on NullTypeMapper on php 8.2 (#4783)
This commit is contained in:
parent
867dc4426c
commit
46d23a1bc4
@ -12,6 +12,7 @@ use PHPStan\Type\Type;
|
||||
use Rector\Core\Php\PhpVersionProvider;
|
||||
use Rector\Core\ValueObject\PhpVersionFeature;
|
||||
use Rector\PHPStanStaticTypeMapper\Contract\TypeMapperInterface;
|
||||
use Rector\PHPStanStaticTypeMapper\Enum\TypeKind;
|
||||
/**
|
||||
* @implements TypeMapperInterface<BooleanType>
|
||||
*/
|
||||
@ -48,6 +49,9 @@ final class BooleanTypeMapper implements TypeMapperInterface
|
||||
if (!$this->phpVersionProvider->isAtLeastPhpVersion(PhpVersionFeature::SCALAR_TYPES)) {
|
||||
return null;
|
||||
}
|
||||
if ($typeKind !== TypeKind::RETURN) {
|
||||
return new Identifier('bool');
|
||||
}
|
||||
if (!$this->phpVersionProvider->isAtLeastPhpVersion(PhpVersionFeature::NULL_FALSE_TRUE_STANDALONE_TYPE)) {
|
||||
return new Identifier('bool');
|
||||
}
|
||||
|
@ -8,6 +8,8 @@ use PhpParser\Node\Identifier;
|
||||
use PHPStan\PhpDocParser\Ast\Type\TypeNode;
|
||||
use PHPStan\Type\NullType;
|
||||
use PHPStan\Type\Type;
|
||||
use Rector\Core\Php\PhpVersionProvider;
|
||||
use Rector\Core\ValueObject\PhpVersionFeature;
|
||||
use Rector\PHPStanStaticTypeMapper\Contract\TypeMapperInterface;
|
||||
use Rector\PHPStanStaticTypeMapper\Enum\TypeKind;
|
||||
/**
|
||||
@ -15,6 +17,15 @@ use Rector\PHPStanStaticTypeMapper\Enum\TypeKind;
|
||||
*/
|
||||
final class NullTypeMapper implements TypeMapperInterface
|
||||
{
|
||||
/**
|
||||
* @readonly
|
||||
* @var \Rector\Core\Php\PhpVersionProvider
|
||||
*/
|
||||
private $phpVersionProvider;
|
||||
public function __construct(PhpVersionProvider $phpVersionProvider)
|
||||
{
|
||||
$this->phpVersionProvider = $phpVersionProvider;
|
||||
}
|
||||
/**
|
||||
* @return class-string<Type>
|
||||
*/
|
||||
@ -35,14 +46,10 @@ final class NullTypeMapper implements TypeMapperInterface
|
||||
*/
|
||||
public function mapToPhpParserNode(Type $type, string $typeKind) : ?Node
|
||||
{
|
||||
if ($typeKind === TypeKind::PROPERTY) {
|
||||
if (!$this->phpVersionProvider->isAtLeastPhpVersion(PhpVersionFeature::NULL_FALSE_TRUE_STANDALONE_TYPE)) {
|
||||
return null;
|
||||
}
|
||||
if ($typeKind === TypeKind::PARAM) {
|
||||
return null;
|
||||
}
|
||||
// return type cannot be only null
|
||||
if ($typeKind === TypeKind::RETURN) {
|
||||
if ($typeKind !== TypeKind::RETURN) {
|
||||
return null;
|
||||
}
|
||||
return new Identifier('null');
|
||||
|
@ -19,12 +19,12 @@ final class VersionResolver
|
||||
* @api
|
||||
* @var string
|
||||
*/
|
||||
public const PACKAGE_VERSION = '6b7aac835934de48c034aa8b2bad886616566e06';
|
||||
public const PACKAGE_VERSION = '00a51146a06566467292db72c8e231330c7e41d9';
|
||||
/**
|
||||
* @api
|
||||
* @var string
|
||||
*/
|
||||
public const RELEASE_DATE = '2023-08-14 07:36:48';
|
||||
public const RELEASE_DATE = '2023-08-14 10:15:22';
|
||||
/**
|
||||
* @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 ComposerAutoloaderInitd0491821a1f961d1d51360ac6370685e::getLoader();
|
||||
return ComposerAutoloaderInit21b54534f5fb8cd8d9c2ac7277d89990::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 ComposerAutoloaderInitd0491821a1f961d1d51360ac6370685e
|
||||
class ComposerAutoloaderInit21b54534f5fb8cd8d9c2ac7277d89990
|
||||
{
|
||||
private static $loader;
|
||||
|
||||
@ -22,17 +22,17 @@ class ComposerAutoloaderInitd0491821a1f961d1d51360ac6370685e
|
||||
return self::$loader;
|
||||
}
|
||||
|
||||
spl_autoload_register(array('ComposerAutoloaderInitd0491821a1f961d1d51360ac6370685e', 'loadClassLoader'), true, true);
|
||||
spl_autoload_register(array('ComposerAutoloaderInit21b54534f5fb8cd8d9c2ac7277d89990', 'loadClassLoader'), true, true);
|
||||
self::$loader = $loader = new \Composer\Autoload\ClassLoader(\dirname(__DIR__));
|
||||
spl_autoload_unregister(array('ComposerAutoloaderInitd0491821a1f961d1d51360ac6370685e', 'loadClassLoader'));
|
||||
spl_autoload_unregister(array('ComposerAutoloaderInit21b54534f5fb8cd8d9c2ac7277d89990', 'loadClassLoader'));
|
||||
|
||||
require __DIR__ . '/autoload_static.php';
|
||||
call_user_func(\Composer\Autoload\ComposerStaticInitd0491821a1f961d1d51360ac6370685e::getInitializer($loader));
|
||||
call_user_func(\Composer\Autoload\ComposerStaticInit21b54534f5fb8cd8d9c2ac7277d89990::getInitializer($loader));
|
||||
|
||||
$loader->setClassMapAuthoritative(true);
|
||||
$loader->register(true);
|
||||
|
||||
$filesToLoad = \Composer\Autoload\ComposerStaticInitd0491821a1f961d1d51360ac6370685e::$files;
|
||||
$filesToLoad = \Composer\Autoload\ComposerStaticInit21b54534f5fb8cd8d9c2ac7277d89990::$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 ComposerStaticInitd0491821a1f961d1d51360ac6370685e
|
||||
class ComposerStaticInit21b54534f5fb8cd8d9c2ac7277d89990
|
||||
{
|
||||
public static $files = array (
|
||||
'ad155f8f1cf0d418fe49e248db8c661b' => __DIR__ . '/..' . '/react/promise/src/functions_include.php',
|
||||
@ -2958,9 +2958,9 @@ class ComposerStaticInitd0491821a1f961d1d51360ac6370685e
|
||||
public static function getInitializer(ClassLoader $loader)
|
||||
{
|
||||
return \Closure::bind(function () use ($loader) {
|
||||
$loader->prefixLengthsPsr4 = ComposerStaticInitd0491821a1f961d1d51360ac6370685e::$prefixLengthsPsr4;
|
||||
$loader->prefixDirsPsr4 = ComposerStaticInitd0491821a1f961d1d51360ac6370685e::$prefixDirsPsr4;
|
||||
$loader->classMap = ComposerStaticInitd0491821a1f961d1d51360ac6370685e::$classMap;
|
||||
$loader->prefixLengthsPsr4 = ComposerStaticInit21b54534f5fb8cd8d9c2ac7277d89990::$prefixLengthsPsr4;
|
||||
$loader->prefixDirsPsr4 = ComposerStaticInit21b54534f5fb8cd8d9c2ac7277d89990::$prefixDirsPsr4;
|
||||
$loader->classMap = ComposerStaticInit21b54534f5fb8cd8d9c2ac7277d89990::$classMap;
|
||||
|
||||
}, null, ClassLoader::class);
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user