Updated Rector to commit 97d3ad74eec35641062e3d9a471c290359d70849

97d3ad74ee [CodeQuality][EarlyReturn] Handle DateTimeToDateTimeInterfaceRector + ChangeAndIfToEarlyReturnRector + ChangeOrIfContinueToMultiContinueRector (#867)
This commit is contained in:
Tomas Votruba 2021-09-11 15:12:18 +00:00
parent 629ef3f9b0
commit 298a54bb2b
7 changed files with 25 additions and 25 deletions

View File

@ -37,11 +37,11 @@ final class ClassMethodReturnTypeManipulator
/**
* @param \PhpParser\Node\Identifier|\PhpParser\Node\Name|\PhpParser\Node\NullableType $replaceIntoType
*/
public function refactorFunctionReturnType(\PhpParser\Node\Stmt\ClassMethod $classMethod, \PHPStan\Type\ObjectType $objectType, $replaceIntoType, \PHPStan\Type\Type $phpDocType) : void
public function refactorFunctionReturnType(\PhpParser\Node\Stmt\ClassMethod $classMethod, \PHPStan\Type\ObjectType $objectType, $replaceIntoType, \PHPStan\Type\Type $phpDocType) : ?\PhpParser\Node\Stmt\ClassMethod
{
$returnType = $classMethod->returnType;
if ($returnType === null) {
return;
return null;
}
$isNullable = \false;
if ($returnType instanceof \PhpParser\Node\NullableType) {
@ -49,11 +49,11 @@ final class ClassMethodReturnTypeManipulator
$returnType = $returnType->type;
}
if (!$this->nodeTypeResolver->isObjectType($returnType, $objectType)) {
return;
return null;
}
$paramType = $this->nodeTypeResolver->resolve($returnType);
if (!$paramType->isSuperTypeOf($objectType)->yes()) {
return;
return null;
}
if ($isNullable) {
if ($phpDocType instanceof \PHPStan\Type\UnionType) {
@ -70,5 +70,6 @@ final class ClassMethodReturnTypeManipulator
$classMethod->returnType = $replaceIntoType;
$phpDocInfo = $this->phpDocInfoFactory->createFromNodeOrEmpty($classMethod);
$this->phpDocTypeChanger->changeReturnType($phpDocInfo, $phpDocType);
return $classMethod;
}
}

View File

@ -164,8 +164,7 @@ CODE_SAMPLE
if (!$classMethod->returnType instanceof \PhpParser\Node) {
return null;
}
$this->classMethodReturnTypeManipulator->refactorFunctionReturnType($classMethod, $fromObjectType, $fullyQualified, $unionType);
return $classMethod;
return $this->classMethodReturnTypeManipulator->refactorFunctionReturnType($classMethod, $fromObjectType, $fullyQualified, $unionType);
}
private function shouldSkipExactlyReturnDateTime(\PhpParser\Node\Stmt\ClassMethod $classMethod) : bool
{

View File

@ -16,11 +16,11 @@ final class VersionResolver
/**
* @var string
*/
public const PACKAGE_VERSION = 'c71f6ee6412df421e254665d9d7b0ef42fda0c57';
public const PACKAGE_VERSION = '97d3ad74eec35641062e3d9a471c290359d70849';
/**
* @var string
*/
public const RELEASE_DATE = '2021-09-11 12:49:11';
public const RELEASE_DATE = '2021-09-11 17:01:30';
public static function resolvePackageVersion() : string
{
$process = new \RectorPrefix20210911\Symfony\Component\Process\Process(['git', 'log', '--pretty="%H"', '-n1', 'HEAD'], __DIR__);

2
vendor/autoload.php vendored
View File

@ -4,4 +4,4 @@
require_once __DIR__ . '/composer/autoload_real.php';
return ComposerAutoloaderInitc373b2dc4e52def312178f7dde82817e::getLoader();
return ComposerAutoloaderInit54c8fc77e4fb370a7e0046e9e61317a2::getLoader();

View File

@ -2,7 +2,7 @@
// autoload_real.php @generated by Composer
class ComposerAutoloaderInitc373b2dc4e52def312178f7dde82817e
class ComposerAutoloaderInit54c8fc77e4fb370a7e0046e9e61317a2
{
private static $loader;
@ -22,15 +22,15 @@ class ComposerAutoloaderInitc373b2dc4e52def312178f7dde82817e
return self::$loader;
}
spl_autoload_register(array('ComposerAutoloaderInitc373b2dc4e52def312178f7dde82817e', 'loadClassLoader'), true, true);
spl_autoload_register(array('ComposerAutoloaderInit54c8fc77e4fb370a7e0046e9e61317a2', 'loadClassLoader'), true, true);
self::$loader = $loader = new \Composer\Autoload\ClassLoader(\dirname(\dirname(__FILE__)));
spl_autoload_unregister(array('ComposerAutoloaderInitc373b2dc4e52def312178f7dde82817e', 'loadClassLoader'));
spl_autoload_unregister(array('ComposerAutoloaderInit54c8fc77e4fb370a7e0046e9e61317a2', 'loadClassLoader'));
$useStaticLoader = PHP_VERSION_ID >= 50600 && !defined('HHVM_VERSION') && (!function_exists('zend_loader_file_encoded') || !zend_loader_file_encoded());
if ($useStaticLoader) {
require __DIR__ . '/autoload_static.php';
call_user_func(\Composer\Autoload\ComposerStaticInitc373b2dc4e52def312178f7dde82817e::getInitializer($loader));
call_user_func(\Composer\Autoload\ComposerStaticInit54c8fc77e4fb370a7e0046e9e61317a2::getInitializer($loader));
} else {
$classMap = require __DIR__ . '/autoload_classmap.php';
if ($classMap) {
@ -42,19 +42,19 @@ class ComposerAutoloaderInitc373b2dc4e52def312178f7dde82817e
$loader->register(true);
if ($useStaticLoader) {
$includeFiles = Composer\Autoload\ComposerStaticInitc373b2dc4e52def312178f7dde82817e::$files;
$includeFiles = Composer\Autoload\ComposerStaticInit54c8fc77e4fb370a7e0046e9e61317a2::$files;
} else {
$includeFiles = require __DIR__ . '/autoload_files.php';
}
foreach ($includeFiles as $fileIdentifier => $file) {
composerRequirec373b2dc4e52def312178f7dde82817e($fileIdentifier, $file);
composerRequire54c8fc77e4fb370a7e0046e9e61317a2($fileIdentifier, $file);
}
return $loader;
}
}
function composerRequirec373b2dc4e52def312178f7dde82817e($fileIdentifier, $file)
function composerRequire54c8fc77e4fb370a7e0046e9e61317a2($fileIdentifier, $file)
{
if (empty($GLOBALS['__composer_autoload_files'][$fileIdentifier])) {
require $file;

View File

@ -4,7 +4,7 @@
namespace Composer\Autoload;
class ComposerStaticInitc373b2dc4e52def312178f7dde82817e
class ComposerStaticInit54c8fc77e4fb370a7e0046e9e61317a2
{
public static $files = array (
'a4a119a56e50fbb293281d9a48007e0e' => __DIR__ . '/..' . '/symfony/polyfill-php80/bootstrap.php',
@ -3858,9 +3858,9 @@ class ComposerStaticInitc373b2dc4e52def312178f7dde82817e
public static function getInitializer(ClassLoader $loader)
{
return \Closure::bind(function () use ($loader) {
$loader->prefixLengthsPsr4 = ComposerStaticInitc373b2dc4e52def312178f7dde82817e::$prefixLengthsPsr4;
$loader->prefixDirsPsr4 = ComposerStaticInitc373b2dc4e52def312178f7dde82817e::$prefixDirsPsr4;
$loader->classMap = ComposerStaticInitc373b2dc4e52def312178f7dde82817e::$classMap;
$loader->prefixLengthsPsr4 = ComposerStaticInit54c8fc77e4fb370a7e0046e9e61317a2::$prefixLengthsPsr4;
$loader->prefixDirsPsr4 = ComposerStaticInit54c8fc77e4fb370a7e0046e9e61317a2::$prefixDirsPsr4;
$loader->classMap = ComposerStaticInit54c8fc77e4fb370a7e0046e9e61317a2::$classMap;
}, null, ClassLoader::class);
}

View File

@ -9,8 +9,8 @@ $loader = require_once __DIR__.'/autoload.php';
if (!class_exists('AutoloadIncluder', false) && !interface_exists('AutoloadIncluder', false) && !trait_exists('AutoloadIncluder', false)) {
spl_autoload_call('RectorPrefix20210911\AutoloadIncluder');
}
if (!class_exists('ComposerAutoloaderInitc373b2dc4e52def312178f7dde82817e', false) && !interface_exists('ComposerAutoloaderInitc373b2dc4e52def312178f7dde82817e', false) && !trait_exists('ComposerAutoloaderInitc373b2dc4e52def312178f7dde82817e', false)) {
spl_autoload_call('RectorPrefix20210911\ComposerAutoloaderInitc373b2dc4e52def312178f7dde82817e');
if (!class_exists('ComposerAutoloaderInit54c8fc77e4fb370a7e0046e9e61317a2', false) && !interface_exists('ComposerAutoloaderInit54c8fc77e4fb370a7e0046e9e61317a2', false) && !trait_exists('ComposerAutoloaderInit54c8fc77e4fb370a7e0046e9e61317a2', false)) {
spl_autoload_call('RectorPrefix20210911\ComposerAutoloaderInit54c8fc77e4fb370a7e0046e9e61317a2');
}
if (!class_exists('Helmich\TypoScriptParser\Parser\AST\Statement', false) && !interface_exists('Helmich\TypoScriptParser\Parser\AST\Statement', false) && !trait_exists('Helmich\TypoScriptParser\Parser\AST\Statement', false)) {
spl_autoload_call('RectorPrefix20210911\Helmich\TypoScriptParser\Parser\AST\Statement');
@ -3311,9 +3311,9 @@ if (!function_exists('print_node')) {
return \RectorPrefix20210911\print_node(...func_get_args());
}
}
if (!function_exists('composerRequirec373b2dc4e52def312178f7dde82817e')) {
function composerRequirec373b2dc4e52def312178f7dde82817e() {
return \RectorPrefix20210911\composerRequirec373b2dc4e52def312178f7dde82817e(...func_get_args());
if (!function_exists('composerRequire54c8fc77e4fb370a7e0046e9e61317a2')) {
function composerRequire54c8fc77e4fb370a7e0046e9e61317a2() {
return \RectorPrefix20210911\composerRequire54c8fc77e4fb370a7e0046e9e61317a2(...func_get_args());
}
}
if (!function_exists('parseArgs')) {