Updated Rector to commit dbd934ee66dd836294670893416f3e2c8121e960

dbd934ee66 [TypeDeclaration] Skip callable on return type of control (#1572)
This commit is contained in:
Tomas Votruba 2021-12-26 11:33:23 +00:00
parent f42120a67b
commit 39175c2ff5
6 changed files with 30 additions and 19 deletions

View File

@ -4,11 +4,13 @@ declare (strict_types=1);
namespace Rector\TypeDeclaration\Rector\FunctionLike;
use PhpParser\Node;
use PhpParser\Node\Name\FullyQualified;
use PhpParser\Node\Param;
use PhpParser\Node\Stmt\ClassMethod;
use PhpParser\Node\Stmt\Function_;
use PhpParser\Node\Stmt\Interface_;
use PHPStan\Type\MixedType;
use PHPStan\Type\ObjectType;
use PHPStan\Type\UnionType;
use Rector\Core\Rector\AbstractRector;
use Rector\Core\ValueObject\PhpVersionFeature;
@ -207,6 +209,15 @@ CODE_SAMPLE
if ($this->vendorLockResolver->isClassMethodParamLockedIn($functionLike)) {
return \true;
}
// is nette return type?
$returnType = $functionLike->returnType;
if ($returnType instanceof \PhpParser\Node\Name\FullyQualified) {
$objectType = new \PHPStan\Type\ObjectType('Nette\\Application\\UI\\Control');
$returnObjectType = $this->staticTypeMapper->mapPhpParserNodePHPStanType($returnType);
if ($objectType->isSuperTypeOf($returnObjectType)->yes()) {
return \true;
}
}
// no type → check it
if ($param->type === null) {
return \false;

View File

@ -16,11 +16,11 @@ final class VersionResolver
/**
* @var string
*/
public const PACKAGE_VERSION = '3a2e85d9cb2345e369b59e3f9c3625acdb0eae44';
public const PACKAGE_VERSION = 'dbd934ee66dd836294670893416f3e2c8121e960';
/**
* @var string
*/
public const RELEASE_DATE = '2021-12-26 11:38:11';
public const RELEASE_DATE = '2021-12-26 11:23:47';
public static function resolvePackageVersion() : string
{
$process = new \RectorPrefix20211226\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 ComposerAutoloaderInit5d2fa11127cad4559cd8f177f679307e::getLoader();
return ComposerAutoloaderInite29706bb3a8788e8fe6a0744d833620a::getLoader();

View File

@ -2,7 +2,7 @@
// autoload_real.php @generated by Composer
class ComposerAutoloaderInit5d2fa11127cad4559cd8f177f679307e
class ComposerAutoloaderInite29706bb3a8788e8fe6a0744d833620a
{
private static $loader;
@ -22,15 +22,15 @@ class ComposerAutoloaderInit5d2fa11127cad4559cd8f177f679307e
return self::$loader;
}
spl_autoload_register(array('ComposerAutoloaderInit5d2fa11127cad4559cd8f177f679307e', 'loadClassLoader'), true, true);
spl_autoload_register(array('ComposerAutoloaderInite29706bb3a8788e8fe6a0744d833620a', 'loadClassLoader'), true, true);
self::$loader = $loader = new \Composer\Autoload\ClassLoader(\dirname(\dirname(__FILE__)));
spl_autoload_unregister(array('ComposerAutoloaderInit5d2fa11127cad4559cd8f177f679307e', 'loadClassLoader'));
spl_autoload_unregister(array('ComposerAutoloaderInite29706bb3a8788e8fe6a0744d833620a', '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\ComposerStaticInit5d2fa11127cad4559cd8f177f679307e::getInitializer($loader));
call_user_func(\Composer\Autoload\ComposerStaticInite29706bb3a8788e8fe6a0744d833620a::getInitializer($loader));
} else {
$classMap = require __DIR__ . '/autoload_classmap.php';
if ($classMap) {
@ -42,12 +42,12 @@ class ComposerAutoloaderInit5d2fa11127cad4559cd8f177f679307e
$loader->register(true);
if ($useStaticLoader) {
$includeFiles = Composer\Autoload\ComposerStaticInit5d2fa11127cad4559cd8f177f679307e::$files;
$includeFiles = Composer\Autoload\ComposerStaticInite29706bb3a8788e8fe6a0744d833620a::$files;
} else {
$includeFiles = require __DIR__ . '/autoload_files.php';
}
foreach ($includeFiles as $fileIdentifier => $file) {
composerRequire5d2fa11127cad4559cd8f177f679307e($fileIdentifier, $file);
composerRequiree29706bb3a8788e8fe6a0744d833620a($fileIdentifier, $file);
}
return $loader;
@ -59,7 +59,7 @@ class ComposerAutoloaderInit5d2fa11127cad4559cd8f177f679307e
* @param string $file
* @return void
*/
function composerRequire5d2fa11127cad4559cd8f177f679307e($fileIdentifier, $file)
function composerRequiree29706bb3a8788e8fe6a0744d833620a($fileIdentifier, $file)
{
if (empty($GLOBALS['__composer_autoload_files'][$fileIdentifier])) {
$GLOBALS['__composer_autoload_files'][$fileIdentifier] = true;

View File

@ -4,7 +4,7 @@
namespace Composer\Autoload;
class ComposerStaticInit5d2fa11127cad4559cd8f177f679307e
class ComposerStaticInite29706bb3a8788e8fe6a0744d833620a
{
public static $files = array (
'0e6d7bf4a5811bfa5cf40c5ccd6fae6a' => __DIR__ . '/..' . '/symfony/polyfill-mbstring/bootstrap.php',
@ -3838,9 +3838,9 @@ class ComposerStaticInit5d2fa11127cad4559cd8f177f679307e
public static function getInitializer(ClassLoader $loader)
{
return \Closure::bind(function () use ($loader) {
$loader->prefixLengthsPsr4 = ComposerStaticInit5d2fa11127cad4559cd8f177f679307e::$prefixLengthsPsr4;
$loader->prefixDirsPsr4 = ComposerStaticInit5d2fa11127cad4559cd8f177f679307e::$prefixDirsPsr4;
$loader->classMap = ComposerStaticInit5d2fa11127cad4559cd8f177f679307e::$classMap;
$loader->prefixLengthsPsr4 = ComposerStaticInite29706bb3a8788e8fe6a0744d833620a::$prefixLengthsPsr4;
$loader->prefixDirsPsr4 = ComposerStaticInite29706bb3a8788e8fe6a0744d833620a::$prefixDirsPsr4;
$loader->classMap = ComposerStaticInite29706bb3a8788e8fe6a0744d833620a::$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('RectorPrefix20211226\AutoloadIncluder');
}
if (!class_exists('ComposerAutoloaderInit5d2fa11127cad4559cd8f177f679307e', false) && !interface_exists('ComposerAutoloaderInit5d2fa11127cad4559cd8f177f679307e', false) && !trait_exists('ComposerAutoloaderInit5d2fa11127cad4559cd8f177f679307e', false)) {
spl_autoload_call('RectorPrefix20211226\ComposerAutoloaderInit5d2fa11127cad4559cd8f177f679307e');
if (!class_exists('ComposerAutoloaderInite29706bb3a8788e8fe6a0744d833620a', false) && !interface_exists('ComposerAutoloaderInite29706bb3a8788e8fe6a0744d833620a', false) && !trait_exists('ComposerAutoloaderInite29706bb3a8788e8fe6a0744d833620a', false)) {
spl_autoload_call('RectorPrefix20211226\ComposerAutoloaderInite29706bb3a8788e8fe6a0744d833620a');
}
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('RectorPrefix20211226\Helmich\TypoScriptParser\Parser\AST\Statement');
@ -78,9 +78,9 @@ if (!function_exists('print_node')) {
return \RectorPrefix20211226\print_node(...func_get_args());
}
}
if (!function_exists('composerRequire5d2fa11127cad4559cd8f177f679307e')) {
function composerRequire5d2fa11127cad4559cd8f177f679307e() {
return \RectorPrefix20211226\composerRequire5d2fa11127cad4559cd8f177f679307e(...func_get_args());
if (!function_exists('composerRequiree29706bb3a8788e8fe6a0744d833620a')) {
function composerRequiree29706bb3a8788e8fe6a0744d833620a() {
return \RectorPrefix20211226\composerRequiree29706bb3a8788e8fe6a0744d833620a(...func_get_args());
}
}
if (!function_exists('scanPath')) {