Updated Rector to commit f39c01e545962d543bfb1fa9ef6bca2aaa4c80c9

f39c01e545 [DowngradePhp71] Using exact same type on PhpDocFromTypeDeclarationDecorator (#770)
This commit is contained in:
Tomas Votruba 2021-08-26 11:54:28 +00:00
parent 823de556b6
commit c65dc5320c
11 changed files with 26 additions and 41 deletions

View File

@ -81,7 +81,7 @@ final class PhpDocFromTypeDeclarationDecorator
if ($param->type === null) {
return;
}
if (!$this->isTypeMatchOrSubType($param->type, $requireType)) {
if (!$this->isTypeMatch($param->type, $requireType)) {
return;
}
$type = $this->staticTypeMapper->mapPhpParserNodePHPStanType($param->type);
@ -96,20 +96,20 @@ final class PhpDocFromTypeDeclarationDecorator
if ($functionLike->returnType === null) {
return \false;
}
if (!$this->isTypeMatchOrSubType($functionLike->returnType, $requireType)) {
if (!$this->isTypeMatch($functionLike->returnType, $requireType)) {
return \false;
}
$this->decorate($functionLike);
return \true;
}
private function isTypeMatchOrSubType(\PhpParser\Node $typeNode, \PHPStan\Type\Type $requireType) : bool
private function isTypeMatch(\PhpParser\Node $typeNode, \PHPStan\Type\Type $requireType) : bool
{
$returnType = $this->staticTypeMapper->mapPhpParserNodePHPStanType($typeNode);
// cover nullable union types
if ($returnType instanceof \PHPStan\Type\UnionType) {
$returnType = $this->typeUnwrapper->unwrapNullableType($returnType);
}
return \is_a($returnType, \get_class($requireType), \true);
return \get_class($returnType) === \get_class($requireType);
}
/**
* @param \PhpParser\Node\Stmt\ClassMethod|\PhpParser\Node\Stmt\Function_|\PhpParser\Node\Expr\Closure $functionLike

View File

@ -4,7 +4,6 @@ declare (strict_types=1);
namespace Rector\DowngradePhp80\Rector\ClassMethod;
use PhpParser\Node;
use PhpParser\Node\Name;
use PhpParser\Node\Stmt\ClassMethod;
use PHPStan\Reflection\ClassReflection;
use PHPStan\Reflection\ReflectionProvider;
@ -69,9 +68,6 @@ CODE_SAMPLE
*/
public function refactor(\PhpParser\Node $node) : ?\PhpParser\Node
{
if ($node->returnType instanceof \PhpParser\Node\Name && $this->nodeNameResolver->isNames($node->returnType, ['self', 'parent'])) {
return null;
}
$scope = $node->getAttribute(\Rector\NodeTypeResolver\Node\AttributeKey::SCOPE);
if ($scope === null) {
$className = $node->getAttribute(\Rector\NodeTypeResolver\Node\AttributeKey::CLASS_NAME);

View File

@ -5,7 +5,6 @@ namespace Rector\DowngradePhp80\Rector\FunctionLike;
use PhpParser\Node;
use PhpParser\Node\Expr\Closure;
use PhpParser\Node\Name;
use PhpParser\Node\Stmt\ClassMethod;
use PhpParser\Node\Stmt\Function_;
use PHPStan\Type\MixedType;
@ -62,9 +61,6 @@ CODE_SAMPLE
*/
public function refactor(\PhpParser\Node $node) : ?\PhpParser\Node
{
if ($node->returnType instanceof \PhpParser\Node\Name && $this->nodeNameResolver->isName($node->returnType, 'parent')) {
return null;
}
$mixedType = new \PHPStan\Type\MixedType();
foreach ($node->getParams() as $param) {
$this->phpDocFromTypeDeclarationDecorator->decorateParamWithSpecificType($param, $node, $mixedType);

View File

@ -16,11 +16,11 @@ final class VersionResolver
/**
* @var string
*/
public const PACKAGE_VERSION = '2665992c170b71c03458315bfc1ae2264d68e926';
public const PACKAGE_VERSION = 'f39c01e545962d543bfb1fa9ef6bca2aaa4c80c9';
/**
* @var string
*/
public const RELEASE_DATE = '2021-08-26 11:13:17';
public const RELEASE_DATE = '2021-08-26 18:42:20';
public static function resolvePackageVersion() : string
{
$process = new \RectorPrefix20210826\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 ComposerAutoloaderInit18f3b9317c28065d9f5981ddeea49096::getLoader();
return ComposerAutoloaderInit8a632974ae4f26ec12eea9ab31b16059::getLoader();

View File

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

View File

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

View File

@ -97,10 +97,7 @@ class MergeExtensionConfigurationPass implements \RectorPrefix20210826\Symfony\C
class MergeExtensionConfigurationParameterBag extends \RectorPrefix20210826\Symfony\Component\DependencyInjection\ParameterBag\EnvPlaceholderParameterBag
{
private $processedEnvPlaceholders;
/**
* @param parent $parameterBag
*/
public function __construct($parameterBag)
public function __construct(parent $parameterBag)
{
parent::__construct($parameterBag->all());
$this->mergeEnvPlaceholders($parameterBag);

View File

@ -214,10 +214,7 @@ class FlattenException
$this->code = $code;
return $this;
}
/**
* @return $this|null
*/
public function getPrevious()
public function getPrevious() : ?self
{
return $this->previous;
}

View File

@ -189,10 +189,9 @@ class Profile
$child->setParent($this);
}
/**
* @return $this|null
* @param string $token
*/
public function getChildByToken($token)
public function getChildByToken($token) : ?self
{
foreach ($this->children as $child) {
if ($token === $child->getToken()) {