mirror of
https://github.com/rectorphp/rector.git
synced 2024-05-28 23:10:51 +00:00
Updated Rector to commit 6554750698
6554750698
[automated] Apply Coding Standard (#308)
This commit is contained in:
parent
5a0a45ded6
commit
7d23c365ed
|
@ -1,4 +1,4 @@
|
|||
# 494 Rules Overview
|
||||
# 495 Rules Overview
|
||||
|
||||
<br>
|
||||
|
||||
|
@ -18,7 +18,7 @@
|
|||
|
||||
- [Composer](#composer) (6)
|
||||
|
||||
- [DeadCode](#deadcode) (48)
|
||||
- [DeadCode](#deadcode) (46)
|
||||
|
||||
- [Defluent](#defluent) (9)
|
||||
|
||||
|
@ -48,7 +48,7 @@
|
|||
|
||||
- [MysqlToMysqli](#mysqltomysqli) (4)
|
||||
|
||||
- [Naming](#naming) (7)
|
||||
- [Naming](#naming) (9)
|
||||
|
||||
- [Order](#order) (1)
|
||||
|
||||
|
@ -96,7 +96,7 @@
|
|||
|
||||
- [Transform](#transform) (36)
|
||||
|
||||
- [TypeDeclaration](#typedeclaration) (18)
|
||||
- [TypeDeclaration](#typedeclaration) (19)
|
||||
|
||||
- [Visibility](#visibility) (3)
|
||||
|
||||
|
@ -3586,45 +3586,6 @@ Remove unused parent call with no parent class
|
|||
|
||||
<br>
|
||||
|
||||
### RemovePhpVersionIdCheckRector
|
||||
|
||||
Remove unneded PHP_VERSION_ID check
|
||||
|
||||
:wrench: **configure it!**
|
||||
|
||||
- class: [`Rector\DeadCode\Rector\ConstFetch\RemovePhpVersionIdCheckRector`](../rules/DeadCode/Rector/ConstFetch/RemovePhpVersionIdCheckRector.php)
|
||||
|
||||
```php
|
||||
use Rector\DeadCode\Rector\ConstFetch\RemovePhpVersionIdCheckRector;
|
||||
use Symfony\Component\DependencyInjection\Loader\Configurator\ContainerConfigurator;
|
||||
|
||||
return static function (ContainerConfigurator $containerConfigurator): void {
|
||||
$services = $containerConfigurator->services();
|
||||
|
||||
$services->set(RemovePhpVersionIdCheckRector::class)
|
||||
->call('configure', [[
|
||||
RemovePhpVersionIdCheckRector::PHP_VERSION_CONSTRAINT => 80000,
|
||||
]]);
|
||||
};
|
||||
```
|
||||
|
||||
↓
|
||||
|
||||
```diff
|
||||
class SomeClass
|
||||
{
|
||||
public function run()
|
||||
{
|
||||
- if (PHP_VERSION_ID < 80000) {
|
||||
- return;
|
||||
- }
|
||||
echo 'do something';
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||
<br>
|
||||
|
||||
### RemoveUnreachableStatementRector
|
||||
|
||||
Remove unreachable statements
|
||||
|
@ -3808,30 +3769,6 @@ Remove unused private properties
|
|||
|
||||
<br>
|
||||
|
||||
### RemoveUnusedPromotedPropertyRector
|
||||
|
||||
Remove unused promoted property
|
||||
|
||||
- class: [`Rector\DeadCode\Rector\ClassMethod\RemoveUnusedPromotedPropertyRector`](../rules/DeadCode/Rector/ClassMethod/RemoveUnusedPromotedPropertyRector.php)
|
||||
|
||||
```diff
|
||||
class SomeClass
|
||||
{
|
||||
public function __construct(
|
||||
- private $someUnusedDependency,
|
||||
private $usedDependency
|
||||
) {
|
||||
}
|
||||
|
||||
public function getUsedDependency()
|
||||
{
|
||||
return $this->usedDependency;
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||
<br>
|
||||
|
||||
### RemoveUnusedVariableAssignRector
|
||||
|
||||
Remove unused assigns to variables
|
||||
|
@ -5246,7 +5183,10 @@ return static function (ContainerConfigurator $containerConfigurator): void {
|
|||
$services->set(DowngradeAttributeToAnnotationRector::class)
|
||||
->call('configure', [[
|
||||
DowngradeAttributeToAnnotationRector::ATTRIBUTE_TO_ANNOTATION => ValueObjectInliner::inline([
|
||||
new DowngradeAttributeToAnnotation('Symfony\Component\Routing\Annotation\Route', null),
|
||||
new DowngradeAttributeToAnnotation(
|
||||
'Symfony\Component\Routing\Annotation\Route',
|
||||
'Symfony\Component\Routing\Annotation\Route'
|
||||
),
|
||||
]),
|
||||
]]);
|
||||
};
|
||||
|
@ -6067,6 +6007,54 @@ Renames property to respect is/has/was method naming
|
|||
|
||||
<br>
|
||||
|
||||
### MakeGetterClassMethodNameStartWithGetRector
|
||||
|
||||
Change getter method names to start with get/provide
|
||||
|
||||
- class: [`Rector\Naming\Rector\ClassMethod\MakeGetterClassMethodNameStartWithGetRector`](../rules/Naming/Rector/ClassMethod/MakeGetterClassMethodNameStartWithGetRector.php)
|
||||
|
||||
```diff
|
||||
class SomeClass
|
||||
{
|
||||
/**
|
||||
* @var string
|
||||
*/
|
||||
private $name;
|
||||
|
||||
- public function name(): string
|
||||
+ public function getName(): string
|
||||
{
|
||||
return $this->name;
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||
<br>
|
||||
|
||||
### MakeIsserClassMethodNameStartWithIsRector
|
||||
|
||||
Change is method names to start with is/has/was
|
||||
|
||||
- class: [`Rector\Naming\Rector\ClassMethod\MakeIsserClassMethodNameStartWithIsRector`](../rules/Naming/Rector/ClassMethod/MakeIsserClassMethodNameStartWithIsRector.php)
|
||||
|
||||
```diff
|
||||
class SomeClass
|
||||
{
|
||||
/**
|
||||
* @var bool
|
||||
*/
|
||||
private $isActive = false;
|
||||
|
||||
- public function getIsActive()
|
||||
+ public function isActive()
|
||||
{
|
||||
return $this->isActive;
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||
<br>
|
||||
|
||||
### RenameForeachValueVariableToMatchExprVariableRector
|
||||
|
||||
Renames value variable name in foreach loop to match expression variable
|
||||
|
@ -11912,26 +11900,8 @@ Add known return type to functions
|
|||
|
||||
Change param type to strict type of passed expression
|
||||
|
||||
:wrench: **configure it!**
|
||||
|
||||
- class: [`Rector\TypeDeclaration\Rector\ClassMethod\AddMethodCallBasedStrictParamTypeRector`](../rules/TypeDeclaration/Rector/ClassMethod/AddMethodCallBasedStrictParamTypeRector.php)
|
||||
|
||||
```php
|
||||
use Rector\TypeDeclaration\Rector\ClassMethod\AddMethodCallBasedStrictParamTypeRector;
|
||||
use Symfony\Component\DependencyInjection\Loader\Configurator\ContainerConfigurator;
|
||||
|
||||
return static function (ContainerConfigurator $containerConfigurator): void {
|
||||
$services = $containerConfigurator->services();
|
||||
|
||||
$services->set(AddMethodCallBasedStrictParamTypeRector::class)
|
||||
->call('configure', [[
|
||||
AddMethodCallBasedStrictParamTypeRector::TRUST_DOC_BLOCKS => false,
|
||||
]]);
|
||||
};
|
||||
```
|
||||
|
||||
↓
|
||||
|
||||
```diff
|
||||
class SomeClass
|
||||
{
|
||||
|
@ -11998,6 +11968,29 @@ return static function (ContainerConfigurator $containerConfigurator): void {
|
|||
|
||||
<br>
|
||||
|
||||
### AddParamTypeFromCallersRector
|
||||
|
||||
Add param type based on called types in that particular method
|
||||
|
||||
- class: [`Rector\TypeDeclaration\Rector\ClassMethod\AddParamTypeFromCallersRector`](../rules/TypeDeclaration/Rector/ClassMethod/AddParamTypeFromCallersRector.php)
|
||||
|
||||
```diff
|
||||
final class SomeClass
|
||||
{
|
||||
public function run(Return_ $return)
|
||||
{
|
||||
$this->print($return);
|
||||
}
|
||||
|
||||
- public function print($return)
|
||||
+ public function print(Return_ $return)
|
||||
{
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||
<br>
|
||||
|
||||
### AddReturnTypeDeclarationRector
|
||||
|
||||
Changes defined return typehint of method and class.
|
||||
|
|
|
@ -16,11 +16,11 @@ final class VersionResolver
|
|||
/**
|
||||
* @var string
|
||||
*/
|
||||
public const PACKAGE_VERSION = '20ad16b1e6ad957009035498a8384b684c74f938';
|
||||
public const PACKAGE_VERSION = '65547506989043585ff332ce5c5cd8383cc5f629';
|
||||
/**
|
||||
* @var string
|
||||
*/
|
||||
public const RELEASE_DATE = '2021-06-27 13:59:54';
|
||||
public const RELEASE_DATE = '2021-06-27 13:59:11';
|
||||
public static function resolvePackageVersion() : string
|
||||
{
|
||||
$process = new \RectorPrefix20210627\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 ComposerAutoloaderInitea723128088c4e88f8eacb5a1b552f5d::getLoader();
|
||||
return ComposerAutoloaderInit6693f5945971950a6cec17f9d7687143::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 ComposerAutoloaderInitea723128088c4e88f8eacb5a1b552f5d
|
||||
class ComposerAutoloaderInit6693f5945971950a6cec17f9d7687143
|
||||
{
|
||||
private static $loader;
|
||||
|
||||
|
@ -22,15 +22,15 @@ class ComposerAutoloaderInitea723128088c4e88f8eacb5a1b552f5d
|
|||
return self::$loader;
|
||||
}
|
||||
|
||||
spl_autoload_register(array('ComposerAutoloaderInitea723128088c4e88f8eacb5a1b552f5d', 'loadClassLoader'), true, true);
|
||||
spl_autoload_register(array('ComposerAutoloaderInit6693f5945971950a6cec17f9d7687143', 'loadClassLoader'), true, true);
|
||||
self::$loader = $loader = new \Composer\Autoload\ClassLoader(\dirname(\dirname(__FILE__)));
|
||||
spl_autoload_unregister(array('ComposerAutoloaderInitea723128088c4e88f8eacb5a1b552f5d', 'loadClassLoader'));
|
||||
spl_autoload_unregister(array('ComposerAutoloaderInit6693f5945971950a6cec17f9d7687143', '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\ComposerStaticInitea723128088c4e88f8eacb5a1b552f5d::getInitializer($loader));
|
||||
call_user_func(\Composer\Autoload\ComposerStaticInit6693f5945971950a6cec17f9d7687143::getInitializer($loader));
|
||||
} else {
|
||||
$classMap = require __DIR__ . '/autoload_classmap.php';
|
||||
if ($classMap) {
|
||||
|
@ -42,19 +42,19 @@ class ComposerAutoloaderInitea723128088c4e88f8eacb5a1b552f5d
|
|||
$loader->register(true);
|
||||
|
||||
if ($useStaticLoader) {
|
||||
$includeFiles = Composer\Autoload\ComposerStaticInitea723128088c4e88f8eacb5a1b552f5d::$files;
|
||||
$includeFiles = Composer\Autoload\ComposerStaticInit6693f5945971950a6cec17f9d7687143::$files;
|
||||
} else {
|
||||
$includeFiles = require __DIR__ . '/autoload_files.php';
|
||||
}
|
||||
foreach ($includeFiles as $fileIdentifier => $file) {
|
||||
composerRequireea723128088c4e88f8eacb5a1b552f5d($fileIdentifier, $file);
|
||||
composerRequire6693f5945971950a6cec17f9d7687143($fileIdentifier, $file);
|
||||
}
|
||||
|
||||
return $loader;
|
||||
}
|
||||
}
|
||||
|
||||
function composerRequireea723128088c4e88f8eacb5a1b552f5d($fileIdentifier, $file)
|
||||
function composerRequire6693f5945971950a6cec17f9d7687143($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 ComposerStaticInitea723128088c4e88f8eacb5a1b552f5d
|
||||
class ComposerStaticInit6693f5945971950a6cec17f9d7687143
|
||||
{
|
||||
public static $files = array (
|
||||
'a4a119a56e50fbb293281d9a48007e0e' => __DIR__ . '/..' . '/symfony/polyfill-php80/bootstrap.php',
|
||||
|
@ -3834,9 +3834,9 @@ class ComposerStaticInitea723128088c4e88f8eacb5a1b552f5d
|
|||
public static function getInitializer(ClassLoader $loader)
|
||||
{
|
||||
return \Closure::bind(function () use ($loader) {
|
||||
$loader->prefixLengthsPsr4 = ComposerStaticInitea723128088c4e88f8eacb5a1b552f5d::$prefixLengthsPsr4;
|
||||
$loader->prefixDirsPsr4 = ComposerStaticInitea723128088c4e88f8eacb5a1b552f5d::$prefixDirsPsr4;
|
||||
$loader->classMap = ComposerStaticInitea723128088c4e88f8eacb5a1b552f5d::$classMap;
|
||||
$loader->prefixLengthsPsr4 = ComposerStaticInit6693f5945971950a6cec17f9d7687143::$prefixLengthsPsr4;
|
||||
$loader->prefixDirsPsr4 = ComposerStaticInit6693f5945971950a6cec17f9d7687143::$prefixDirsPsr4;
|
||||
$loader->classMap = ComposerStaticInit6693f5945971950a6cec17f9d7687143::$classMap;
|
||||
|
||||
}, null, ClassLoader::class);
|
||||
}
|
||||
|
|
10
vendor/scoper-autoload.php
vendored
10
vendor/scoper-autoload.php
vendored
|
@ -21,8 +21,8 @@ if (!class_exists('SomeTestCase', false) && !interface_exists('SomeTestCase', fa
|
|||
if (!class_exists('CheckoutEntityFactory', false) && !interface_exists('CheckoutEntityFactory', false) && !trait_exists('CheckoutEntityFactory', false)) {
|
||||
spl_autoload_call('RectorPrefix20210627\CheckoutEntityFactory');
|
||||
}
|
||||
if (!class_exists('ComposerAutoloaderInitea723128088c4e88f8eacb5a1b552f5d', false) && !interface_exists('ComposerAutoloaderInitea723128088c4e88f8eacb5a1b552f5d', false) && !trait_exists('ComposerAutoloaderInitea723128088c4e88f8eacb5a1b552f5d', false)) {
|
||||
spl_autoload_call('RectorPrefix20210627\ComposerAutoloaderInitea723128088c4e88f8eacb5a1b552f5d');
|
||||
if (!class_exists('ComposerAutoloaderInit6693f5945971950a6cec17f9d7687143', false) && !interface_exists('ComposerAutoloaderInit6693f5945971950a6cec17f9d7687143', false) && !trait_exists('ComposerAutoloaderInit6693f5945971950a6cec17f9d7687143', false)) {
|
||||
spl_autoload_call('RectorPrefix20210627\ComposerAutoloaderInit6693f5945971950a6cec17f9d7687143');
|
||||
}
|
||||
if (!class_exists('Doctrine\Inflector\Inflector', false) && !interface_exists('Doctrine\Inflector\Inflector', false) && !trait_exists('Doctrine\Inflector\Inflector', false)) {
|
||||
spl_autoload_call('RectorPrefix20210627\Doctrine\Inflector\Inflector');
|
||||
|
@ -3320,9 +3320,9 @@ if (!function_exists('print_node')) {
|
|||
return \RectorPrefix20210627\print_node(...func_get_args());
|
||||
}
|
||||
}
|
||||
if (!function_exists('composerRequireea723128088c4e88f8eacb5a1b552f5d')) {
|
||||
function composerRequireea723128088c4e88f8eacb5a1b552f5d() {
|
||||
return \RectorPrefix20210627\composerRequireea723128088c4e88f8eacb5a1b552f5d(...func_get_args());
|
||||
if (!function_exists('composerRequire6693f5945971950a6cec17f9d7687143')) {
|
||||
function composerRequire6693f5945971950a6cec17f9d7687143() {
|
||||
return \RectorPrefix20210627\composerRequire6693f5945971950a6cec17f9d7687143(...func_get_args());
|
||||
}
|
||||
}
|
||||
if (!function_exists('parseArgs')) {
|
||||
|
|
Loading…
Reference in New Issue
Block a user