mirror of
https://github.com/rectorphp/rector.git
synced 2024-05-31 00:10:51 +00:00
Updated Rector to commit b5516368d4
b5516368d4
[Php74] Add privatePropertyOnly config to TypedPropertyRector (#898)
This commit is contained in:
parent
300188a298
commit
6672a6759e
|
@ -7638,6 +7638,7 @@ return static function (ContainerConfigurator $containerConfigurator): void {
|
|||
$services->set(TypedPropertyRector::class)
|
||||
->call('configure', [[
|
||||
TypedPropertyRector::CLASS_LIKE_TYPE_ONLY => false,
|
||||
TypedPropertyRector::PRIVATE_PROPERTY_ONLY => false,
|
||||
]]);
|
||||
};
|
||||
```
|
||||
|
|
|
@ -43,11 +43,21 @@ final class TypedPropertyRector extends \Rector\Core\Rector\AbstractRector imple
|
|||
* @var string
|
||||
*/
|
||||
public const CLASS_LIKE_TYPE_ONLY = 'class_like_type_only';
|
||||
/**
|
||||
* @var string
|
||||
*/
|
||||
public const PRIVATE_PROPERTY_ONLY = 'PRIVATE_PROPERTY_ONLY';
|
||||
/**
|
||||
* Useful for refactoring of huge applications. Taking types first narrows scope
|
||||
* @var bool
|
||||
*/
|
||||
private $classLikeTypeOnly = \false;
|
||||
/**
|
||||
* If want to keep BC, it can be set to true
|
||||
* @see https://3v4l.org/spl4P
|
||||
* @var bool
|
||||
*/
|
||||
private $privatePropertyOnly = \false;
|
||||
/**
|
||||
* @var \Rector\TypeDeclaration\TypeInferer\PropertyTypeInferer
|
||||
*/
|
||||
|
@ -103,7 +113,7 @@ final class SomeClass
|
|||
private int $count;
|
||||
}
|
||||
CODE_SAMPLE
|
||||
, [self::CLASS_LIKE_TYPE_ONLY => \false])]);
|
||||
, [self::CLASS_LIKE_TYPE_ONLY => \false, self::PRIVATE_PROPERTY_ONLY => \false])]);
|
||||
}
|
||||
/**
|
||||
* @return array<class-string<Node>>
|
||||
|
@ -151,6 +161,7 @@ CODE_SAMPLE
|
|||
public function configure(array $configuration) : void
|
||||
{
|
||||
$this->classLikeTypeOnly = $configuration[self::CLASS_LIKE_TYPE_ONLY] ?? \false;
|
||||
$this->privatePropertyOnly = $configuration[self::PRIVATE_PROPERTY_ONLY] ?? \false;
|
||||
}
|
||||
public function provideMinPhpVersion() : int
|
||||
{
|
||||
|
@ -234,6 +245,9 @@ CODE_SAMPLE
|
|||
return \true;
|
||||
}
|
||||
// skip multiple properties
|
||||
return \count($property->props) > 1;
|
||||
if (\count($property->props) > 1) {
|
||||
return \true;
|
||||
}
|
||||
return $this->privatePropertyOnly && !$property->isPrivate();
|
||||
}
|
||||
}
|
||||
|
|
|
@ -16,11 +16,11 @@ final class VersionResolver
|
|||
/**
|
||||
* @var string
|
||||
*/
|
||||
public const PACKAGE_VERSION = '3ff17513c47ace5c6a71ef4f918f33a8fa183a7b';
|
||||
public const PACKAGE_VERSION = 'b5516368d4c2ad63afc8a9a1f0d2ed997f1eb202';
|
||||
/**
|
||||
* @var string
|
||||
*/
|
||||
public const RELEASE_DATE = '2021-09-19 11:02:33';
|
||||
public const RELEASE_DATE = '2021-09-19 12:06:08';
|
||||
public static function resolvePackageVersion() : string
|
||||
{
|
||||
$process = new \RectorPrefix20210919\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 ComposerAutoloaderInit34f2d773ddf7d761551322a8fa07b86e::getLoader();
|
||||
return ComposerAutoloaderInitb73967c99942f44a43c4b9e971bd0f93::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 ComposerAutoloaderInit34f2d773ddf7d761551322a8fa07b86e
|
||||
class ComposerAutoloaderInitb73967c99942f44a43c4b9e971bd0f93
|
||||
{
|
||||
private static $loader;
|
||||
|
||||
|
@ -22,15 +22,15 @@ class ComposerAutoloaderInit34f2d773ddf7d761551322a8fa07b86e
|
|||
return self::$loader;
|
||||
}
|
||||
|
||||
spl_autoload_register(array('ComposerAutoloaderInit34f2d773ddf7d761551322a8fa07b86e', 'loadClassLoader'), true, true);
|
||||
spl_autoload_register(array('ComposerAutoloaderInitb73967c99942f44a43c4b9e971bd0f93', 'loadClassLoader'), true, true);
|
||||
self::$loader = $loader = new \Composer\Autoload\ClassLoader(\dirname(\dirname(__FILE__)));
|
||||
spl_autoload_unregister(array('ComposerAutoloaderInit34f2d773ddf7d761551322a8fa07b86e', 'loadClassLoader'));
|
||||
spl_autoload_unregister(array('ComposerAutoloaderInitb73967c99942f44a43c4b9e971bd0f93', '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\ComposerStaticInit34f2d773ddf7d761551322a8fa07b86e::getInitializer($loader));
|
||||
call_user_func(\Composer\Autoload\ComposerStaticInitb73967c99942f44a43c4b9e971bd0f93::getInitializer($loader));
|
||||
} else {
|
||||
$classMap = require __DIR__ . '/autoload_classmap.php';
|
||||
if ($classMap) {
|
||||
|
@ -42,19 +42,19 @@ class ComposerAutoloaderInit34f2d773ddf7d761551322a8fa07b86e
|
|||
$loader->register(true);
|
||||
|
||||
if ($useStaticLoader) {
|
||||
$includeFiles = Composer\Autoload\ComposerStaticInit34f2d773ddf7d761551322a8fa07b86e::$files;
|
||||
$includeFiles = Composer\Autoload\ComposerStaticInitb73967c99942f44a43c4b9e971bd0f93::$files;
|
||||
} else {
|
||||
$includeFiles = require __DIR__ . '/autoload_files.php';
|
||||
}
|
||||
foreach ($includeFiles as $fileIdentifier => $file) {
|
||||
composerRequire34f2d773ddf7d761551322a8fa07b86e($fileIdentifier, $file);
|
||||
composerRequireb73967c99942f44a43c4b9e971bd0f93($fileIdentifier, $file);
|
||||
}
|
||||
|
||||
return $loader;
|
||||
}
|
||||
}
|
||||
|
||||
function composerRequire34f2d773ddf7d761551322a8fa07b86e($fileIdentifier, $file)
|
||||
function composerRequireb73967c99942f44a43c4b9e971bd0f93($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 ComposerStaticInit34f2d773ddf7d761551322a8fa07b86e
|
||||
class ComposerStaticInitb73967c99942f44a43c4b9e971bd0f93
|
||||
{
|
||||
public static $files = array (
|
||||
'a4a119a56e50fbb293281d9a48007e0e' => __DIR__ . '/..' . '/symfony/polyfill-php80/bootstrap.php',
|
||||
|
@ -3859,9 +3859,9 @@ class ComposerStaticInit34f2d773ddf7d761551322a8fa07b86e
|
|||
public static function getInitializer(ClassLoader $loader)
|
||||
{
|
||||
return \Closure::bind(function () use ($loader) {
|
||||
$loader->prefixLengthsPsr4 = ComposerStaticInit34f2d773ddf7d761551322a8fa07b86e::$prefixLengthsPsr4;
|
||||
$loader->prefixDirsPsr4 = ComposerStaticInit34f2d773ddf7d761551322a8fa07b86e::$prefixDirsPsr4;
|
||||
$loader->classMap = ComposerStaticInit34f2d773ddf7d761551322a8fa07b86e::$classMap;
|
||||
$loader->prefixLengthsPsr4 = ComposerStaticInitb73967c99942f44a43c4b9e971bd0f93::$prefixLengthsPsr4;
|
||||
$loader->prefixDirsPsr4 = ComposerStaticInitb73967c99942f44a43c4b9e971bd0f93::$prefixDirsPsr4;
|
||||
$loader->classMap = ComposerStaticInitb73967c99942f44a43c4b9e971bd0f93::$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('RectorPrefix20210919\AutoloadIncluder');
|
||||
}
|
||||
if (!class_exists('ComposerAutoloaderInit34f2d773ddf7d761551322a8fa07b86e', false) && !interface_exists('ComposerAutoloaderInit34f2d773ddf7d761551322a8fa07b86e', false) && !trait_exists('ComposerAutoloaderInit34f2d773ddf7d761551322a8fa07b86e', false)) {
|
||||
spl_autoload_call('RectorPrefix20210919\ComposerAutoloaderInit34f2d773ddf7d761551322a8fa07b86e');
|
||||
if (!class_exists('ComposerAutoloaderInitb73967c99942f44a43c4b9e971bd0f93', false) && !interface_exists('ComposerAutoloaderInitb73967c99942f44a43c4b9e971bd0f93', false) && !trait_exists('ComposerAutoloaderInitb73967c99942f44a43c4b9e971bd0f93', false)) {
|
||||
spl_autoload_call('RectorPrefix20210919\ComposerAutoloaderInitb73967c99942f44a43c4b9e971bd0f93');
|
||||
}
|
||||
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('RectorPrefix20210919\Helmich\TypoScriptParser\Parser\AST\Statement');
|
||||
|
@ -3311,9 +3311,9 @@ if (!function_exists('print_node')) {
|
|||
return \RectorPrefix20210919\print_node(...func_get_args());
|
||||
}
|
||||
}
|
||||
if (!function_exists('composerRequire34f2d773ddf7d761551322a8fa07b86e')) {
|
||||
function composerRequire34f2d773ddf7d761551322a8fa07b86e() {
|
||||
return \RectorPrefix20210919\composerRequire34f2d773ddf7d761551322a8fa07b86e(...func_get_args());
|
||||
if (!function_exists('composerRequireb73967c99942f44a43c4b9e971bd0f93')) {
|
||||
function composerRequireb73967c99942f44a43c4b9e971bd0f93() {
|
||||
return \RectorPrefix20210919\composerRequireb73967c99942f44a43c4b9e971bd0f93(...func_get_args());
|
||||
}
|
||||
}
|
||||
if (!function_exists('parseArgs')) {
|
||||
|
|
Loading…
Reference in New Issue
Block a user