Updated Rector to commit 322d2d1f7f9ffbed8b80cc9a1c3c07a1e8f38042

322d2d1f7f [CodeQuality][EarlyReturn] Handle SimplifyDeMorganBinaryRector + DateTimeToDateTimeInterfaceRector + ChangeAndIfToEarlyReturnRector (#847)
This commit is contained in:
Tomas Votruba 2021-09-08 10:50:16 +00:00
parent 15f852f98c
commit 9067837e02
6 changed files with 24 additions and 24 deletions

View File

@ -103,8 +103,7 @@ CODE_SAMPLE
public function refactor(\PhpParser\Node $node) : ?\PhpParser\Node
{
if ($node instanceof \PhpParser\Node\Stmt\ClassMethod) {
$this->refactorClassMethod($node);
return $node;
return $this->refactorClassMethod($node);
}
return $this->refactorProperty($node);
}
@ -153,19 +152,20 @@ CODE_SAMPLE
}
return $node instanceof \PhpParser\Node\NullableType;
}
private function refactorClassMethod(\PhpParser\Node\Stmt\ClassMethod $classMethod) : void
private function refactorClassMethod(\PhpParser\Node\Stmt\ClassMethod $classMethod) : ?\PhpParser\Node\Stmt\ClassMethod
{
if ($this->shouldSkipExactlyReturnDateTime($classMethod)) {
return;
return null;
}
$fromObjectType = new \PHPStan\Type\ObjectType(self::DATE_TIME);
$fullyQualified = new \PhpParser\Node\Name\FullyQualified('DateTimeInterface');
$unionType = new \PHPStan\Type\UnionType([new \PHPStan\Type\ObjectType(self::DATE_TIME), new \PHPStan\Type\ObjectType('DateTimeImmutable')]);
$this->classMethodParameterTypeManipulator->refactorFunctionParameters($classMethod, $fromObjectType, $fullyQualified, $unionType, self::METHODS_RETURNING_CLASS_INSTANCE_MAP);
if (!$classMethod->returnType instanceof \PhpParser\Node) {
return;
return null;
}
$this->classMethodReturnTypeManipulator->refactorFunctionReturnType($classMethod, $fromObjectType, $fullyQualified, $unionType);
return $classMethod;
}
private function shouldSkipExactlyReturnDateTime(\PhpParser\Node\Stmt\ClassMethod $classMethod) : bool
{

View File

@ -16,11 +16,11 @@ final class VersionResolver
/**
* @var string
*/
public const PACKAGE_VERSION = 'a3d43bc8903bdbab0e167a3cf623d8f413f68007';
public const PACKAGE_VERSION = '322d2d1f7f9ffbed8b80cc9a1c3c07a1e8f38042';
/**
* @var string
*/
public const RELEASE_DATE = '2021-09-08 12:36:16';
public const RELEASE_DATE = '2021-09-08 12:36:33';
public static function resolvePackageVersion() : string
{
$process = new \RectorPrefix20210908\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 ComposerAutoloaderInit0b74efed7f627438a4b9bd74e7b1aa5b::getLoader();
return ComposerAutoloaderInite9e55ee09a340366e2723aa725c579ad::getLoader();

View File

@ -2,7 +2,7 @@
// autoload_real.php @generated by Composer
class ComposerAutoloaderInit0b74efed7f627438a4b9bd74e7b1aa5b
class ComposerAutoloaderInite9e55ee09a340366e2723aa725c579ad
{
private static $loader;
@ -22,15 +22,15 @@ class ComposerAutoloaderInit0b74efed7f627438a4b9bd74e7b1aa5b
return self::$loader;
}
spl_autoload_register(array('ComposerAutoloaderInit0b74efed7f627438a4b9bd74e7b1aa5b', 'loadClassLoader'), true, true);
spl_autoload_register(array('ComposerAutoloaderInite9e55ee09a340366e2723aa725c579ad', 'loadClassLoader'), true, true);
self::$loader = $loader = new \Composer\Autoload\ClassLoader(\dirname(\dirname(__FILE__)));
spl_autoload_unregister(array('ComposerAutoloaderInit0b74efed7f627438a4b9bd74e7b1aa5b', 'loadClassLoader'));
spl_autoload_unregister(array('ComposerAutoloaderInite9e55ee09a340366e2723aa725c579ad', '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\ComposerStaticInit0b74efed7f627438a4b9bd74e7b1aa5b::getInitializer($loader));
call_user_func(\Composer\Autoload\ComposerStaticInite9e55ee09a340366e2723aa725c579ad::getInitializer($loader));
} else {
$classMap = require __DIR__ . '/autoload_classmap.php';
if ($classMap) {
@ -42,19 +42,19 @@ class ComposerAutoloaderInit0b74efed7f627438a4b9bd74e7b1aa5b
$loader->register(true);
if ($useStaticLoader) {
$includeFiles = Composer\Autoload\ComposerStaticInit0b74efed7f627438a4b9bd74e7b1aa5b::$files;
$includeFiles = Composer\Autoload\ComposerStaticInite9e55ee09a340366e2723aa725c579ad::$files;
} else {
$includeFiles = require __DIR__ . '/autoload_files.php';
}
foreach ($includeFiles as $fileIdentifier => $file) {
composerRequire0b74efed7f627438a4b9bd74e7b1aa5b($fileIdentifier, $file);
composerRequiree9e55ee09a340366e2723aa725c579ad($fileIdentifier, $file);
}
return $loader;
}
}
function composerRequire0b74efed7f627438a4b9bd74e7b1aa5b($fileIdentifier, $file)
function composerRequiree9e55ee09a340366e2723aa725c579ad($fileIdentifier, $file)
{
if (empty($GLOBALS['__composer_autoload_files'][$fileIdentifier])) {
require $file;

View File

@ -4,7 +4,7 @@
namespace Composer\Autoload;
class ComposerStaticInit0b74efed7f627438a4b9bd74e7b1aa5b
class ComposerStaticInite9e55ee09a340366e2723aa725c579ad
{
public static $files = array (
'a4a119a56e50fbb293281d9a48007e0e' => __DIR__ . '/..' . '/symfony/polyfill-php80/bootstrap.php',
@ -3856,9 +3856,9 @@ class ComposerStaticInit0b74efed7f627438a4b9bd74e7b1aa5b
public static function getInitializer(ClassLoader $loader)
{
return \Closure::bind(function () use ($loader) {
$loader->prefixLengthsPsr4 = ComposerStaticInit0b74efed7f627438a4b9bd74e7b1aa5b::$prefixLengthsPsr4;
$loader->prefixDirsPsr4 = ComposerStaticInit0b74efed7f627438a4b9bd74e7b1aa5b::$prefixDirsPsr4;
$loader->classMap = ComposerStaticInit0b74efed7f627438a4b9bd74e7b1aa5b::$classMap;
$loader->prefixLengthsPsr4 = ComposerStaticInite9e55ee09a340366e2723aa725c579ad::$prefixLengthsPsr4;
$loader->prefixDirsPsr4 = ComposerStaticInite9e55ee09a340366e2723aa725c579ad::$prefixDirsPsr4;
$loader->classMap = ComposerStaticInite9e55ee09a340366e2723aa725c579ad::$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('RectorPrefix20210908\AutoloadIncluder');
}
if (!class_exists('ComposerAutoloaderInit0b74efed7f627438a4b9bd74e7b1aa5b', false) && !interface_exists('ComposerAutoloaderInit0b74efed7f627438a4b9bd74e7b1aa5b', false) && !trait_exists('ComposerAutoloaderInit0b74efed7f627438a4b9bd74e7b1aa5b', false)) {
spl_autoload_call('RectorPrefix20210908\ComposerAutoloaderInit0b74efed7f627438a4b9bd74e7b1aa5b');
if (!class_exists('ComposerAutoloaderInite9e55ee09a340366e2723aa725c579ad', false) && !interface_exists('ComposerAutoloaderInite9e55ee09a340366e2723aa725c579ad', false) && !trait_exists('ComposerAutoloaderInite9e55ee09a340366e2723aa725c579ad', false)) {
spl_autoload_call('RectorPrefix20210908\ComposerAutoloaderInite9e55ee09a340366e2723aa725c579ad');
}
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('RectorPrefix20210908\Helmich\TypoScriptParser\Parser\AST\Statement');
@ -3311,9 +3311,9 @@ if (!function_exists('print_node')) {
return \RectorPrefix20210908\print_node(...func_get_args());
}
}
if (!function_exists('composerRequire0b74efed7f627438a4b9bd74e7b1aa5b')) {
function composerRequire0b74efed7f627438a4b9bd74e7b1aa5b() {
return \RectorPrefix20210908\composerRequire0b74efed7f627438a4b9bd74e7b1aa5b(...func_get_args());
if (!function_exists('composerRequiree9e55ee09a340366e2723aa725c579ad')) {
function composerRequiree9e55ee09a340366e2723aa725c579ad() {
return \RectorPrefix20210908\composerRequiree9e55ee09a340366e2723aa725c579ad(...func_get_args());
}
}
if (!function_exists('parseArgs')) {