mirror of
https://github.com/rectorphp/rector.git
synced 2025-01-19 14:27:14 +01:00
Updated Rector to commit 4681067be50a0bbffbb156b39ce2555912b4120d
4681067be5
[DowngradePhp72] Allow empty config on DowngradeParameterTypeWideningRector (#1451)
This commit is contained in:
parent
104a199a7c
commit
4c32c34ab3
@ -8,7 +8,7 @@ use PhpParser\Node\Param;
|
||||
use PhpParser\Node\Stmt\ClassLike;
|
||||
use PhpParser\Node\Stmt\ClassMethod;
|
||||
use PHPStan\Reflection\ClassReflection;
|
||||
use Rector\Core\Contract\Rector\ConfigurableRectorInterface;
|
||||
use Rector\Core\Contract\Rector\AllowEmptyConfigurableRectorInterface;
|
||||
use Rector\Core\Rector\AbstractRector;
|
||||
use Rector\Core\Reflection\ReflectionResolver;
|
||||
use Rector\DowngradePhp72\NodeAnalyzer\BuiltInMethodAnalyzer;
|
||||
@ -25,12 +25,8 @@ use RectorPrefix20211210\Webmozart\Assert\Assert;
|
||||
*
|
||||
* @see \Rector\Tests\DowngradePhp72\Rector\ClassMethod\DowngradeParameterTypeWideningRector\DowngradeParameterTypeWideningRectorTest
|
||||
*/
|
||||
final class DowngradeParameterTypeWideningRector extends \Rector\Core\Rector\AbstractRector implements \Rector\Core\Contract\Rector\ConfigurableRectorInterface
|
||||
final class DowngradeParameterTypeWideningRector extends \Rector\Core\Rector\AbstractRector implements \Rector\Core\Contract\Rector\AllowEmptyConfigurableRectorInterface
|
||||
{
|
||||
/**
|
||||
* @var string
|
||||
*/
|
||||
public const UNSAFE_TYPES_TO_METHODS = 'unsafe_types_to_methods';
|
||||
/**
|
||||
* @var array<string, string[]>
|
||||
*/
|
||||
@ -105,7 +101,7 @@ final class SomeClass implements SomeInterface
|
||||
}
|
||||
}
|
||||
CODE_SAMPLE
|
||||
, [self::UNSAFE_TYPES_TO_METHODS => []])]);
|
||||
, ['ContainerInterface' => ['set', 'get', 'has', 'initialized'], 'SomeContainerInterface' => ['set', 'has']])]);
|
||||
}
|
||||
/**
|
||||
* @return array<class-string<Node>>
|
||||
@ -135,8 +131,7 @@ CODE_SAMPLE
|
||||
*/
|
||||
public function configure(array $configuration) : void
|
||||
{
|
||||
$unsafeTypesToMethods = $configuration[self::UNSAFE_TYPES_TO_METHODS] ?? [];
|
||||
\RectorPrefix20211210\Webmozart\Assert\Assert::isArray($unsafeTypesToMethods);
|
||||
$unsafeTypesToMethods = $configuration;
|
||||
foreach ($unsafeTypesToMethods as $key => $value) {
|
||||
\RectorPrefix20211210\Webmozart\Assert\Assert::string($key);
|
||||
\RectorPrefix20211210\Webmozart\Assert\Assert::allString($value);
|
||||
@ -200,6 +195,9 @@ CODE_SAMPLE
|
||||
}
|
||||
private function isSafeType(\PHPStan\Reflection\ClassReflection $classReflection, \PhpParser\Node\Stmt\ClassMethod $classMethod) : bool
|
||||
{
|
||||
if ($this->unsafeTypesToMethods === []) {
|
||||
return \false;
|
||||
}
|
||||
$classReflectionName = $classReflection->getName();
|
||||
foreach ($this->unsafeTypesToMethods as $unsafeType => $unsafeMethods) {
|
||||
if (!$this->isNames($classMethod, $unsafeMethods)) {
|
||||
|
@ -16,11 +16,11 @@ final class VersionResolver
|
||||
/**
|
||||
* @var string
|
||||
*/
|
||||
public const PACKAGE_VERSION = '8d6eb87e9950a2b77b3736d36220caf01ccd5840';
|
||||
public const PACKAGE_VERSION = '4681067be50a0bbffbb156b39ce2555912b4120d';
|
||||
/**
|
||||
* @var string
|
||||
*/
|
||||
public const RELEASE_DATE = '2021-12-10 18:39:42';
|
||||
public const RELEASE_DATE = '2021-12-11 00:57:03';
|
||||
public static function resolvePackageVersion() : string
|
||||
{
|
||||
$process = new \RectorPrefix20211210\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 ComposerAutoloaderInitf63c2a246057bf87bc52a68ecc786045::getLoader();
|
||||
return ComposerAutoloaderInit3bbdc288c720483ba2976f711caba9e3::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 ComposerAutoloaderInitf63c2a246057bf87bc52a68ecc786045
|
||||
class ComposerAutoloaderInit3bbdc288c720483ba2976f711caba9e3
|
||||
{
|
||||
private static $loader;
|
||||
|
||||
@ -22,15 +22,15 @@ class ComposerAutoloaderInitf63c2a246057bf87bc52a68ecc786045
|
||||
return self::$loader;
|
||||
}
|
||||
|
||||
spl_autoload_register(array('ComposerAutoloaderInitf63c2a246057bf87bc52a68ecc786045', 'loadClassLoader'), true, true);
|
||||
spl_autoload_register(array('ComposerAutoloaderInit3bbdc288c720483ba2976f711caba9e3', 'loadClassLoader'), true, true);
|
||||
self::$loader = $loader = new \Composer\Autoload\ClassLoader(\dirname(\dirname(__FILE__)));
|
||||
spl_autoload_unregister(array('ComposerAutoloaderInitf63c2a246057bf87bc52a68ecc786045', 'loadClassLoader'));
|
||||
spl_autoload_unregister(array('ComposerAutoloaderInit3bbdc288c720483ba2976f711caba9e3', '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\ComposerStaticInitf63c2a246057bf87bc52a68ecc786045::getInitializer($loader));
|
||||
call_user_func(\Composer\Autoload\ComposerStaticInit3bbdc288c720483ba2976f711caba9e3::getInitializer($loader));
|
||||
} else {
|
||||
$classMap = require __DIR__ . '/autoload_classmap.php';
|
||||
if ($classMap) {
|
||||
@ -42,19 +42,19 @@ class ComposerAutoloaderInitf63c2a246057bf87bc52a68ecc786045
|
||||
$loader->register(true);
|
||||
|
||||
if ($useStaticLoader) {
|
||||
$includeFiles = Composer\Autoload\ComposerStaticInitf63c2a246057bf87bc52a68ecc786045::$files;
|
||||
$includeFiles = Composer\Autoload\ComposerStaticInit3bbdc288c720483ba2976f711caba9e3::$files;
|
||||
} else {
|
||||
$includeFiles = require __DIR__ . '/autoload_files.php';
|
||||
}
|
||||
foreach ($includeFiles as $fileIdentifier => $file) {
|
||||
composerRequiref63c2a246057bf87bc52a68ecc786045($fileIdentifier, $file);
|
||||
composerRequire3bbdc288c720483ba2976f711caba9e3($fileIdentifier, $file);
|
||||
}
|
||||
|
||||
return $loader;
|
||||
}
|
||||
}
|
||||
|
||||
function composerRequiref63c2a246057bf87bc52a68ecc786045($fileIdentifier, $file)
|
||||
function composerRequire3bbdc288c720483ba2976f711caba9e3($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 ComposerStaticInitf63c2a246057bf87bc52a68ecc786045
|
||||
class ComposerStaticInit3bbdc288c720483ba2976f711caba9e3
|
||||
{
|
||||
public static $files = array (
|
||||
'320cde22f66dd4f5d3fd621d3e88b98f' => __DIR__ . '/..' . '/symfony/polyfill-ctype/bootstrap.php',
|
||||
@ -3795,9 +3795,9 @@ class ComposerStaticInitf63c2a246057bf87bc52a68ecc786045
|
||||
public static function getInitializer(ClassLoader $loader)
|
||||
{
|
||||
return \Closure::bind(function () use ($loader) {
|
||||
$loader->prefixLengthsPsr4 = ComposerStaticInitf63c2a246057bf87bc52a68ecc786045::$prefixLengthsPsr4;
|
||||
$loader->prefixDirsPsr4 = ComposerStaticInitf63c2a246057bf87bc52a68ecc786045::$prefixDirsPsr4;
|
||||
$loader->classMap = ComposerStaticInitf63c2a246057bf87bc52a68ecc786045::$classMap;
|
||||
$loader->prefixLengthsPsr4 = ComposerStaticInit3bbdc288c720483ba2976f711caba9e3::$prefixLengthsPsr4;
|
||||
$loader->prefixDirsPsr4 = ComposerStaticInit3bbdc288c720483ba2976f711caba9e3::$prefixDirsPsr4;
|
||||
$loader->classMap = ComposerStaticInit3bbdc288c720483ba2976f711caba9e3::$classMap;
|
||||
|
||||
}, null, ClassLoader::class);
|
||||
}
|
||||
|
10
vendor/scoper-autoload.php
vendored
10
vendor/scoper-autoload.php
vendored
@ -12,8 +12,8 @@ if (!class_exists('GenerateChangelogCommand', false) && !interface_exists('Gener
|
||||
if (!class_exists('AutoloadIncluder', false) && !interface_exists('AutoloadIncluder', false) && !trait_exists('AutoloadIncluder', false)) {
|
||||
spl_autoload_call('RectorPrefix20211210\AutoloadIncluder');
|
||||
}
|
||||
if (!class_exists('ComposerAutoloaderInitf63c2a246057bf87bc52a68ecc786045', false) && !interface_exists('ComposerAutoloaderInitf63c2a246057bf87bc52a68ecc786045', false) && !trait_exists('ComposerAutoloaderInitf63c2a246057bf87bc52a68ecc786045', false)) {
|
||||
spl_autoload_call('RectorPrefix20211210\ComposerAutoloaderInitf63c2a246057bf87bc52a68ecc786045');
|
||||
if (!class_exists('ComposerAutoloaderInit3bbdc288c720483ba2976f711caba9e3', false) && !interface_exists('ComposerAutoloaderInit3bbdc288c720483ba2976f711caba9e3', false) && !trait_exists('ComposerAutoloaderInit3bbdc288c720483ba2976f711caba9e3', false)) {
|
||||
spl_autoload_call('RectorPrefix20211210\ComposerAutoloaderInit3bbdc288c720483ba2976f711caba9e3');
|
||||
}
|
||||
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('RectorPrefix20211210\Helmich\TypoScriptParser\Parser\AST\Statement');
|
||||
@ -81,9 +81,9 @@ if (!function_exists('print_node')) {
|
||||
return \RectorPrefix20211210\print_node(...func_get_args());
|
||||
}
|
||||
}
|
||||
if (!function_exists('composerRequiref63c2a246057bf87bc52a68ecc786045')) {
|
||||
function composerRequiref63c2a246057bf87bc52a68ecc786045() {
|
||||
return \RectorPrefix20211210\composerRequiref63c2a246057bf87bc52a68ecc786045(...func_get_args());
|
||||
if (!function_exists('composerRequire3bbdc288c720483ba2976f711caba9e3')) {
|
||||
function composerRequire3bbdc288c720483ba2976f711caba9e3() {
|
||||
return \RectorPrefix20211210\composerRequire3bbdc288c720483ba2976f711caba9e3(...func_get_args());
|
||||
}
|
||||
}
|
||||
if (!function_exists('scanPath')) {
|
||||
|
Loading…
x
Reference in New Issue
Block a user