mirror of
https://github.com/rectorphp/rector.git
synced 2025-01-17 21:38:22 +01:00
Updated Rector to commit d670c9351974baf819647e13012c0d685748ae01
d670c93519
[DX] Deprecate disabling of import options to keep configuration simpler (#1817)
This commit is contained in:
parent
c9ec5e7c55
commit
faf3d546ae
@ -3,8 +3,12 @@
|
||||
Rector works with all class names as fully qualified by default, so it knows the exact types. In most coding standard, that's not desired behavior, because short version with `use` statement is preferred:
|
||||
|
||||
```diff
|
||||
-$object = new \App\Some\Namespace\SomeClass();
|
||||
+use App\Some\Namespace\SomeClass;
|
||||
|
||||
-/** @var \App\Some\Namespace\SomeClass $object */
|
||||
+/** @var SomeClass $object */
|
||||
|
||||
-$object = new \App\Some\Namespace\SomeClass();
|
||||
+$object = new SomeClass();
|
||||
```
|
||||
|
||||
@ -17,23 +21,6 @@ $parameters->set(Option::AUTO_IMPORT_NAMES, true);
|
||||
|
||||
<br>
|
||||
|
||||
If you enable this feature, the class names in docblocks are imported as well:
|
||||
|
||||
```diff
|
||||
+use App\Some\Namespace\SomeClass;
|
||||
-/** @var \App\Some\Namespace\SomeClass $someClass */
|
||||
+/** @var SomeClass $someClass */
|
||||
$someClass = ...;
|
||||
```
|
||||
|
||||
Do you want to skip them?
|
||||
|
||||
```php
|
||||
$parameters->set(Option::IMPORT_DOC_BLOCKS, false);
|
||||
```
|
||||
|
||||
<br>
|
||||
|
||||
Single short classes are imported too:
|
||||
|
||||
```diff
|
||||
|
@ -86,9 +86,6 @@ final class NameImportingPostRector extends \Rector\PostRector\Rector\AbstractPo
|
||||
if ($node instanceof \PhpParser\Node\Name) {
|
||||
return $this->processNodeName($node, $file);
|
||||
}
|
||||
if (!$this->parameterProvider->provideBoolParameter(\Rector\Core\Configuration\Option::IMPORT_DOC_BLOCKS)) {
|
||||
return null;
|
||||
}
|
||||
$phpDocInfo = $this->phpDocInfoFactory->createFromNodeOrEmpty($node);
|
||||
$this->docBlockNameImporter->importNames($phpDocInfo->getPhpDocNode(), $node);
|
||||
return $node;
|
||||
|
@ -16,11 +16,11 @@ final class VersionResolver
|
||||
/**
|
||||
* @var string
|
||||
*/
|
||||
public const PACKAGE_VERSION = '10e8d3e25c12491608ec097539b456ae55d891eb';
|
||||
public const PACKAGE_VERSION = 'd670c9351974baf819647e13012c0d685748ae01';
|
||||
/**
|
||||
* @var string
|
||||
*/
|
||||
public const RELEASE_DATE = '2022-02-15 20:00:30';
|
||||
public const RELEASE_DATE = '2022-02-15 21:00:07';
|
||||
public static function resolvePackageVersion() : string
|
||||
{
|
||||
$process = new \RectorPrefix20220215\Symfony\Component\Process\Process(['git', 'log', '--pretty="%H"', '-n1', 'HEAD'], __DIR__);
|
||||
|
@ -51,6 +51,7 @@ final class Option
|
||||
*/
|
||||
public const IMPORT_SHORT_CLASSES = 'import_short_classes';
|
||||
/**
|
||||
* @deprecated Narrow too complex import settings to more practical use.
|
||||
* @var string
|
||||
*/
|
||||
public const IMPORT_DOC_BLOCKS = 'import_doc_blocks';
|
||||
@ -66,11 +67,6 @@ final class Option
|
||||
* @var string
|
||||
*/
|
||||
public const PARALLEL = 'parallel';
|
||||
/**
|
||||
* @deprecated Cache is enabled by default
|
||||
* @var string
|
||||
*/
|
||||
public const ENABLE_CACHE = 'enable_cache';
|
||||
/**
|
||||
* @var string
|
||||
*/
|
||||
|
2
vendor/autoload.php
vendored
2
vendor/autoload.php
vendored
@ -4,4 +4,4 @@
|
||||
|
||||
require_once __DIR__ . '/composer/autoload_real.php';
|
||||
|
||||
return ComposerAutoloaderInit08827f02229f8f39cfe8775c59e36827::getLoader();
|
||||
return ComposerAutoloaderInit9777dce46c36b08b10d3e48396a1895f::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 ComposerAutoloaderInit08827f02229f8f39cfe8775c59e36827
|
||||
class ComposerAutoloaderInit9777dce46c36b08b10d3e48396a1895f
|
||||
{
|
||||
private static $loader;
|
||||
|
||||
@ -22,15 +22,15 @@ class ComposerAutoloaderInit08827f02229f8f39cfe8775c59e36827
|
||||
return self::$loader;
|
||||
}
|
||||
|
||||
spl_autoload_register(array('ComposerAutoloaderInit08827f02229f8f39cfe8775c59e36827', 'loadClassLoader'), true, true);
|
||||
spl_autoload_register(array('ComposerAutoloaderInit9777dce46c36b08b10d3e48396a1895f', 'loadClassLoader'), true, true);
|
||||
self::$loader = $loader = new \Composer\Autoload\ClassLoader(\dirname(\dirname(__FILE__)));
|
||||
spl_autoload_unregister(array('ComposerAutoloaderInit08827f02229f8f39cfe8775c59e36827', 'loadClassLoader'));
|
||||
spl_autoload_unregister(array('ComposerAutoloaderInit9777dce46c36b08b10d3e48396a1895f', '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\ComposerStaticInit08827f02229f8f39cfe8775c59e36827::getInitializer($loader));
|
||||
call_user_func(\Composer\Autoload\ComposerStaticInit9777dce46c36b08b10d3e48396a1895f::getInitializer($loader));
|
||||
} else {
|
||||
$classMap = require __DIR__ . '/autoload_classmap.php';
|
||||
if ($classMap) {
|
||||
@ -42,12 +42,12 @@ class ComposerAutoloaderInit08827f02229f8f39cfe8775c59e36827
|
||||
$loader->register(true);
|
||||
|
||||
if ($useStaticLoader) {
|
||||
$includeFiles = Composer\Autoload\ComposerStaticInit08827f02229f8f39cfe8775c59e36827::$files;
|
||||
$includeFiles = Composer\Autoload\ComposerStaticInit9777dce46c36b08b10d3e48396a1895f::$files;
|
||||
} else {
|
||||
$includeFiles = require __DIR__ . '/autoload_files.php';
|
||||
}
|
||||
foreach ($includeFiles as $fileIdentifier => $file) {
|
||||
composerRequire08827f02229f8f39cfe8775c59e36827($fileIdentifier, $file);
|
||||
composerRequire9777dce46c36b08b10d3e48396a1895f($fileIdentifier, $file);
|
||||
}
|
||||
|
||||
return $loader;
|
||||
@ -59,7 +59,7 @@ class ComposerAutoloaderInit08827f02229f8f39cfe8775c59e36827
|
||||
* @param string $file
|
||||
* @return void
|
||||
*/
|
||||
function composerRequire08827f02229f8f39cfe8775c59e36827($fileIdentifier, $file)
|
||||
function composerRequire9777dce46c36b08b10d3e48396a1895f($fileIdentifier, $file)
|
||||
{
|
||||
if (empty($GLOBALS['__composer_autoload_files'][$fileIdentifier])) {
|
||||
$GLOBALS['__composer_autoload_files'][$fileIdentifier] = true;
|
||||
|
8
vendor/composer/autoload_static.php
vendored
8
vendor/composer/autoload_static.php
vendored
@ -4,7 +4,7 @@
|
||||
|
||||
namespace Composer\Autoload;
|
||||
|
||||
class ComposerStaticInit08827f02229f8f39cfe8775c59e36827
|
||||
class ComposerStaticInit9777dce46c36b08b10d3e48396a1895f
|
||||
{
|
||||
public static $files = array (
|
||||
'0e6d7bf4a5811bfa5cf40c5ccd6fae6a' => __DIR__ . '/..' . '/symfony/polyfill-mbstring/bootstrap.php',
|
||||
@ -3881,9 +3881,9 @@ class ComposerStaticInit08827f02229f8f39cfe8775c59e36827
|
||||
public static function getInitializer(ClassLoader $loader)
|
||||
{
|
||||
return \Closure::bind(function () use ($loader) {
|
||||
$loader->prefixLengthsPsr4 = ComposerStaticInit08827f02229f8f39cfe8775c59e36827::$prefixLengthsPsr4;
|
||||
$loader->prefixDirsPsr4 = ComposerStaticInit08827f02229f8f39cfe8775c59e36827::$prefixDirsPsr4;
|
||||
$loader->classMap = ComposerStaticInit08827f02229f8f39cfe8775c59e36827::$classMap;
|
||||
$loader->prefixLengthsPsr4 = ComposerStaticInit9777dce46c36b08b10d3e48396a1895f::$prefixLengthsPsr4;
|
||||
$loader->prefixDirsPsr4 = ComposerStaticInit9777dce46c36b08b10d3e48396a1895f::$prefixDirsPsr4;
|
||||
$loader->classMap = ComposerStaticInit9777dce46c36b08b10d3e48396a1895f::$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('RectorPrefix20220215\AutoloadIncluder');
|
||||
}
|
||||
if (!class_exists('ComposerAutoloaderInit08827f02229f8f39cfe8775c59e36827', false) && !interface_exists('ComposerAutoloaderInit08827f02229f8f39cfe8775c59e36827', false) && !trait_exists('ComposerAutoloaderInit08827f02229f8f39cfe8775c59e36827', false)) {
|
||||
spl_autoload_call('RectorPrefix20220215\ComposerAutoloaderInit08827f02229f8f39cfe8775c59e36827');
|
||||
if (!class_exists('ComposerAutoloaderInit9777dce46c36b08b10d3e48396a1895f', false) && !interface_exists('ComposerAutoloaderInit9777dce46c36b08b10d3e48396a1895f', false) && !trait_exists('ComposerAutoloaderInit9777dce46c36b08b10d3e48396a1895f', false)) {
|
||||
spl_autoload_call('RectorPrefix20220215\ComposerAutoloaderInit9777dce46c36b08b10d3e48396a1895f');
|
||||
}
|
||||
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('RectorPrefix20220215\Helmich\TypoScriptParser\Parser\AST\Statement');
|
||||
@ -59,9 +59,9 @@ if (!function_exists('print_node')) {
|
||||
return \RectorPrefix20220215\print_node(...func_get_args());
|
||||
}
|
||||
}
|
||||
if (!function_exists('composerRequire08827f02229f8f39cfe8775c59e36827')) {
|
||||
function composerRequire08827f02229f8f39cfe8775c59e36827() {
|
||||
return \RectorPrefix20220215\composerRequire08827f02229f8f39cfe8775c59e36827(...func_get_args());
|
||||
if (!function_exists('composerRequire9777dce46c36b08b10d3e48396a1895f')) {
|
||||
function composerRequire9777dce46c36b08b10d3e48396a1895f() {
|
||||
return \RectorPrefix20220215\composerRequire9777dce46c36b08b10d3e48396a1895f(...func_get_args());
|
||||
}
|
||||
}
|
||||
if (!function_exists('scanPath')) {
|
||||
|
Loading…
x
Reference in New Issue
Block a user