Updated Rector to commit 3e66b4a6348e2d106dc714760c946003bdc9807d

3e66b4a634 add multi args acceptor (#2605)
This commit is contained in:
Tomas Votruba 2022-07-02 09:10:33 +00:00
parent 9a39eb02a3
commit 299f511d80
19 changed files with 359 additions and 177 deletions

2
vendor/autoload.php vendored
View File

@ -9,4 +9,4 @@ if (PHP_VERSION_ID < 50600) {
require_once __DIR__ . '/composer/autoload_real.php';
return ComposerAutoloaderInit6ba007e97e3d58984bd9bd00d6e531bc::getLoader();
return ComposerAutoloaderInit34162b1978fedadb3d15ba4cdb4395e9::getLoader();

View File

@ -1987,6 +1987,7 @@ return array(
'Rector\\FileSystemRector\\Parser\\FileInfoParser' => $baseDir . '/packages/FileSystemRector/Parser/FileInfoParser.php',
'Rector\\FileSystemRector\\ValueObject\\AddedFileWithContent' => $baseDir . '/packages/FileSystemRector/ValueObject/AddedFileWithContent.php',
'Rector\\FileSystemRector\\ValueObject\\AddedFileWithNodes' => $baseDir . '/packages/FileSystemRector/ValueObject/AddedFileWithNodes.php',
'Rector\\Laravel\\NodeAnalyzer\\LumenRouteRegisteringMethodAnalyzer' => $vendorDir . '/rector/rector-laravel/src/NodeAnalyzer/LumenRouteRegisteringMethodAnalyzer.php',
'Rector\\Laravel\\NodeFactory\\AppAssignFactory' => $vendorDir . '/rector/rector-laravel/src/NodeFactory/AppAssignFactory.php',
'Rector\\Laravel\\NodeFactory\\ModelFactoryNodeFactory' => $vendorDir . '/rector/rector-laravel/src/NodeFactory/ModelFactoryNodeFactory.php',
'Rector\\Laravel\\NodeFactory\\RouterRegisterNodeAnalyzer' => $vendorDir . '/rector/rector-laravel/src/NodeFactory/RouterRegisterNodeAnalyzer.php',
@ -2004,6 +2005,8 @@ return array(
'Rector\\Laravel\\Rector\\FuncCall\\RemoveDumpDataDeadCodeRector' => $vendorDir . '/rector/rector-laravel/src/Rector/FuncCall/RemoveDumpDataDeadCodeRector.php',
'Rector\\Laravel\\Rector\\MethodCall\\ChangeQueryWhereDateValueWithCarbonRector' => $vendorDir . '/rector/rector-laravel/src/Rector/MethodCall/ChangeQueryWhereDateValueWithCarbonRector.php',
'Rector\\Laravel\\Rector\\MethodCall\\FactoryApplyingStatesRector' => $vendorDir . '/rector/rector-laravel/src/Rector/MethodCall/FactoryApplyingStatesRector.php',
'Rector\\Laravel\\Rector\\MethodCall\\LumenRoutesStringActionToUsesArrayRector' => $vendorDir . '/rector/rector-laravel/src/Rector/MethodCall/LumenRoutesStringActionToUsesArrayRector.php',
'Rector\\Laravel\\Rector\\MethodCall\\LumenRoutesStringMiddlewareToArrayRector' => $vendorDir . '/rector/rector-laravel/src/Rector/MethodCall/LumenRoutesStringMiddlewareToArrayRector.php',
'Rector\\Laravel\\Rector\\MethodCall\\RedirectBackToBackHelperRector' => $vendorDir . '/rector/rector-laravel/src/Rector/MethodCall/RedirectBackToBackHelperRector.php',
'Rector\\Laravel\\Rector\\MethodCall\\RedirectRouteToToRouteHelperRector' => $vendorDir . '/rector/rector-laravel/src/Rector/MethodCall/RedirectRouteToToRouteHelperRector.php',
'Rector\\Laravel\\Rector\\MethodCall\\RemoveAllOnDispatchingMethodsWithJobChainingRector' => $vendorDir . '/rector/rector-laravel/src/Rector/MethodCall/RemoveAllOnDispatchingMethodsWithJobChainingRector.php',
@ -2350,11 +2353,8 @@ return array(
'Rector\\PHPUnit\\NodeFactory\\ExpectExceptionMessageFactory' => $vendorDir . '/rector/rector-phpunit/src/NodeFactory/ExpectExceptionMessageFactory.php',
'Rector\\PHPUnit\\NodeFactory\\ExpectExceptionMessageRegExpFactory' => $vendorDir . '/rector/rector-phpunit/src/NodeFactory/ExpectExceptionMessageRegExpFactory.php',
'Rector\\PHPUnit\\NodeFactory\\ExpectExceptionMethodCallFactory' => $vendorDir . '/rector/rector-phpunit/src/NodeFactory/ExpectExceptionMethodCallFactory.php',
'Rector\\PHPUnit\\NodeFactory\\SetUpClassMethodFactory' => $vendorDir . '/rector/rector-phpunit/src/NodeFactory/SetUpClassMethodFactory.php',
'Rector\\PHPUnit\\NodeManipulator\\ArgumentMover' => $vendorDir . '/rector/rector-phpunit/src/NodeManipulator/ArgumentMover.php',
'Rector\\PHPUnit\\NodeManipulator\\ParamAndArgFromArrayResolver' => $vendorDir . '/rector/rector-phpunit/src/NodeManipulator/ParamAndArgFromArrayResolver.php',
'Rector\\PHPUnit\\NodeManipulator\\SetUpClassMethodNodeManipulator' => $vendorDir . '/rector/rector-phpunit/src/NodeManipulator/SetUpClassMethodNodeManipulator.php',
'Rector\\PHPUnit\\NodeManipulator\\StmtManipulator' => $vendorDir . '/rector/rector-phpunit/src/NodeManipulator/StmtManipulator.php',
'Rector\\PHPUnit\\PhpDoc\\PhpDocValueToNodeMapper' => $vendorDir . '/rector/rector-phpunit/src/PhpDoc/PhpDocValueToNodeMapper.php',
'Rector\\PHPUnit\\Rector\\ClassMethod\\AddDoesNotPerformAssertionToNonAssertingTestRector' => $vendorDir . '/rector/rector-phpunit/src/Rector/ClassMethod/AddDoesNotPerformAssertionToNonAssertingTestRector.php',
'Rector\\PHPUnit\\Rector\\ClassMethod\\ExceptionAnnotationRector' => $vendorDir . '/rector/rector-phpunit/src/Rector/ClassMethod/ExceptionAnnotationRector.php',

View File

@ -2,7 +2,7 @@
// autoload_real.php @generated by Composer
class ComposerAutoloaderInit6ba007e97e3d58984bd9bd00d6e531bc
class ComposerAutoloaderInit34162b1978fedadb3d15ba4cdb4395e9
{
private static $loader;
@ -22,19 +22,19 @@ class ComposerAutoloaderInit6ba007e97e3d58984bd9bd00d6e531bc
return self::$loader;
}
spl_autoload_register(array('ComposerAutoloaderInit6ba007e97e3d58984bd9bd00d6e531bc', 'loadClassLoader'), true, true);
spl_autoload_register(array('ComposerAutoloaderInit34162b1978fedadb3d15ba4cdb4395e9', 'loadClassLoader'), true, true);
self::$loader = $loader = new \Composer\Autoload\ClassLoader(\dirname(__DIR__));
spl_autoload_unregister(array('ComposerAutoloaderInit6ba007e97e3d58984bd9bd00d6e531bc', 'loadClassLoader'));
spl_autoload_unregister(array('ComposerAutoloaderInit34162b1978fedadb3d15ba4cdb4395e9', 'loadClassLoader'));
require __DIR__ . '/autoload_static.php';
call_user_func(\Composer\Autoload\ComposerStaticInit6ba007e97e3d58984bd9bd00d6e531bc::getInitializer($loader));
call_user_func(\Composer\Autoload\ComposerStaticInit34162b1978fedadb3d15ba4cdb4395e9::getInitializer($loader));
$loader->setClassMapAuthoritative(true);
$loader->register(true);
$includeFiles = \Composer\Autoload\ComposerStaticInit6ba007e97e3d58984bd9bd00d6e531bc::$files;
$includeFiles = \Composer\Autoload\ComposerStaticInit34162b1978fedadb3d15ba4cdb4395e9::$files;
foreach ($includeFiles as $fileIdentifier => $file) {
composerRequire6ba007e97e3d58984bd9bd00d6e531bc($fileIdentifier, $file);
composerRequire34162b1978fedadb3d15ba4cdb4395e9($fileIdentifier, $file);
}
return $loader;
@ -46,7 +46,7 @@ class ComposerAutoloaderInit6ba007e97e3d58984bd9bd00d6e531bc
* @param string $file
* @return void
*/
function composerRequire6ba007e97e3d58984bd9bd00d6e531bc($fileIdentifier, $file)
function composerRequire34162b1978fedadb3d15ba4cdb4395e9($fileIdentifier, $file)
{
if (empty($GLOBALS['__composer_autoload_files'][$fileIdentifier])) {
$GLOBALS['__composer_autoload_files'][$fileIdentifier] = true;

View File

@ -4,7 +4,7 @@
namespace Composer\Autoload;
class ComposerStaticInit6ba007e97e3d58984bd9bd00d6e531bc
class ComposerStaticInit34162b1978fedadb3d15ba4cdb4395e9
{
public static $files = array (
'0e6d7bf4a5811bfa5cf40c5ccd6fae6a' => __DIR__ . '/..' . '/symfony/polyfill-mbstring/bootstrap.php',
@ -2294,6 +2294,7 @@ class ComposerStaticInit6ba007e97e3d58984bd9bd00d6e531bc
'Rector\\FileSystemRector\\Parser\\FileInfoParser' => __DIR__ . '/../..' . '/packages/FileSystemRector/Parser/FileInfoParser.php',
'Rector\\FileSystemRector\\ValueObject\\AddedFileWithContent' => __DIR__ . '/../..' . '/packages/FileSystemRector/ValueObject/AddedFileWithContent.php',
'Rector\\FileSystemRector\\ValueObject\\AddedFileWithNodes' => __DIR__ . '/../..' . '/packages/FileSystemRector/ValueObject/AddedFileWithNodes.php',
'Rector\\Laravel\\NodeAnalyzer\\LumenRouteRegisteringMethodAnalyzer' => __DIR__ . '/..' . '/rector/rector-laravel/src/NodeAnalyzer/LumenRouteRegisteringMethodAnalyzer.php',
'Rector\\Laravel\\NodeFactory\\AppAssignFactory' => __DIR__ . '/..' . '/rector/rector-laravel/src/NodeFactory/AppAssignFactory.php',
'Rector\\Laravel\\NodeFactory\\ModelFactoryNodeFactory' => __DIR__ . '/..' . '/rector/rector-laravel/src/NodeFactory/ModelFactoryNodeFactory.php',
'Rector\\Laravel\\NodeFactory\\RouterRegisterNodeAnalyzer' => __DIR__ . '/..' . '/rector/rector-laravel/src/NodeFactory/RouterRegisterNodeAnalyzer.php',
@ -2311,6 +2312,8 @@ class ComposerStaticInit6ba007e97e3d58984bd9bd00d6e531bc
'Rector\\Laravel\\Rector\\FuncCall\\RemoveDumpDataDeadCodeRector' => __DIR__ . '/..' . '/rector/rector-laravel/src/Rector/FuncCall/RemoveDumpDataDeadCodeRector.php',
'Rector\\Laravel\\Rector\\MethodCall\\ChangeQueryWhereDateValueWithCarbonRector' => __DIR__ . '/..' . '/rector/rector-laravel/src/Rector/MethodCall/ChangeQueryWhereDateValueWithCarbonRector.php',
'Rector\\Laravel\\Rector\\MethodCall\\FactoryApplyingStatesRector' => __DIR__ . '/..' . '/rector/rector-laravel/src/Rector/MethodCall/FactoryApplyingStatesRector.php',
'Rector\\Laravel\\Rector\\MethodCall\\LumenRoutesStringActionToUsesArrayRector' => __DIR__ . '/..' . '/rector/rector-laravel/src/Rector/MethodCall/LumenRoutesStringActionToUsesArrayRector.php',
'Rector\\Laravel\\Rector\\MethodCall\\LumenRoutesStringMiddlewareToArrayRector' => __DIR__ . '/..' . '/rector/rector-laravel/src/Rector/MethodCall/LumenRoutesStringMiddlewareToArrayRector.php',
'Rector\\Laravel\\Rector\\MethodCall\\RedirectBackToBackHelperRector' => __DIR__ . '/..' . '/rector/rector-laravel/src/Rector/MethodCall/RedirectBackToBackHelperRector.php',
'Rector\\Laravel\\Rector\\MethodCall\\RedirectRouteToToRouteHelperRector' => __DIR__ . '/..' . '/rector/rector-laravel/src/Rector/MethodCall/RedirectRouteToToRouteHelperRector.php',
'Rector\\Laravel\\Rector\\MethodCall\\RemoveAllOnDispatchingMethodsWithJobChainingRector' => __DIR__ . '/..' . '/rector/rector-laravel/src/Rector/MethodCall/RemoveAllOnDispatchingMethodsWithJobChainingRector.php',
@ -2657,11 +2660,8 @@ class ComposerStaticInit6ba007e97e3d58984bd9bd00d6e531bc
'Rector\\PHPUnit\\NodeFactory\\ExpectExceptionMessageFactory' => __DIR__ . '/..' . '/rector/rector-phpunit/src/NodeFactory/ExpectExceptionMessageFactory.php',
'Rector\\PHPUnit\\NodeFactory\\ExpectExceptionMessageRegExpFactory' => __DIR__ . '/..' . '/rector/rector-phpunit/src/NodeFactory/ExpectExceptionMessageRegExpFactory.php',
'Rector\\PHPUnit\\NodeFactory\\ExpectExceptionMethodCallFactory' => __DIR__ . '/..' . '/rector/rector-phpunit/src/NodeFactory/ExpectExceptionMethodCallFactory.php',
'Rector\\PHPUnit\\NodeFactory\\SetUpClassMethodFactory' => __DIR__ . '/..' . '/rector/rector-phpunit/src/NodeFactory/SetUpClassMethodFactory.php',
'Rector\\PHPUnit\\NodeManipulator\\ArgumentMover' => __DIR__ . '/..' . '/rector/rector-phpunit/src/NodeManipulator/ArgumentMover.php',
'Rector\\PHPUnit\\NodeManipulator\\ParamAndArgFromArrayResolver' => __DIR__ . '/..' . '/rector/rector-phpunit/src/NodeManipulator/ParamAndArgFromArrayResolver.php',
'Rector\\PHPUnit\\NodeManipulator\\SetUpClassMethodNodeManipulator' => __DIR__ . '/..' . '/rector/rector-phpunit/src/NodeManipulator/SetUpClassMethodNodeManipulator.php',
'Rector\\PHPUnit\\NodeManipulator\\StmtManipulator' => __DIR__ . '/..' . '/rector/rector-phpunit/src/NodeManipulator/StmtManipulator.php',
'Rector\\PHPUnit\\PhpDoc\\PhpDocValueToNodeMapper' => __DIR__ . '/..' . '/rector/rector-phpunit/src/PhpDoc/PhpDocValueToNodeMapper.php',
'Rector\\PHPUnit\\Rector\\ClassMethod\\AddDoesNotPerformAssertionToNonAssertingTestRector' => __DIR__ . '/..' . '/rector/rector-phpunit/src/Rector/ClassMethod/AddDoesNotPerformAssertionToNonAssertingTestRector.php',
'Rector\\PHPUnit\\Rector\\ClassMethod\\ExceptionAnnotationRector' => __DIR__ . '/..' . '/rector/rector-phpunit/src/Rector/ClassMethod/ExceptionAnnotationRector.php',
@ -3417,9 +3417,9 @@ class ComposerStaticInit6ba007e97e3d58984bd9bd00d6e531bc
public static function getInitializer(ClassLoader $loader)
{
return \Closure::bind(function () use ($loader) {
$loader->prefixLengthsPsr4 = ComposerStaticInit6ba007e97e3d58984bd9bd00d6e531bc::$prefixLengthsPsr4;
$loader->prefixDirsPsr4 = ComposerStaticInit6ba007e97e3d58984bd9bd00d6e531bc::$prefixDirsPsr4;
$loader->classMap = ComposerStaticInit6ba007e97e3d58984bd9bd00d6e531bc::$classMap;
$loader->prefixLengthsPsr4 = ComposerStaticInit34162b1978fedadb3d15ba4cdb4395e9::$prefixLengthsPsr4;
$loader->prefixDirsPsr4 = ComposerStaticInit34162b1978fedadb3d15ba4cdb4395e9::$prefixDirsPsr4;
$loader->classMap = ComposerStaticInit34162b1978fedadb3d15ba4cdb4395e9::$classMap;
}, null, ClassLoader::class);
}

View File

@ -2135,12 +2135,12 @@
"source": {
"type": "git",
"url": "https:\/\/github.com\/rectorphp\/rector-laravel.git",
"reference": "a6af877719c86988606720636c6414b39bfe217c"
"reference": "7d3c7342ad89992c544fbd60193c90649b8edd60"
},
"dist": {
"type": "zip",
"url": "https:\/\/api.github.com\/repos\/rectorphp\/rector-laravel\/zipball\/a6af877719c86988606720636c6414b39bfe217c",
"reference": "a6af877719c86988606720636c6414b39bfe217c",
"url": "https:\/\/api.github.com\/repos\/rectorphp\/rector-laravel\/zipball\/7d3c7342ad89992c544fbd60193c90649b8edd60",
"reference": "7d3c7342ad89992c544fbd60193c90649b8edd60",
"shasum": ""
},
"require": {
@ -2164,7 +2164,7 @@
"symplify\/rule-doc-generator": "^11.0",
"symplify\/vendor-patches": "^11.0"
},
"time": "2022-07-01T09:37:23+00:00",
"time": "2022-07-02T07:33:20+00:00",
"default-branch": true,
"type": "rector-extension",
"extra": {
@ -2347,12 +2347,12 @@
"source": {
"type": "git",
"url": "https:\/\/github.com\/rectorphp\/rector-phpunit.git",
"reference": "1aab8fb38da3254211cfaf5068174f15b52a5c6f"
"reference": "97b53970d204083f6e2abaa0f1ffd071b660487f"
},
"dist": {
"type": "zip",
"url": "https:\/\/api.github.com\/repos\/rectorphp\/rector-phpunit\/zipball\/1aab8fb38da3254211cfaf5068174f15b52a5c6f",
"reference": "1aab8fb38da3254211cfaf5068174f15b52a5c6f",
"url": "https:\/\/api.github.com\/repos\/rectorphp\/rector-phpunit\/zipball\/97b53970d204083f6e2abaa0f1ffd071b660487f",
"reference": "97b53970d204083f6e2abaa0f1ffd071b660487f",
"shasum": ""
},
"require": {
@ -2363,7 +2363,7 @@
},
"require-dev": {
"phpstan\/extension-installer": "^1.1",
"phpstan\/phpstan": "^1.7.10",
"phpstan\/phpstan": "^1.8",
"phpstan\/phpstan-strict-rules": "^1.2",
"phpstan\/phpstan-webmozart-assert": "^1.1",
"phpunit\/phpunit": "^9.5",
@ -2377,7 +2377,7 @@
"symplify\/rule-doc-generator": "^11.0",
"symplify\/vendor-patches": "^11.0"
},
"time": "2022-07-01T10:10:09+00:00",
"time": "2022-07-01T22:33:06+00:00",
"default-branch": true,
"type": "rector-extension",
"extra": {

File diff suppressed because one or more lines are too long

View File

@ -9,7 +9,7 @@ namespace Rector\RectorInstaller;
*/
final class GeneratedConfig
{
public const EXTENSIONS = array('rector/rector-cakephp' => array('install_path' => '/home/runner/work/rector-src/rector-src/vendor/rector/rector-cakephp', 'relative_install_path' => '../../rector-cakephp', 'extra' => array('includes' => array(0 => 'config/config.php')), 'version' => 'dev-main 86ab8c3'), 'rector/rector-doctrine' => array('install_path' => '/home/runner/work/rector-src/rector-src/vendor/rector/rector-doctrine', 'relative_install_path' => '../../rector-doctrine', 'extra' => array('includes' => array(0 => 'config/config.php')), 'version' => 'dev-main b177492'), 'rector/rector-downgrade-php' => array('install_path' => '/home/runner/work/rector-src/rector-src/vendor/rector/rector-downgrade-php', 'relative_install_path' => '../../rector-downgrade-php', 'extra' => array('includes' => array(0 => 'config/config.php')), 'version' => 'dev-main c857264'), 'rector/rector-generator' => array('install_path' => '/home/runner/work/rector-src/rector-src/vendor/rector/rector-generator', 'relative_install_path' => '../../rector-generator', 'extra' => array('includes' => array(0 => 'config/config.php')), 'version' => 'dev-main 644d45b'), 'rector/rector-laravel' => array('install_path' => '/home/runner/work/rector-src/rector-src/vendor/rector/rector-laravel', 'relative_install_path' => '../../rector-laravel', 'extra' => array('includes' => array(0 => 'config/config.php')), 'version' => 'dev-main a6af877'), 'rector/rector-nette' => array('install_path' => '/home/runner/work/rector-src/rector-src/vendor/rector/rector-nette', 'relative_install_path' => '../../rector-nette', 'extra' => array('includes' => array(0 => 'config/config.php')), 'version' => 'dev-main 45ba400'), 'rector/rector-phpoffice' => array('install_path' => '/home/runner/work/rector-src/rector-src/vendor/rector/rector-phpoffice', 'relative_install_path' => '../../rector-phpoffice', 'extra' => array('includes' => array(0 => 'config/config.php')), 'version' => 'dev-main d826618'), 'rector/rector-phpunit' => array('install_path' => '/home/runner/work/rector-src/rector-src/vendor/rector/rector-phpunit', 'relative_install_path' => '../../rector-phpunit', 'extra' => array('includes' => array(0 => 'config/config.php')), 'version' => 'dev-main 1aab8fb'), 'rector/rector-symfony' => array('install_path' => '/home/runner/work/rector-src/rector-src/vendor/rector/rector-symfony', 'relative_install_path' => '../../rector-symfony', 'extra' => array('includes' => array(0 => 'config/config.php')), 'version' => 'dev-main d4e61a1'));
public const EXTENSIONS = array('rector/rector-cakephp' => array('install_path' => '/home/runner/work/rector-src/rector-src/vendor/rector/rector-cakephp', 'relative_install_path' => '../../rector-cakephp', 'extra' => array('includes' => array(0 => 'config/config.php')), 'version' => 'dev-main 86ab8c3'), 'rector/rector-doctrine' => array('install_path' => '/home/runner/work/rector-src/rector-src/vendor/rector/rector-doctrine', 'relative_install_path' => '../../rector-doctrine', 'extra' => array('includes' => array(0 => 'config/config.php')), 'version' => 'dev-main b177492'), 'rector/rector-downgrade-php' => array('install_path' => '/home/runner/work/rector-src/rector-src/vendor/rector/rector-downgrade-php', 'relative_install_path' => '../../rector-downgrade-php', 'extra' => array('includes' => array(0 => 'config/config.php')), 'version' => 'dev-main c857264'), 'rector/rector-generator' => array('install_path' => '/home/runner/work/rector-src/rector-src/vendor/rector/rector-generator', 'relative_install_path' => '../../rector-generator', 'extra' => array('includes' => array(0 => 'config/config.php')), 'version' => 'dev-main 644d45b'), 'rector/rector-laravel' => array('install_path' => '/home/runner/work/rector-src/rector-src/vendor/rector/rector-laravel', 'relative_install_path' => '../../rector-laravel', 'extra' => array('includes' => array(0 => 'config/config.php')), 'version' => 'dev-main 7d3c734'), 'rector/rector-nette' => array('install_path' => '/home/runner/work/rector-src/rector-src/vendor/rector/rector-nette', 'relative_install_path' => '../../rector-nette', 'extra' => array('includes' => array(0 => 'config/config.php')), 'version' => 'dev-main 45ba400'), 'rector/rector-phpoffice' => array('install_path' => '/home/runner/work/rector-src/rector-src/vendor/rector/rector-phpoffice', 'relative_install_path' => '../../rector-phpoffice', 'extra' => array('includes' => array(0 => 'config/config.php')), 'version' => 'dev-main d826618'), 'rector/rector-phpunit' => array('install_path' => '/home/runner/work/rector-src/rector-src/vendor/rector/rector-phpunit', 'relative_install_path' => '../../rector-phpunit', 'extra' => array('includes' => array(0 => 'config/config.php')), 'version' => 'dev-main 97b5397'), 'rector/rector-symfony' => array('install_path' => '/home/runner/work/rector-src/rector-src/vendor/rector/rector-symfony', 'relative_install_path' => '../../rector-symfony', 'extra' => array('includes' => array(0 => 'config/config.php')), 'version' => 'dev-main d4e61a1'));
private function __construct()
{
}

View File

@ -1,4 +1,4 @@
# 24 Rules Overview
# 26 Rules Overview
## AddArgumentDefaultValueRector
@ -294,6 +294,34 @@ Change `app()` func calls to facade calls
<br>
## LumenRoutesStringActionToUsesArrayRector
Changes action in rule definitions from string to array notation.
- class: [`Rector\Laravel\Rector\MethodCall\LumenRoutesStringActionToUsesArrayRector`](../src/Rector/MethodCall/LumenRoutesStringActionToUsesArrayRector.php)
```diff
-$router->get('/user', 'UserController@get');
+$router->get('/user', ['uses => 'UserController@get']);
```
<br>
## LumenRoutesStringMiddlewareToArrayRector
Changes middlewares from rule definitions from string to array notation.
- class: [`Rector\Laravel\Rector\MethodCall\LumenRoutesStringMiddlewareToArrayRector`](../src/Rector/MethodCall/LumenRoutesStringMiddlewareToArrayRector.php)
```diff
-$router->get('/user', ['middleware => 'test']);
-$router->post('/user', ['middleware => 'test|authentication']);
+$router->get('/user', ['middleware => ['test']]);
+$router->post('/user', ['middleware => ['test', 'authentication']]);
```
<br>
## MinutesToSecondsInCacheRector
Change minutes argument to seconds in `Illuminate\Contracts\Cache\Store` and Illuminate\Support\Facades\Cache

View File

@ -0,0 +1,47 @@
<?php
declare (strict_types=1);
namespace Rector\Laravel\NodeAnalyzer;
use PhpParser\Node\Expr;
use PhpParser\Node\Expr\MethodCall;
use PhpParser\Node\Identifier;
use PHPStan\Type\ObjectType;
use Rector\NodeNameResolver\NodeNameResolver;
use Rector\NodeTypeResolver\NodeTypeResolver;
final class LumenRouteRegisteringMethodAnalyzer
{
/**
* @readonly
* @var \Rector\NodeTypeResolver\NodeTypeResolver
*/
private $nodeTypeResolver;
/**
* @readonly
* @var \Rector\NodeNameResolver\NodeNameResolver
*/
private $nodeNameResolver;
public function __construct(NodeTypeResolver $nodeTypeResolver, NodeNameResolver $nodeNameResolver)
{
$this->nodeTypeResolver = $nodeTypeResolver;
$this->nodeNameResolver = $nodeNameResolver;
}
public function isLumenRoutingClass(MethodCall $methodCall) : bool
{
return $this->nodeTypeResolver->isObjectType($methodCall->var, new ObjectType('Laravel\\Lumen\\Routing\\Router'));
}
/**
* @param \PhpParser\Node\Identifier|\PhpParser\Node\Expr $name
*/
public function isRoutesRegisterGroup($name) : bool
{
return $this->nodeNameResolver->isName($name, 'group');
}
/**
* @param \PhpParser\Node\Identifier|\PhpParser\Node\Expr $name
*/
public function isRoutesRegisterRoute($name) : bool
{
return $this->nodeNameResolver->isNames($name, ['delete', 'get', 'options', 'patch', 'post', 'put']);
}
}

View File

@ -8,11 +8,17 @@ use PhpParser\Node\Expr\Assign;
use PhpParser\Node\Expr\PropertyFetch;
use PhpParser\Node\Expr\StaticCall;
use PhpParser\Node\Expr\Variable;
use PhpParser\Node\Name;
use PhpParser\Node\Stmt\Class_;
use PhpParser\Node\Stmt\ClassMethod;
use PhpParser\Node\Stmt\Expression;
use PHPStan\Type\ObjectType;
use Rector\Core\Enum\ObjectReference;
use Rector\Core\NodeAnalyzer\PropertyFetchAnalyzer;
use Rector\Core\Rector\AbstractRector;
use Rector\PHPUnit\NodeManipulator\SetUpClassMethodNodeManipulator;
use Rector\Core\ValueObject\MethodName;
use Rector\PHPUnit\NodeAnalyzer\SetUpMethodDecorator;
use Rector\Privatization\NodeManipulator\VisibilityManipulator;
use Symplify\RuleDocGenerator\ValueObject\CodeSample\CodeSample;
use Symplify\RuleDocGenerator\ValueObject\RuleDefinition;
/**
@ -30,13 +36,19 @@ final class AddMockConsoleOutputFalseToConsoleTestsRector extends AbstractRector
private $propertyFetchAnalyzer;
/**
* @readonly
* @var \Rector\PHPUnit\NodeManipulator\SetUpClassMethodNodeManipulator
* @var \Rector\PHPUnit\NodeAnalyzer\SetUpMethodDecorator
*/
private $setUpClassMethodNodeManipulator;
public function __construct(PropertyFetchAnalyzer $propertyFetchAnalyzer, SetUpClassMethodNodeManipulator $setUpClassMethodNodeManipulator)
private $setUpMethodDecorator;
/**
* @readonly
* @var \Rector\Privatization\NodeManipulator\VisibilityManipulator
*/
private $visibilityManipulator;
public function __construct(PropertyFetchAnalyzer $propertyFetchAnalyzer, SetUpMethodDecorator $setUpMethodDecorator, VisibilityManipulator $visibilityManipulator)
{
$this->propertyFetchAnalyzer = $propertyFetchAnalyzer;
$this->setUpClassMethodNodeManipulator = $setUpClassMethodNodeManipulator;
$this->setUpMethodDecorator = $setUpMethodDecorator;
$this->visibilityManipulator = $visibilityManipulator;
}
public function getRuleDefinition() : RuleDefinition
{
@ -96,7 +108,16 @@ CODE_SAMPLE
return null;
}
$assign = $this->createAssign();
$this->setUpClassMethodNodeManipulator->decorateOrCreate($node, [$assign]);
$setUpClassMethod = $node->getMethod(MethodName::SET_UP);
if (!$setUpClassMethod instanceof ClassMethod) {
$setUpClassMethod = new ClassMethod(MethodName::SET_UP);
$setUpClassMethod->stmts = [new Expression(new StaticCall(new Name(ObjectReference::PARENT), MethodName::SET_UP)), new Expression($assign)];
$this->setUpMethodDecorator->decorate($setUpClassMethod);
$this->visibilityManipulator->makeProtected($setUpClassMethod);
$node->stmts = \array_merge([$setUpClassMethod], $node->stmts);
} else {
$setUpClassMethod->stmts = \array_merge((array) $setUpClassMethod->stmts, [new Expression($assign)]);
}
return $node;
}
private function isTestingConsoleOutput(Class_ $class) : bool

View File

@ -0,0 +1,65 @@
<?php
declare (strict_types=1);
namespace Rector\Laravel\Rector\MethodCall;
use PhpParser\Node;
use PhpParser\Node\Arg;
use PhpParser\Node\Expr\Array_;
use PhpParser\Node\Expr\ArrayItem;
use PhpParser\Node\Expr\MethodCall;
use PhpParser\Node\Scalar\String_;
use Rector\Core\Rector\AbstractRector;
use Rector\Laravel\NodeAnalyzer\LumenRouteRegisteringMethodAnalyzer;
use Symplify\RuleDocGenerator\ValueObject\CodeSample\CodeSample;
use Symplify\RuleDocGenerator\ValueObject\RuleDefinition;
/**
* @see \Rector\Laravel\Tests\Rector\MethodCall\LumenRoutesStringActionToUsesArrayRector\LumenRoutesStringActionToUsesArrayRectorTest
*/
final class LumenRoutesStringActionToUsesArrayRector extends AbstractRector
{
/**
* @readonly
* @var \Rector\Laravel\NodeAnalyzer\LumenRouteRegisteringMethodAnalyzer
*/
private $lumenRouteRegisteringMethodAnalyzer;
public function __construct(LumenRouteRegisteringMethodAnalyzer $lumenRouteRegisteringMethodAnalyzer)
{
$this->lumenRouteRegisteringMethodAnalyzer = $lumenRouteRegisteringMethodAnalyzer;
}
public function getRuleDefinition() : RuleDefinition
{
return new RuleDefinition('Changes action in rule definitions from string to array notation.', [new CodeSample(<<<'CODE_SAMPLE'
$router->get('/user', 'UserController@get');
CODE_SAMPLE
, <<<'CODE_SAMPLE'
$router->get('/user', ['uses => 'UserController@get']);
CODE_SAMPLE
)]);
}
/**
* @return array<class-string<Node>>
*/
public function getNodeTypes() : array
{
return [MethodCall::class];
}
public function refactor(Node $node) : ?Node
{
if (!$node instanceof MethodCall) {
return null;
}
if (!$this->lumenRouteRegisteringMethodAnalyzer->isLumenRoutingClass($node)) {
return null;
}
if (!$this->lumenRouteRegisteringMethodAnalyzer->isRoutesRegisterRoute($node->name)) {
return null;
}
$string = $node->getArgs()[1]->value;
if (!$string instanceof String_) {
return null;
}
$node->args[1] = new Arg(new Array_([new ArrayItem($string, new String_('uses'))]));
return $node;
}
}

View File

@ -0,0 +1,131 @@
<?php
declare (strict_types=1);
namespace Rector\Laravel\Rector\MethodCall;
use PhpParser\Node;
use PhpParser\Node\Expr\Array_;
use PhpParser\Node\Expr\ArrayItem;
use PhpParser\Node\Expr\MethodCall;
use PhpParser\Node\Scalar\String_;
use Rector\Core\NodeManipulator\ArrayManipulator;
use Rector\Core\Rector\AbstractRector;
use Rector\Laravel\NodeAnalyzer\LumenRouteRegisteringMethodAnalyzer;
use Symplify\RuleDocGenerator\ValueObject\CodeSample\CodeSample;
use Symplify\RuleDocGenerator\ValueObject\RuleDefinition;
/**
* @see \Rector\Laravel\Tests\Rector\MethodCall\LumenRoutesStringMiddlewareToArrayRector\LumenRoutesStringMiddlewareToArrayRectorTest
*/
final class LumenRoutesStringMiddlewareToArrayRector extends AbstractRector
{
/**
* @readonly
* @var \Rector\Core\NodeManipulator\ArrayManipulator
*/
private $arrayManipulator;
/**
* @readonly
* @var \Rector\Laravel\NodeAnalyzer\LumenRouteRegisteringMethodAnalyzer
*/
private $lumenRouteRegisteringMethodAnalyzer;
public function __construct(ArrayManipulator $arrayManipulator, LumenRouteRegisteringMethodAnalyzer $lumenRouteRegisteringMethodAnalyzer)
{
$this->arrayManipulator = $arrayManipulator;
$this->lumenRouteRegisteringMethodAnalyzer = $lumenRouteRegisteringMethodAnalyzer;
}
public function getRuleDefinition() : RuleDefinition
{
return new RuleDefinition('Changes middlewares from rule definitions from string to array notation.', [new CodeSample(<<<'CODE_SAMPLE'
$router->get('/user', ['middleware => 'test']);
$router->post('/user', ['middleware => 'test|authentication']);
CODE_SAMPLE
, <<<'CODE_SAMPLE'
$router->get('/user', ['middleware => ['test']]);
$router->post('/user', ['middleware => ['test', 'authentication']]);
CODE_SAMPLE
)]);
}
/**
* @return array<class-string<Node>>
*/
public function getNodeTypes() : array
{
return [MethodCall::class];
}
public function refactor(Node $node) : ?Node
{
if (!$node instanceof MethodCall) {
return null;
}
if (!$this->lumenRouteRegisteringMethodAnalyzer->isLumenRoutingClass($node)) {
return null;
}
$array = $this->getRouterMethodAttributes($node);
if (!$array instanceof Array_) {
return null;
}
$arrayItem = $this->findItemInArrayByKey($array, 'middleware');
if (!$arrayItem instanceof ArrayItem) {
return null;
}
$middlewareValue = $arrayItem->value;
if (!$middlewareValue instanceof String_) {
return null;
}
/** @var string $middlewareString */
$middlewareString = $middlewareValue->value;
$splitMiddleware = \explode('|', $middlewareString);
$newMiddlewareArray = new Array_([]);
foreach ($splitMiddleware as $singleSplitMiddleware) {
$newMiddlewareArray->items[] = new ArrayItem(new String_($singleSplitMiddleware));
}
$this->replaceItemInArrayByKey($array, new ArrayItem($newMiddlewareArray, new String_('middleware')), 'middleware');
return $node;
}
private function getRouterMethodAttributes(MethodCall $methodCall) : ?Array_
{
$attributes = null;
if ($this->lumenRouteRegisteringMethodAnalyzer->isRoutesRegisterGroup($methodCall->name)) {
$attributes = $methodCall->getArgs()[0]->value;
}
if ($this->lumenRouteRegisteringMethodAnalyzer->isRoutesRegisterRoute($methodCall->name)) {
$attributes = $methodCall->getArgs()[1]->value;
}
if (!$attributes instanceof Array_) {
return null;
}
return $attributes;
}
private function findItemInArrayByKey(Array_ $array, string $keyName) : ?ArrayItem
{
foreach ($array->items as $i => $item) {
if ($item === null) {
continue;
}
if (!$this->arrayManipulator->hasKeyName($item, $keyName)) {
continue;
}
$foundArrayItem = $array->items[$i];
if (!$foundArrayItem instanceof ArrayItem) {
continue;
}
return $item;
}
return null;
}
private function replaceItemInArrayByKey(Array_ $array, ArrayItem $arrayItem, string $keyName) : void
{
foreach ($array->items as $i => $item) {
if ($item === null) {
continue;
}
if (!$this->arrayManipulator->hasKeyName($item, $keyName)) {
continue;
}
if (!$array->items[$i] instanceof ArrayItem) {
continue;
}
$array->items[$i] = $arrayItem;
}
}
}

View File

@ -9,7 +9,7 @@
"require-dev": {
"rector\/rector-src": "dev-main",
"phpunit\/phpunit": "^9.5",
"phpstan\/phpstan": "^1.7.10",
"phpstan\/phpstan": "^1.8",
"symplify\/phpstan-rules": "^11.0",
"symplify\/phpstan-extensions": "^11.0",
"symplify\/easy-coding-standard": "^11.0",

View File

@ -7,5 +7,5 @@ use Rector\Config\RectorConfig;
return static function (RectorConfig $rectorConfig) : void {
$services = $rectorConfig->services();
$services->defaults()->public()->autowire()->autoconfigure();
$services->load('Rector\\PHPUnit\\', __DIR__ . '/../src')->exclude([__DIR__ . '/../src/{Rector,ValueObject,PhpDoc/Node}']);
$services->load('Rector\\PHPUnit\\', __DIR__ . '/../src')->exclude([__DIR__ . '/../src/Rector', __DIR__ . '/../src/ValueObject', __DIR__ . '/../src/PhpDoc/Node']);
};

View File

@ -1,58 +0,0 @@
<?php
declare (strict_types=1);
namespace Rector\PHPUnit\NodeFactory;
use PhpParser\Node\Expr;
use PhpParser\Node\Stmt;
use PhpParser\Node\Stmt\ClassMethod;
use PhpParser\Node\Stmt\Expression;
use Rector\Core\Enum\ObjectReference;
use Rector\Core\PhpParser\Node\NodeFactory;
use Rector\Core\ValueObject\MethodName;
use Rector\PHPUnit\NodeAnalyzer\SetUpMethodDecorator;
use Rector\PHPUnit\NodeManipulator\StmtManipulator;
use RectorPrefix202207\Symplify\Astral\ValueObject\NodeBuilder\MethodBuilder;
final class SetUpClassMethodFactory
{
/**
* @readonly
* @var \Rector\PHPUnit\NodeAnalyzer\SetUpMethodDecorator
*/
private $setUpMethodDecorator;
/**
* @readonly
* @var \Rector\PHPUnit\NodeManipulator\StmtManipulator
*/
private $stmtManipulator;
/**
* @readonly
* @var \Rector\Core\PhpParser\Node\NodeFactory
*/
private $nodeFactory;
public function __construct(SetUpMethodDecorator $setUpMethodDecorator, StmtManipulator $stmtManipulator, NodeFactory $nodeFactory)
{
$this->setUpMethodDecorator = $setUpMethodDecorator;
$this->stmtManipulator = $stmtManipulator;
$this->nodeFactory = $nodeFactory;
}
/**
* @param Stmt[]|Expr[] $stmts
*/
public function createSetUpMethod(array $stmts) : ClassMethod
{
$stmts = $this->stmtManipulator->normalizeStmts($stmts);
$classMethodBuilder = new MethodBuilder(MethodName::SET_UP);
$classMethodBuilder->makeProtected();
$classMethodBuilder->addStmt($this->createParentStaticCall());
$classMethodBuilder->addStmts($stmts);
$classMethod = $classMethodBuilder->getNode();
$this->setUpMethodDecorator->decorate($classMethod);
return $classMethod;
}
public function createParentStaticCall() : Expression
{
$parentSetupStaticCall = $this->nodeFactory->createStaticCall(ObjectReference::PARENT, MethodName::SET_UP);
return new Expression($parentSetupStaticCall);
}
}

View File

@ -1,43 +0,0 @@
<?php
declare (strict_types=1);
namespace Rector\PHPUnit\NodeManipulator;
use PhpParser\Node\Expr;
use PhpParser\Node\Stmt;
use PhpParser\Node\Stmt\Class_;
use PhpParser\Node\Stmt\ClassMethod;
use Rector\Core\ValueObject\MethodName;
use Rector\PHPUnit\NodeFactory\SetUpClassMethodFactory;
final class SetUpClassMethodNodeManipulator
{
/**
* @readonly
* @var \Rector\PHPUnit\NodeFactory\SetUpClassMethodFactory
*/
private $setUpClassMethodFactory;
/**
* @readonly
* @var \Rector\PHPUnit\NodeManipulator\StmtManipulator
*/
private $stmtManipulator;
public function __construct(SetUpClassMethodFactory $setUpClassMethodFactory, \Rector\PHPUnit\NodeManipulator\StmtManipulator $stmtManipulator)
{
$this->setUpClassMethodFactory = $setUpClassMethodFactory;
$this->stmtManipulator = $stmtManipulator;
}
/**
* @param Stmt[]|Expr[] $stmts
*/
public function decorateOrCreate(Class_ $class, array $stmts) : void
{
$stmts = $this->stmtManipulator->normalizeStmts($stmts);
$setUpClassMethod = $class->getMethod(MethodName::SET_UP);
if (!$setUpClassMethod instanceof ClassMethod) {
$setUpClassMethod = $this->setUpClassMethodFactory->createSetUpMethod($stmts);
$class->stmts = \array_merge([$setUpClassMethod], $class->stmts);
} else {
$setUpClassMethod->stmts = \array_merge((array) $setUpClassMethod->stmts, $stmts);
}
}
}

View File

@ -1,27 +0,0 @@
<?php
declare (strict_types=1);
namespace Rector\PHPUnit\NodeManipulator;
use PhpParser\Node\Expr;
use PhpParser\Node\Stmt;
use PhpParser\Node\Stmt\Expression;
final class StmtManipulator
{
/**
* @param Expr[]|Stmt[] $stmts
* @return Stmt[]
*/
public function normalizeStmts(array $stmts) : array
{
$normalizedStmts = [];
foreach ($stmts as $stmt) {
if ($stmt instanceof Expression) {
$normalizedStmts[] = $stmt;
continue;
}
$normalizedStmts[] = new Expression($stmt);
}
return $normalizedStmts;
}
}

View File

@ -4,6 +4,7 @@ declare (strict_types=1);
namespace Rector\PHPUnit\Rector\Class_;
use PhpParser\Node;
use PhpParser\Node\Identifier;
use PhpParser\Node\Stmt;
use PhpParser\Node\Stmt\Class_;
use PhpParser\Node\Stmt\ClassMethod;
@ -12,8 +13,9 @@ use Rector\Core\NodeAnalyzer\ClassAnalyzer;
use Rector\Core\Rector\AbstractRector;
use Rector\Core\ValueObject\MethodName;
use Rector\Nette\NodeAnalyzer\StaticCallAnalyzer;
use Rector\PHPUnit\NodeAnalyzer\SetUpMethodDecorator;
use Rector\PHPUnit\NodeAnalyzer\TestsNodeAnalyzer;
use Rector\PHPUnit\NodeManipulator\SetUpClassMethodNodeManipulator;
use Rector\Privatization\NodeManipulator\VisibilityManipulator;
use Symplify\RuleDocGenerator\ValueObject\CodeSample\CodeSample;
use Symplify\RuleDocGenerator\ValueObject\RuleDefinition;
/**
@ -23,11 +25,6 @@ use Symplify\RuleDocGenerator\ValueObject\RuleDefinition;
*/
final class ConstructClassMethodToSetUpTestCaseRector extends AbstractRector
{
/**
* @readonly
* @var \Rector\PHPUnit\NodeManipulator\SetUpClassMethodNodeManipulator
*/
private $setUpClassMethodNodeManipulator;
/**
* @readonly
* @var \Rector\Nette\NodeAnalyzer\StaticCallAnalyzer
@ -43,12 +40,23 @@ final class ConstructClassMethodToSetUpTestCaseRector extends AbstractRector
* @var \Rector\Core\NodeAnalyzer\ClassAnalyzer
*/
private $classAnalyzer;
public function __construct(SetUpClassMethodNodeManipulator $setUpClassMethodNodeManipulator, StaticCallAnalyzer $staticCallAnalyzer, TestsNodeAnalyzer $testsNodeAnalyzer, ClassAnalyzer $classAnalyzer)
/**
* @readonly
* @var \Rector\Privatization\NodeManipulator\VisibilityManipulator
*/
private $visibilityManipulator;
/**
* @readonly
* @var \Rector\PHPUnit\NodeAnalyzer\SetUpMethodDecorator
*/
private $setUpMethodDecorator;
public function __construct(StaticCallAnalyzer $staticCallAnalyzer, TestsNodeAnalyzer $testsNodeAnalyzer, ClassAnalyzer $classAnalyzer, VisibilityManipulator $visibilityManipulator, SetUpMethodDecorator $setUpMethodDecorator)
{
$this->setUpClassMethodNodeManipulator = $setUpClassMethodNodeManipulator;
$this->staticCallAnalyzer = $staticCallAnalyzer;
$this->testsNodeAnalyzer = $testsNodeAnalyzer;
$this->classAnalyzer = $classAnalyzer;
$this->visibilityManipulator = $visibilityManipulator;
$this->setUpMethodDecorator = $setUpMethodDecorator;
}
public function getRuleDefinition() : RuleDefinition
{
@ -105,9 +113,19 @@ CODE_SAMPLE
if ($this->classAnalyzer->isAnonymousClass($node)) {
return null;
}
$this->removeNode($constructClassMethod);
$addedStmts = $this->resolveStmtsToAddToSetUp($constructClassMethod);
$this->setUpClassMethodNodeManipulator->decorateOrCreate($node, $addedStmts);
$setUpClassMethod = $node->getMethod(MethodName::SET_UP);
if (!$setUpClassMethod instanceof ClassMethod) {
// no setUp() method yet, rename it to setUp :)
$constructClassMethod->name = new Identifier(MethodName::SET_UP);
$constructClassMethod->params = [];
$constructClassMethod->stmts = $addedStmts;
$this->setUpMethodDecorator->decorate($constructClassMethod);
$this->visibilityManipulator->makeProtected($constructClassMethod);
} else {
$this->removeNode($constructClassMethod);
$setUpClassMethod->stmts = \array_merge((array) $setUpClassMethod->stmts, $addedStmts);
}
return $node;
}
/**

View File

@ -20,7 +20,7 @@ final class UseSpecificWillMethodRector extends AbstractRector
/**
* @var array<string, string>
*/
private const NESTED_METHOD_TO_RENAME_MAP = ['returnArgument' => 'willReturnArgument', 'returnCallback' => 'willReturnCallback', 'returnSelf' => 'willReturnSelf', 'returnValue' => 'willReturn', 'returnValueMap' => 'willReturnMap', 'throwException' => 'willThrowException'];
private const NESTED_METHOD_TO_RENAME_MAP = ['returnArgument' => 'willReturnArgument', 'returnCallback' => 'willReturnCallback', 'returnSelf' => 'willReturnSelf', 'returnValue' => 'willReturn', 'returnValueMap' => 'willReturnMap', 'onConsecutiveCalls' => 'willReturnOnConsecutiveCalls', 'throwException' => 'willThrowException'];
/**
* @readonly
* @var \Rector\PHPUnit\NodeAnalyzer\TestsNodeAnalyzer