mirror of
https://github.com/rectorphp/rector.git
synced 2025-01-17 21:38:22 +01:00
Updated Rector to commit 991ea06c15009442d0a59d8503440681260ae612
991ea06c15
Fix wrong docs for ArgumentRemoverRector (#758)
This commit is contained in:
parent
a8425b1ef2
commit
4e2d5cfdcf
@ -12,6 +12,7 @@ use PhpParser\Node\Stmt\ClassMethod;
|
||||
use PhpParser\Node\Stmt\Expression;
|
||||
use PhpParser\Node\Stmt\Property;
|
||||
use PHPStan\Type\Generic\TemplateType;
|
||||
use PHPStan\Type\MixedType;
|
||||
use PHPStan\Type\Type;
|
||||
use PHPStan\Type\UnionType;
|
||||
use Rector\Core\PhpParser\Comparing\NodeComparator;
|
||||
@ -22,7 +23,6 @@ use Rector\NodeTypeResolver\NodeTypeResolver;
|
||||
use Rector\NodeTypeResolver\PHPStan\Type\TypeFactory;
|
||||
use Rector\NodeTypeResolver\TypeComparator\TypeComparator;
|
||||
use Rector\Php80\ValueObject\PropertyPromotionCandidate;
|
||||
use Rector\StaticTypeMapper\ValueObject\Type\FullyQualifiedObjectType;
|
||||
use Rector\TypeDeclaration\TypeInferer\PropertyTypeInferer;
|
||||
final class PromotedPropertyCandidateResolver
|
||||
{
|
||||
@ -173,29 +173,31 @@ final class PromotedPropertyCandidateResolver
|
||||
$defaultValueType = $this->nodeTypeResolver->getStaticType($param->default);
|
||||
$matchedParamType = $this->typeFactory->createMixedPassedOrUnionType([$matchedParamType, $defaultValueType]);
|
||||
}
|
||||
$isAllFullyQualifiedObjectType = \true;
|
||||
if ($propertyType instanceof \PHPStan\Type\UnionType) {
|
||||
if ($this->hasGenericTemplateType($propertyType)) {
|
||||
return \false;
|
||||
}
|
||||
$isAllFullyQualifiedObjectType = !$this->hasNonFullyQualifiedObjectType($propertyType);
|
||||
if (!$propertyType instanceof \PHPStan\Type\UnionType) {
|
||||
return \false;
|
||||
}
|
||||
// different types, not a good to fit
|
||||
return !$isAllFullyQualifiedObjectType && !$this->typeComparator->areTypesEqual($propertyType, $matchedParamType);
|
||||
if ($this->typeComparator->areTypesEqual($propertyType, $matchedParamType)) {
|
||||
return \false;
|
||||
}
|
||||
// different types, check not has mixed and not has templated generic types
|
||||
if (!$this->hasMixedType($propertyType)) {
|
||||
return \false;
|
||||
}
|
||||
return !$this->hasTemplatedGenericType($propertyType);
|
||||
}
|
||||
private function hasNonFullyQualifiedObjectType(\PHPStan\Type\UnionType $unionType) : bool
|
||||
private function hasTemplatedGenericType(\PHPStan\Type\UnionType $unionType) : bool
|
||||
{
|
||||
foreach ($unionType->getTypes() as $type) {
|
||||
if (!$type instanceof \Rector\StaticTypeMapper\ValueObject\Type\FullyQualifiedObjectType) {
|
||||
if ($type instanceof \PHPStan\Type\Generic\TemplateType) {
|
||||
return \true;
|
||||
}
|
||||
}
|
||||
return \false;
|
||||
}
|
||||
private function hasGenericTemplateType(\PHPStan\Type\UnionType $unionType) : bool
|
||||
private function hasMixedType(\PHPStan\Type\UnionType $unionType) : bool
|
||||
{
|
||||
foreach ($unionType->getTypes() as $type) {
|
||||
if ($type instanceof \PHPStan\Type\Generic\TemplateType) {
|
||||
if ($type instanceof \PHPStan\Type\MixedType) {
|
||||
return \true;
|
||||
}
|
||||
}
|
||||
|
@ -37,7 +37,7 @@ CODE_SAMPLE
|
||||
$someObject = new SomeClass;
|
||||
$someObject->someMethod();
|
||||
CODE_SAMPLE
|
||||
, [self::REMOVED_ARGUMENTS => [new \Rector\Removing\ValueObject\ArgumentRemover('ExampleClass', 'someMethod', 0, 'true')]])]);
|
||||
, [self::REMOVED_ARGUMENTS => [new \Rector\Removing\ValueObject\ArgumentRemover('ExampleClass', 'someMethod', 0, [\true])]])]);
|
||||
}
|
||||
/**
|
||||
* @return array<class-string<Node>>
|
||||
|
@ -16,11 +16,11 @@ final class VersionResolver
|
||||
/**
|
||||
* @var string
|
||||
*/
|
||||
public const PACKAGE_VERSION = 'f78ffe3e9131e7c3fa94c8fe9d467517c4f01449';
|
||||
public const PACKAGE_VERSION = '991ea06c15009442d0a59d8503440681260ae612';
|
||||
/**
|
||||
* @var string
|
||||
*/
|
||||
public const RELEASE_DATE = '2021-08-25 08:49:30';
|
||||
public const RELEASE_DATE = '2021-08-25 14:36:51';
|
||||
public static function resolvePackageVersion() : string
|
||||
{
|
||||
$process = new \RectorPrefix20210825\Symfony\Component\Process\Process(['git', 'log', '--pretty="%H"', '-n1', 'HEAD'], __DIR__);
|
||||
|
2
vendor/autoload.php
vendored
2
vendor/autoload.php
vendored
@ -4,4 +4,4 @@
|
||||
|
||||
require_once __DIR__ . '/composer/autoload_real.php';
|
||||
|
||||
return ComposerAutoloaderInit06caff5fbd7b35f8ec56e8181af6e24a::getLoader();
|
||||
return ComposerAutoloaderInit31e327da48d5e779488d59181d32eec4::getLoader();
|
||||
|
14
vendor/composer/autoload_real.php
vendored
14
vendor/composer/autoload_real.php
vendored
@ -2,7 +2,7 @@
|
||||
|
||||
// autoload_real.php @generated by Composer
|
||||
|
||||
class ComposerAutoloaderInit06caff5fbd7b35f8ec56e8181af6e24a
|
||||
class ComposerAutoloaderInit31e327da48d5e779488d59181d32eec4
|
||||
{
|
||||
private static $loader;
|
||||
|
||||
@ -22,15 +22,15 @@ class ComposerAutoloaderInit06caff5fbd7b35f8ec56e8181af6e24a
|
||||
return self::$loader;
|
||||
}
|
||||
|
||||
spl_autoload_register(array('ComposerAutoloaderInit06caff5fbd7b35f8ec56e8181af6e24a', 'loadClassLoader'), true, true);
|
||||
spl_autoload_register(array('ComposerAutoloaderInit31e327da48d5e779488d59181d32eec4', 'loadClassLoader'), true, true);
|
||||
self::$loader = $loader = new \Composer\Autoload\ClassLoader(\dirname(\dirname(__FILE__)));
|
||||
spl_autoload_unregister(array('ComposerAutoloaderInit06caff5fbd7b35f8ec56e8181af6e24a', 'loadClassLoader'));
|
||||
spl_autoload_unregister(array('ComposerAutoloaderInit31e327da48d5e779488d59181d32eec4', '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\ComposerStaticInit06caff5fbd7b35f8ec56e8181af6e24a::getInitializer($loader));
|
||||
call_user_func(\Composer\Autoload\ComposerStaticInit31e327da48d5e779488d59181d32eec4::getInitializer($loader));
|
||||
} else {
|
||||
$classMap = require __DIR__ . '/autoload_classmap.php';
|
||||
if ($classMap) {
|
||||
@ -42,19 +42,19 @@ class ComposerAutoloaderInit06caff5fbd7b35f8ec56e8181af6e24a
|
||||
$loader->register(true);
|
||||
|
||||
if ($useStaticLoader) {
|
||||
$includeFiles = Composer\Autoload\ComposerStaticInit06caff5fbd7b35f8ec56e8181af6e24a::$files;
|
||||
$includeFiles = Composer\Autoload\ComposerStaticInit31e327da48d5e779488d59181d32eec4::$files;
|
||||
} else {
|
||||
$includeFiles = require __DIR__ . '/autoload_files.php';
|
||||
}
|
||||
foreach ($includeFiles as $fileIdentifier => $file) {
|
||||
composerRequire06caff5fbd7b35f8ec56e8181af6e24a($fileIdentifier, $file);
|
||||
composerRequire31e327da48d5e779488d59181d32eec4($fileIdentifier, $file);
|
||||
}
|
||||
|
||||
return $loader;
|
||||
}
|
||||
}
|
||||
|
||||
function composerRequire06caff5fbd7b35f8ec56e8181af6e24a($fileIdentifier, $file)
|
||||
function composerRequire31e327da48d5e779488d59181d32eec4($fileIdentifier, $file)
|
||||
{
|
||||
if (empty($GLOBALS['__composer_autoload_files'][$fileIdentifier])) {
|
||||
require $file;
|
||||
|
8
vendor/composer/autoload_static.php
vendored
8
vendor/composer/autoload_static.php
vendored
@ -4,7 +4,7 @@
|
||||
|
||||
namespace Composer\Autoload;
|
||||
|
||||
class ComposerStaticInit06caff5fbd7b35f8ec56e8181af6e24a
|
||||
class ComposerStaticInit31e327da48d5e779488d59181d32eec4
|
||||
{
|
||||
public static $files = array (
|
||||
'a4a119a56e50fbb293281d9a48007e0e' => __DIR__ . '/..' . '/symfony/polyfill-php80/bootstrap.php',
|
||||
@ -3856,9 +3856,9 @@ class ComposerStaticInit06caff5fbd7b35f8ec56e8181af6e24a
|
||||
public static function getInitializer(ClassLoader $loader)
|
||||
{
|
||||
return \Closure::bind(function () use ($loader) {
|
||||
$loader->prefixLengthsPsr4 = ComposerStaticInit06caff5fbd7b35f8ec56e8181af6e24a::$prefixLengthsPsr4;
|
||||
$loader->prefixDirsPsr4 = ComposerStaticInit06caff5fbd7b35f8ec56e8181af6e24a::$prefixDirsPsr4;
|
||||
$loader->classMap = ComposerStaticInit06caff5fbd7b35f8ec56e8181af6e24a::$classMap;
|
||||
$loader->prefixLengthsPsr4 = ComposerStaticInit31e327da48d5e779488d59181d32eec4::$prefixLengthsPsr4;
|
||||
$loader->prefixDirsPsr4 = ComposerStaticInit31e327da48d5e779488d59181d32eec4::$prefixDirsPsr4;
|
||||
$loader->classMap = ComposerStaticInit31e327da48d5e779488d59181d32eec4::$classMap;
|
||||
|
||||
}, null, ClassLoader::class);
|
||||
}
|
||||
|
10
vendor/scoper-autoload.php
vendored
10
vendor/scoper-autoload.php
vendored
@ -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('RectorPrefix20210825\AutoloadIncluder');
|
||||
}
|
||||
if (!class_exists('ComposerAutoloaderInit06caff5fbd7b35f8ec56e8181af6e24a', false) && !interface_exists('ComposerAutoloaderInit06caff5fbd7b35f8ec56e8181af6e24a', false) && !trait_exists('ComposerAutoloaderInit06caff5fbd7b35f8ec56e8181af6e24a', false)) {
|
||||
spl_autoload_call('RectorPrefix20210825\ComposerAutoloaderInit06caff5fbd7b35f8ec56e8181af6e24a');
|
||||
if (!class_exists('ComposerAutoloaderInit31e327da48d5e779488d59181d32eec4', false) && !interface_exists('ComposerAutoloaderInit31e327da48d5e779488d59181d32eec4', false) && !trait_exists('ComposerAutoloaderInit31e327da48d5e779488d59181d32eec4', false)) {
|
||||
spl_autoload_call('RectorPrefix20210825\ComposerAutoloaderInit31e327da48d5e779488d59181d32eec4');
|
||||
}
|
||||
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('RectorPrefix20210825\Helmich\TypoScriptParser\Parser\AST\Statement');
|
||||
@ -3308,9 +3308,9 @@ if (!function_exists('print_node')) {
|
||||
return \RectorPrefix20210825\print_node(...func_get_args());
|
||||
}
|
||||
}
|
||||
if (!function_exists('composerRequire06caff5fbd7b35f8ec56e8181af6e24a')) {
|
||||
function composerRequire06caff5fbd7b35f8ec56e8181af6e24a() {
|
||||
return \RectorPrefix20210825\composerRequire06caff5fbd7b35f8ec56e8181af6e24a(...func_get_args());
|
||||
if (!function_exists('composerRequire31e327da48d5e779488d59181d32eec4')) {
|
||||
function composerRequire31e327da48d5e779488d59181d32eec4() {
|
||||
return \RectorPrefix20210825\composerRequire31e327da48d5e779488d59181d32eec4(...func_get_args());
|
||||
}
|
||||
}
|
||||
if (!function_exists('parseArgs')) {
|
||||
|
Loading…
x
Reference in New Issue
Block a user