mirror of
https://github.com/rectorphp/rector.git
synced 2025-01-17 21:38:22 +01:00
Updated Rector to commit 7611dcb05adda44fb14a228574481b3f79d0b9d5
7611dcb05a
Use isVoid() (#3574)
This commit is contained in:
parent
32306ae608
commit
5f5a4162ce
@ -204,7 +204,7 @@ final class UnionTypeMapper implements TypeMapperInterface
|
||||
private function mapNullabledType(Type $nullabledType, string $typeKind) : ?Node
|
||||
{
|
||||
// void cannot be nullable
|
||||
if ($nullabledType instanceof VoidType) {
|
||||
if ($nullabledType->isVoid()->yes()) {
|
||||
return null;
|
||||
}
|
||||
$nullabledTypeNode = $this->phpStanStaticTypeMapper->mapToPhpParserNode($nullabledType, $typeKind);
|
||||
|
@ -186,7 +186,7 @@ final class ClassMethodReturnTypeOverrideGuard
|
||||
return \true;
|
||||
}
|
||||
$childReturnType = $this->returnTypeInferer->inferFunctionLike($method);
|
||||
if ($returnType instanceof VoidType && !$childReturnType instanceof VoidType) {
|
||||
if ($returnType->isVoid()->yes() && !$childReturnType->isVoid()->yes()) {
|
||||
return \true;
|
||||
}
|
||||
}
|
||||
|
@ -360,7 +360,7 @@ final class AnonymousFunctionFactory
|
||||
*/
|
||||
private function resolveStmts(FunctionVariantWithPhpDocs $functionVariantWithPhpDocs, $innerMethodCall) : array
|
||||
{
|
||||
if ($functionVariantWithPhpDocs->getReturnType() instanceof VoidType) {
|
||||
if ($functionVariantWithPhpDocs->getReturnType()->isVoid()->yes()) {
|
||||
return [new Expression($innerMethodCall)];
|
||||
}
|
||||
return [new Return_($innerMethodCall)];
|
||||
|
@ -43,7 +43,7 @@ CODE_SAMPLE
|
||||
return null;
|
||||
}
|
||||
$type = $this->getType($node->expr);
|
||||
if ($type instanceof VoidType) {
|
||||
if ($type->isVoid()->yes()) {
|
||||
return null;
|
||||
}
|
||||
$returnTypeNode = $this->staticTypeMapper->mapPHPStanTypeToPhpParserNode($type, TypeKind::RETURN);
|
||||
|
@ -153,7 +153,7 @@ CODE_SAMPLE
|
||||
{
|
||||
$resolvedType = $this->nodeTypeResolver->getType($arrowFunction->expr);
|
||||
// void type is not accepted for arrow functions - https://www.php.net/manual/en/functions.arrow.php#125673
|
||||
if ($resolvedType instanceof VoidType) {
|
||||
if ($resolvedType->isVoid()->yes()) {
|
||||
return null;
|
||||
}
|
||||
$returnType = $this->staticTypeMapper->mapPHPStanTypeToPhpParserNode($resolvedType, TypeKind::RETURN);
|
||||
@ -171,7 +171,7 @@ CODE_SAMPLE
|
||||
$inferReturnType = $this->returnTypeInferer->inferFunctionLike($node);
|
||||
if ($inferReturnType instanceof UnionType) {
|
||||
foreach ($inferReturnType->getTypes() as $type) {
|
||||
if ($type instanceof VoidType) {
|
||||
if ($type->isVoid()->yes()) {
|
||||
return \true;
|
||||
}
|
||||
}
|
||||
|
@ -146,7 +146,7 @@ final class ReturnTypeInferer
|
||||
*/
|
||||
private function resolveTypeWithVoidHandling($functionLike, Type $resolvedType) : Type
|
||||
{
|
||||
if ($resolvedType instanceof VoidType) {
|
||||
if ($resolvedType->isVoid()->yes()) {
|
||||
if ($functionLike instanceof ArrowFunction) {
|
||||
return new MixedType();
|
||||
}
|
||||
|
@ -188,7 +188,7 @@ final class ReturnedNodesReturnTypeInfererTypeInferer
|
||||
if ($resolvedType instanceof MixedType || $this->isArrayTypeMixed($resolvedType)) {
|
||||
$correctedType = $this->inferFromReturnedMethodCall($return, $functionLike);
|
||||
// override only if has some extra value
|
||||
if (!$correctedType instanceof MixedType && !$correctedType instanceof VoidType) {
|
||||
if (!$correctedType instanceof MixedType && !$correctedType->isVoid()->yes()) {
|
||||
return $correctedType;
|
||||
}
|
||||
}
|
||||
|
@ -19,12 +19,12 @@ final class VersionResolver
|
||||
* @api
|
||||
* @var string
|
||||
*/
|
||||
public const PACKAGE_VERSION = 'aa73118601d7421ca268ce8835efffb27a558008';
|
||||
public const PACKAGE_VERSION = '7611dcb05adda44fb14a228574481b3f79d0b9d5';
|
||||
/**
|
||||
* @api
|
||||
* @var string
|
||||
*/
|
||||
public const RELEASE_DATE = '2023-04-08 07:59:17';
|
||||
public const RELEASE_DATE = '2023-04-08 08:03:58';
|
||||
/**
|
||||
* @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 ComposerAutoloaderInit2c31d030a3ac76d8da38408ea55e9c2c::getLoader();
|
||||
return ComposerAutoloaderInita506a673b82b23dca0bce7dd90d16d32::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 ComposerAutoloaderInit2c31d030a3ac76d8da38408ea55e9c2c
|
||||
class ComposerAutoloaderInita506a673b82b23dca0bce7dd90d16d32
|
||||
{
|
||||
private static $loader;
|
||||
|
||||
@ -22,17 +22,17 @@ class ComposerAutoloaderInit2c31d030a3ac76d8da38408ea55e9c2c
|
||||
return self::$loader;
|
||||
}
|
||||
|
||||
spl_autoload_register(array('ComposerAutoloaderInit2c31d030a3ac76d8da38408ea55e9c2c', 'loadClassLoader'), true, true);
|
||||
spl_autoload_register(array('ComposerAutoloaderInita506a673b82b23dca0bce7dd90d16d32', 'loadClassLoader'), true, true);
|
||||
self::$loader = $loader = new \Composer\Autoload\ClassLoader(\dirname(__DIR__));
|
||||
spl_autoload_unregister(array('ComposerAutoloaderInit2c31d030a3ac76d8da38408ea55e9c2c', 'loadClassLoader'));
|
||||
spl_autoload_unregister(array('ComposerAutoloaderInita506a673b82b23dca0bce7dd90d16d32', 'loadClassLoader'));
|
||||
|
||||
require __DIR__ . '/autoload_static.php';
|
||||
call_user_func(\Composer\Autoload\ComposerStaticInit2c31d030a3ac76d8da38408ea55e9c2c::getInitializer($loader));
|
||||
call_user_func(\Composer\Autoload\ComposerStaticInita506a673b82b23dca0bce7dd90d16d32::getInitializer($loader));
|
||||
|
||||
$loader->setClassMapAuthoritative(true);
|
||||
$loader->register(true);
|
||||
|
||||
$filesToLoad = \Composer\Autoload\ComposerStaticInit2c31d030a3ac76d8da38408ea55e9c2c::$files;
|
||||
$filesToLoad = \Composer\Autoload\ComposerStaticInita506a673b82b23dca0bce7dd90d16d32::$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 ComposerStaticInit2c31d030a3ac76d8da38408ea55e9c2c
|
||||
class ComposerStaticInita506a673b82b23dca0bce7dd90d16d32
|
||||
{
|
||||
public static $files = array (
|
||||
'ad155f8f1cf0d418fe49e248db8c661b' => __DIR__ . '/..' . '/react/promise/src/functions_include.php',
|
||||
@ -3135,9 +3135,9 @@ class ComposerStaticInit2c31d030a3ac76d8da38408ea55e9c2c
|
||||
public static function getInitializer(ClassLoader $loader)
|
||||
{
|
||||
return \Closure::bind(function () use ($loader) {
|
||||
$loader->prefixLengthsPsr4 = ComposerStaticInit2c31d030a3ac76d8da38408ea55e9c2c::$prefixLengthsPsr4;
|
||||
$loader->prefixDirsPsr4 = ComposerStaticInit2c31d030a3ac76d8da38408ea55e9c2c::$prefixDirsPsr4;
|
||||
$loader->classMap = ComposerStaticInit2c31d030a3ac76d8da38408ea55e9c2c::$classMap;
|
||||
$loader->prefixLengthsPsr4 = ComposerStaticInita506a673b82b23dca0bce7dd90d16d32::$prefixLengthsPsr4;
|
||||
$loader->prefixDirsPsr4 = ComposerStaticInita506a673b82b23dca0bce7dd90d16d32::$prefixDirsPsr4;
|
||||
$loader->classMap = ComposerStaticInita506a673b82b23dca0bce7dd90d16d32::$classMap;
|
||||
|
||||
}, null, ClassLoader::class);
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user