mirror of https://github.com/rectorphp/rector.git
Updated Rector to commit f78af109208cfe6c217a89ecd80fb7a5a5c518e9
f78af10920
[EarlyReturn] Remove ReturnAfterToEarlyOnBreakRector as risky and turning around next/previous nodes (#2624)
This commit is contained in:
parent
606cd7be37
commit
3d95b4f79c
|
@ -5,7 +5,6 @@ namespace RectorPrefix202207;
|
|||
|
||||
use Rector\Config\RectorConfig;
|
||||
use Rector\EarlyReturn\Rector\Foreach_\ChangeNestedForeachIfsToEarlyContinueRector;
|
||||
use Rector\EarlyReturn\Rector\Foreach_\ReturnAfterToEarlyOnBreakRector;
|
||||
use Rector\EarlyReturn\Rector\If_\ChangeAndIfToEarlyReturnRector;
|
||||
use Rector\EarlyReturn\Rector\If_\ChangeIfElseValueAssignToEarlyReturnRector;
|
||||
use Rector\EarlyReturn\Rector\If_\ChangeNestedIfsToEarlyReturnRector;
|
||||
|
@ -17,5 +16,5 @@ use Rector\EarlyReturn\Rector\Return_\ReturnBinaryAndToEarlyReturnRector;
|
|||
use Rector\EarlyReturn\Rector\Return_\ReturnBinaryOrToEarlyReturnRector;
|
||||
use Rector\EarlyReturn\Rector\StmtsAwareInterface\ReturnEarlyIfVariableRector;
|
||||
return static function (RectorConfig $rectorConfig) : void {
|
||||
$rectorConfig->rules([ChangeNestedForeachIfsToEarlyContinueRector::class, ChangeAndIfToEarlyReturnRector::class, ChangeIfElseValueAssignToEarlyReturnRector::class, ChangeNestedIfsToEarlyReturnRector::class, RemoveAlwaysElseRector::class, ReturnBinaryAndToEarlyReturnRector::class, ChangeOrIfReturnToEarlyReturnRector::class, ChangeOrIfContinueToMultiContinueRector::class, ReturnAfterToEarlyOnBreakRector::class, PreparedValueToEarlyReturnRector::class, ReturnBinaryOrToEarlyReturnRector::class, ReturnEarlyIfVariableRector::class]);
|
||||
$rectorConfig->rules([ChangeNestedForeachIfsToEarlyContinueRector::class, ChangeAndIfToEarlyReturnRector::class, ChangeIfElseValueAssignToEarlyReturnRector::class, ChangeNestedIfsToEarlyReturnRector::class, RemoveAlwaysElseRector::class, ReturnBinaryAndToEarlyReturnRector::class, ChangeOrIfReturnToEarlyReturnRector::class, ChangeOrIfContinueToMultiContinueRector::class, PreparedValueToEarlyReturnRector::class, ReturnBinaryOrToEarlyReturnRector::class, ReturnEarlyIfVariableRector::class]);
|
||||
};
|
||||
|
|
|
@ -1,138 +0,0 @@
|
|||
<?php
|
||||
|
||||
declare (strict_types=1);
|
||||
namespace Rector\EarlyReturn\Rector\Foreach_;
|
||||
|
||||
use PhpParser\Node;
|
||||
use PhpParser\Node\Expr;
|
||||
use PhpParser\Node\Expr\Assign;
|
||||
use PhpParser\Node\Stmt\Break_;
|
||||
use PhpParser\Node\Stmt\Expression;
|
||||
use PhpParser\Node\Stmt\Foreach_;
|
||||
use PhpParser\Node\Stmt\Return_;
|
||||
use Rector\Core\Rector\AbstractRector;
|
||||
use Rector\NodeTypeResolver\Node\AttributeKey;
|
||||
use Symplify\RuleDocGenerator\ValueObject\CodeSample\CodeSample;
|
||||
use Symplify\RuleDocGenerator\ValueObject\RuleDefinition;
|
||||
/**
|
||||
* @see \Rector\Tests\EarlyReturn\Rector\Foreach_\ReturnAfterToEarlyOnBreakRector\ReturnAfterToEarlyOnBreakRectorTest
|
||||
*/
|
||||
final class ReturnAfterToEarlyOnBreakRector extends AbstractRector
|
||||
{
|
||||
public function getRuleDefinition() : RuleDefinition
|
||||
{
|
||||
return new RuleDefinition('Change return after foreach to early return in foreach on break', [new CodeSample(<<<'CODE_SAMPLE'
|
||||
class SomeClass
|
||||
{
|
||||
public function run(array $pathConstants, string $allowedPath)
|
||||
{
|
||||
$pathOK = false;
|
||||
|
||||
foreach ($pathConstants as $allowedPath) {
|
||||
if ($dirPath == $allowedPath) {
|
||||
$pathOK = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
return $pathOK;
|
||||
}
|
||||
}
|
||||
CODE_SAMPLE
|
||||
, <<<'CODE_SAMPLE'
|
||||
class SomeClass
|
||||
{
|
||||
public function run(array $pathConstants, string $allowedPath)
|
||||
{
|
||||
foreach ($pathConstants as $allowedPath) {
|
||||
if ($dirPath == $allowedPath) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
}
|
||||
CODE_SAMPLE
|
||||
)]);
|
||||
}
|
||||
/**
|
||||
* @return array<class-string<Node>>
|
||||
*/
|
||||
public function getNodeTypes() : array
|
||||
{
|
||||
return [Foreach_::class];
|
||||
}
|
||||
/**
|
||||
* @param Foreach_ $node
|
||||
*/
|
||||
public function refactor(Node $node) : ?Node
|
||||
{
|
||||
/** @var Break_[] $breaks */
|
||||
$breaks = $this->betterNodeFinder->findInstanceOf($node->stmts, Break_::class);
|
||||
if (\count($breaks) !== 1) {
|
||||
return null;
|
||||
}
|
||||
$beforeBreak = $breaks[0]->getAttribute(AttributeKey::PREVIOUS_NODE);
|
||||
if (!$beforeBreak instanceof Expression) {
|
||||
return null;
|
||||
}
|
||||
$assign = $beforeBreak->expr;
|
||||
if (!$assign instanceof Assign) {
|
||||
return null;
|
||||
}
|
||||
$nextForeach = $node->getAttribute(AttributeKey::NEXT_NODE);
|
||||
if (!$nextForeach instanceof Return_) {
|
||||
return null;
|
||||
}
|
||||
$assignVariable = $assign->var;
|
||||
/** @var Expr $variablePrevious */
|
||||
$variablePrevious = $this->betterNodeFinder->findFirstPrevious($node, function (Node $node) use($assignVariable) : bool {
|
||||
$parent = $node->getAttribute(AttributeKey::PARENT_NODE);
|
||||
if (!$parent instanceof Assign) {
|
||||
return \false;
|
||||
}
|
||||
return $this->nodeComparator->areNodesEqual($node, $assignVariable);
|
||||
});
|
||||
if ($this->shouldSkip($nextForeach, $node, $assignVariable, $variablePrevious)) {
|
||||
return null;
|
||||
}
|
||||
/** @var Assign $assignPreviousVariable */
|
||||
$assignPreviousVariable = $variablePrevious->getAttribute(AttributeKey::PARENT_NODE);
|
||||
$parent = $assignPreviousVariable->getAttribute(AttributeKey::PARENT_NODE);
|
||||
if (!$parent instanceof Expression) {
|
||||
return null;
|
||||
}
|
||||
$nextParent = $parent->getAttribute(AttributeKey::NEXT_NODE);
|
||||
if ($nextParent !== $node) {
|
||||
return null;
|
||||
}
|
||||
return $this->processEarlyReturn($beforeBreak, $assign, $breaks, $nextForeach, $assignPreviousVariable, $node);
|
||||
}
|
||||
/**
|
||||
* @param Break_[] $breaks
|
||||
*/
|
||||
private function processEarlyReturn(Expression $expression, Assign $assign, array $breaks, Return_ $return, Assign $assignPreviousVariable, Foreach_ $foreach) : Foreach_
|
||||
{
|
||||
$this->removeNode($expression);
|
||||
$this->nodesToAddCollector->addNodeBeforeNode(new Return_($assign->expr), $breaks[0]);
|
||||
$this->removeNode($breaks[0]);
|
||||
$return->expr = $assignPreviousVariable->expr;
|
||||
$this->removeNode($assignPreviousVariable);
|
||||
return $foreach;
|
||||
}
|
||||
private function shouldSkip(Return_ $return, Foreach_ $foreach, Expr $assignVariable, Expr $expr = null) : bool
|
||||
{
|
||||
if (!$expr instanceof Expr) {
|
||||
return \true;
|
||||
}
|
||||
if (!$this->nodeComparator->areNodesEqual($return->expr, $expr)) {
|
||||
return \true;
|
||||
}
|
||||
// ensure the variable only used once in foreach
|
||||
$usedVariable = $this->betterNodeFinder->find($foreach->stmts, function (Node $node) use($assignVariable) : bool {
|
||||
return $this->nodeComparator->areNodesEqual($node, $assignVariable);
|
||||
});
|
||||
return \count($usedVariable) > 1;
|
||||
}
|
||||
}
|
|
@ -17,12 +17,12 @@ final class VersionResolver
|
|||
* @api
|
||||
* @var string
|
||||
*/
|
||||
public const PACKAGE_VERSION = '8eedf1878f6882c8cba5b696613828a6ae15790d';
|
||||
public const PACKAGE_VERSION = 'f78af109208cfe6c217a89ecd80fb7a5a5c518e9';
|
||||
/**
|
||||
* @api
|
||||
* @var string
|
||||
*/
|
||||
public const RELEASE_DATE = '2022-07-03 19:01:36';
|
||||
public const RELEASE_DATE = '2022-07-03 22:23:22';
|
||||
/**
|
||||
* @var int
|
||||
*/
|
||||
|
|
|
@ -9,4 +9,4 @@ if (PHP_VERSION_ID < 50600) {
|
|||
|
||||
require_once __DIR__ . '/composer/autoload_real.php';
|
||||
|
||||
return ComposerAutoloaderInit07bac8f7205b1fa239a4e44e121247a2::getLoader();
|
||||
return ComposerAutoloaderInit522b44807a3f3ba3c95e93316c058088::getLoader();
|
||||
|
|
|
@ -1965,7 +1965,6 @@ return array(
|
|||
'Rector\\EarlyReturn\\NodeFactory\\InvertedIfFactory' => $baseDir . '/rules/EarlyReturn/NodeFactory/InvertedIfFactory.php',
|
||||
'Rector\\EarlyReturn\\NodeTransformer\\ConditionInverter' => $baseDir . '/rules/EarlyReturn/NodeTransformer/ConditionInverter.php',
|
||||
'Rector\\EarlyReturn\\Rector\\Foreach_\\ChangeNestedForeachIfsToEarlyContinueRector' => $baseDir . '/rules/EarlyReturn/Rector/Foreach_/ChangeNestedForeachIfsToEarlyContinueRector.php',
|
||||
'Rector\\EarlyReturn\\Rector\\Foreach_\\ReturnAfterToEarlyOnBreakRector' => $baseDir . '/rules/EarlyReturn/Rector/Foreach_/ReturnAfterToEarlyOnBreakRector.php',
|
||||
'Rector\\EarlyReturn\\Rector\\If_\\ChangeAndIfToEarlyReturnRector' => $baseDir . '/rules/EarlyReturn/Rector/If_/ChangeAndIfToEarlyReturnRector.php',
|
||||
'Rector\\EarlyReturn\\Rector\\If_\\ChangeIfElseValueAssignToEarlyReturnRector' => $baseDir . '/rules/EarlyReturn/Rector/If_/ChangeIfElseValueAssignToEarlyReturnRector.php',
|
||||
'Rector\\EarlyReturn\\Rector\\If_\\ChangeNestedIfsToEarlyReturnRector' => $baseDir . '/rules/EarlyReturn/Rector/If_/ChangeNestedIfsToEarlyReturnRector.php',
|
||||
|
|
|
@ -2,7 +2,7 @@
|
|||
|
||||
// autoload_real.php @generated by Composer
|
||||
|
||||
class ComposerAutoloaderInit07bac8f7205b1fa239a4e44e121247a2
|
||||
class ComposerAutoloaderInit522b44807a3f3ba3c95e93316c058088
|
||||
{
|
||||
private static $loader;
|
||||
|
||||
|
@ -22,19 +22,19 @@ class ComposerAutoloaderInit07bac8f7205b1fa239a4e44e121247a2
|
|||
return self::$loader;
|
||||
}
|
||||
|
||||
spl_autoload_register(array('ComposerAutoloaderInit07bac8f7205b1fa239a4e44e121247a2', 'loadClassLoader'), true, true);
|
||||
spl_autoload_register(array('ComposerAutoloaderInit522b44807a3f3ba3c95e93316c058088', 'loadClassLoader'), true, true);
|
||||
self::$loader = $loader = new \Composer\Autoload\ClassLoader(\dirname(__DIR__));
|
||||
spl_autoload_unregister(array('ComposerAutoloaderInit07bac8f7205b1fa239a4e44e121247a2', 'loadClassLoader'));
|
||||
spl_autoload_unregister(array('ComposerAutoloaderInit522b44807a3f3ba3c95e93316c058088', 'loadClassLoader'));
|
||||
|
||||
require __DIR__ . '/autoload_static.php';
|
||||
call_user_func(\Composer\Autoload\ComposerStaticInit07bac8f7205b1fa239a4e44e121247a2::getInitializer($loader));
|
||||
call_user_func(\Composer\Autoload\ComposerStaticInit522b44807a3f3ba3c95e93316c058088::getInitializer($loader));
|
||||
|
||||
$loader->setClassMapAuthoritative(true);
|
||||
$loader->register(true);
|
||||
|
||||
$includeFiles = \Composer\Autoload\ComposerStaticInit07bac8f7205b1fa239a4e44e121247a2::$files;
|
||||
$includeFiles = \Composer\Autoload\ComposerStaticInit522b44807a3f3ba3c95e93316c058088::$files;
|
||||
foreach ($includeFiles as $fileIdentifier => $file) {
|
||||
composerRequire07bac8f7205b1fa239a4e44e121247a2($fileIdentifier, $file);
|
||||
composerRequire522b44807a3f3ba3c95e93316c058088($fileIdentifier, $file);
|
||||
}
|
||||
|
||||
return $loader;
|
||||
|
@ -46,7 +46,7 @@ class ComposerAutoloaderInit07bac8f7205b1fa239a4e44e121247a2
|
|||
* @param string $file
|
||||
* @return void
|
||||
*/
|
||||
function composerRequire07bac8f7205b1fa239a4e44e121247a2($fileIdentifier, $file)
|
||||
function composerRequire522b44807a3f3ba3c95e93316c058088($fileIdentifier, $file)
|
||||
{
|
||||
if (empty($GLOBALS['__composer_autoload_files'][$fileIdentifier])) {
|
||||
$GLOBALS['__composer_autoload_files'][$fileIdentifier] = true;
|
||||
|
|
|
@ -4,7 +4,7 @@
|
|||
|
||||
namespace Composer\Autoload;
|
||||
|
||||
class ComposerStaticInit07bac8f7205b1fa239a4e44e121247a2
|
||||
class ComposerStaticInit522b44807a3f3ba3c95e93316c058088
|
||||
{
|
||||
public static $files = array (
|
||||
'0e6d7bf4a5811bfa5cf40c5ccd6fae6a' => __DIR__ . '/..' . '/symfony/polyfill-mbstring/bootstrap.php',
|
||||
|
@ -2272,7 +2272,6 @@ class ComposerStaticInit07bac8f7205b1fa239a4e44e121247a2
|
|||
'Rector\\EarlyReturn\\NodeFactory\\InvertedIfFactory' => __DIR__ . '/../..' . '/rules/EarlyReturn/NodeFactory/InvertedIfFactory.php',
|
||||
'Rector\\EarlyReturn\\NodeTransformer\\ConditionInverter' => __DIR__ . '/../..' . '/rules/EarlyReturn/NodeTransformer/ConditionInverter.php',
|
||||
'Rector\\EarlyReturn\\Rector\\Foreach_\\ChangeNestedForeachIfsToEarlyContinueRector' => __DIR__ . '/../..' . '/rules/EarlyReturn/Rector/Foreach_/ChangeNestedForeachIfsToEarlyContinueRector.php',
|
||||
'Rector\\EarlyReturn\\Rector\\Foreach_\\ReturnAfterToEarlyOnBreakRector' => __DIR__ . '/../..' . '/rules/EarlyReturn/Rector/Foreach_/ReturnAfterToEarlyOnBreakRector.php',
|
||||
'Rector\\EarlyReturn\\Rector\\If_\\ChangeAndIfToEarlyReturnRector' => __DIR__ . '/../..' . '/rules/EarlyReturn/Rector/If_/ChangeAndIfToEarlyReturnRector.php',
|
||||
'Rector\\EarlyReturn\\Rector\\If_\\ChangeIfElseValueAssignToEarlyReturnRector' => __DIR__ . '/../..' . '/rules/EarlyReturn/Rector/If_/ChangeIfElseValueAssignToEarlyReturnRector.php',
|
||||
'Rector\\EarlyReturn\\Rector\\If_\\ChangeNestedIfsToEarlyReturnRector' => __DIR__ . '/../..' . '/rules/EarlyReturn/Rector/If_/ChangeNestedIfsToEarlyReturnRector.php',
|
||||
|
@ -3416,9 +3415,9 @@ class ComposerStaticInit07bac8f7205b1fa239a4e44e121247a2
|
|||
public static function getInitializer(ClassLoader $loader)
|
||||
{
|
||||
return \Closure::bind(function () use ($loader) {
|
||||
$loader->prefixLengthsPsr4 = ComposerStaticInit07bac8f7205b1fa239a4e44e121247a2::$prefixLengthsPsr4;
|
||||
$loader->prefixDirsPsr4 = ComposerStaticInit07bac8f7205b1fa239a4e44e121247a2::$prefixDirsPsr4;
|
||||
$loader->classMap = ComposerStaticInit07bac8f7205b1fa239a4e44e121247a2::$classMap;
|
||||
$loader->prefixLengthsPsr4 = ComposerStaticInit522b44807a3f3ba3c95e93316c058088::$prefixLengthsPsr4;
|
||||
$loader->prefixDirsPsr4 = ComposerStaticInit522b44807a3f3ba3c95e93316c058088::$prefixDirsPsr4;
|
||||
$loader->classMap = ComposerStaticInit522b44807a3f3ba3c95e93316c058088::$classMap;
|
||||
|
||||
}, null, ClassLoader::class);
|
||||
}
|
||||
|
|
|
@ -2135,12 +2135,12 @@
|
|||
"source": {
|
||||
"type": "git",
|
||||
"url": "https:\/\/github.com\/rectorphp\/rector-laravel.git",
|
||||
"reference": "7d3c7342ad89992c544fbd60193c90649b8edd60"
|
||||
"reference": "ab8aaccb0ae2b6e3c1f8b8e56557af684f69fea0"
|
||||
},
|
||||
"dist": {
|
||||
"type": "zip",
|
||||
"url": "https:\/\/api.github.com\/repos\/rectorphp\/rector-laravel\/zipball\/7d3c7342ad89992c544fbd60193c90649b8edd60",
|
||||
"reference": "7d3c7342ad89992c544fbd60193c90649b8edd60",
|
||||
"url": "https:\/\/api.github.com\/repos\/rectorphp\/rector-laravel\/zipball\/ab8aaccb0ae2b6e3c1f8b8e56557af684f69fea0",
|
||||
"reference": "ab8aaccb0ae2b6e3c1f8b8e56557af684f69fea0",
|
||||
"shasum": ""
|
||||
},
|
||||
"require": {
|
||||
|
@ -2164,7 +2164,7 @@
|
|||
"symplify\/rule-doc-generator": "^11.0",
|
||||
"symplify\/vendor-patches": "^11.0"
|
||||
},
|
||||
"time": "2022-07-02T07:33:20+00:00",
|
||||
"time": "2022-07-03T18:49:55+00:00",
|
||||
"default-branch": true,
|
||||
"type": "rector-extension",
|
||||
"extra": {
|
||||
|
@ -2202,12 +2202,12 @@
|
|||
"source": {
|
||||
"type": "git",
|
||||
"url": "https:\/\/github.com\/rectorphp\/rector-nette.git",
|
||||
"reference": "9489bdb38f8bea75bf7071f6313900363c5ae332"
|
||||
"reference": "003b954a5707bda6100014b33afd3674ea4a744b"
|
||||
},
|
||||
"dist": {
|
||||
"type": "zip",
|
||||
"url": "https:\/\/api.github.com\/repos\/rectorphp\/rector-nette\/zipball\/9489bdb38f8bea75bf7071f6313900363c5ae332",
|
||||
"reference": "9489bdb38f8bea75bf7071f6313900363c5ae332",
|
||||
"url": "https:\/\/api.github.com\/repos\/rectorphp\/rector-nette\/zipball\/003b954a5707bda6100014b33afd3674ea4a744b",
|
||||
"reference": "003b954a5707bda6100014b33afd3674ea4a744b",
|
||||
"shasum": ""
|
||||
},
|
||||
"require": {
|
||||
|
@ -2239,7 +2239,7 @@
|
|||
"symplify\/rule-doc-generator": "^11.0",
|
||||
"symplify\/vendor-patches": "^11.0"
|
||||
},
|
||||
"time": "2022-07-03T11:55:16+00:00",
|
||||
"time": "2022-07-03T18:43:51+00:00",
|
||||
"default-branch": true,
|
||||
"type": "rector-extension",
|
||||
"extra": {
|
||||
|
@ -2269,7 +2269,7 @@
|
|||
"description": "Rector upgrades rules for Nette Framework",
|
||||
"support": {
|
||||
"issues": "https:\/\/github.com\/rectorphp\/rector-nette\/issues",
|
||||
"source": "https:\/\/github.com\/rectorphp\/rector-nette\/tree\/0.13.1"
|
||||
"source": "https:\/\/github.com\/rectorphp\/rector-nette\/tree\/main"
|
||||
},
|
||||
"install-path": "..\/rector\/rector-nette"
|
||||
},
|
||||
|
@ -2347,12 +2347,12 @@
|
|||
"source": {
|
||||
"type": "git",
|
||||
"url": "https:\/\/github.com\/rectorphp\/rector-phpunit.git",
|
||||
"reference": "97b53970d204083f6e2abaa0f1ffd071b660487f"
|
||||
"reference": "ca42a8ea43abe8e975382c585ec9adbf293df01f"
|
||||
},
|
||||
"dist": {
|
||||
"type": "zip",
|
||||
"url": "https:\/\/api.github.com\/repos\/rectorphp\/rector-phpunit\/zipball\/97b53970d204083f6e2abaa0f1ffd071b660487f",
|
||||
"reference": "97b53970d204083f6e2abaa0f1ffd071b660487f",
|
||||
"url": "https:\/\/api.github.com\/repos\/rectorphp\/rector-phpunit\/zipball\/ca42a8ea43abe8e975382c585ec9adbf293df01f",
|
||||
"reference": "ca42a8ea43abe8e975382c585ec9adbf293df01f",
|
||||
"shasum": ""
|
||||
},
|
||||
"require": {
|
||||
|
@ -2377,7 +2377,7 @@
|
|||
"symplify\/rule-doc-generator": "^11.0",
|
||||
"symplify\/vendor-patches": "^11.0"
|
||||
},
|
||||
"time": "2022-07-01T22:33:06+00:00",
|
||||
"time": "2022-07-03T19:13:24+00:00",
|
||||
"default-branch": true,
|
||||
"type": "rector-extension",
|
||||
"extra": {
|
||||
|
|
File diff suppressed because one or more lines are too long
|
@ -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 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 9489bdb'), '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'));
|
||||
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 ab8aacc'), '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 003b954'), '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 ca42a8e'), '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()
|
||||
{
|
||||
}
|
||||
|
|
|
@ -13,6 +13,7 @@ use PHPStan\Type\ObjectType;
|
|||
use Rector\Core\Rector\AbstractRector;
|
||||
use Rector\Laravel\NodeFactory\AppAssignFactory;
|
||||
use Rector\Laravel\ValueObject\ServiceNameTypeAndVariableName;
|
||||
use Rector\PostRector\Collector\NodesToAddCollector;
|
||||
use Symplify\RuleDocGenerator\ValueObject\CodeSample\CodeSample;
|
||||
use Symplify\RuleDocGenerator\ValueObject\RuleDefinition;
|
||||
/**
|
||||
|
@ -29,9 +30,15 @@ final class CallOnAppArrayAccessToStandaloneAssignRector extends AbstractRector
|
|||
* @var \Rector\Laravel\NodeFactory\AppAssignFactory
|
||||
*/
|
||||
private $appAssignFactory;
|
||||
public function __construct(AppAssignFactory $appAssignFactory)
|
||||
/**
|
||||
* @readonly
|
||||
* @var \Rector\PostRector\Collector\NodesToAddCollector
|
||||
*/
|
||||
private $nodesToAddCollector;
|
||||
public function __construct(AppAssignFactory $appAssignFactory, NodesToAddCollector $nodesToAddCollector)
|
||||
{
|
||||
$this->appAssignFactory = $appAssignFactory;
|
||||
$this->nodesToAddCollector = $nodesToAddCollector;
|
||||
$this->serviceNameTypeAndVariableNames[] = new ServiceNameTypeAndVariableName('validator', 'Illuminate\\Validation\\Factory', 'validationFactory');
|
||||
}
|
||||
/**
|
||||
|
|
|
@ -13,7 +13,7 @@ use Rector\Nette\NodeAnalyzer\StaticCallAnalyzer;
|
|||
use Symplify\RuleDocGenerator\ValueObject\CodeSample\CodeSample;
|
||||
use Symplify\RuleDocGenerator\ValueObject\RuleDefinition;
|
||||
/**
|
||||
* @see https://laracasts.com/discuss/channels/laravel/laravel-57-upgrade-observer-problem
|
||||
* @changelog https://laracasts.com/discuss/channels/laravel/laravel-57-upgrade-observer-problem
|
||||
*
|
||||
* @see \Rector\Laravel\Tests\Rector\ClassMethod\AddParentBootToModelClassMethodRector\AddParentBootToModelClassMethodRectorTest
|
||||
*/
|
||||
|
|
|
@ -13,7 +13,7 @@ use Rector\Nette\NodeAnalyzer\StaticCallAnalyzer;
|
|||
use Symplify\RuleDocGenerator\ValueObject\CodeSample\CodeSample;
|
||||
use Symplify\RuleDocGenerator\ValueObject\RuleDefinition;
|
||||
/**
|
||||
* @see https://laravel.com/docs/8.x/upgrade#the-event-service-provider-class
|
||||
* @changelog https://laravel.com/docs/8.x/upgrade#the-event-service-provider-class
|
||||
*
|
||||
* @see \Rector\Laravel\Tests\Rector\ClassMethod\AddParentRegisterToEventServiceProviderRector\AddParentRegisterToEventServiceProviderRectorTest
|
||||
*/
|
||||
|
|
|
@ -22,8 +22,8 @@ use Rector\Privatization\NodeManipulator\VisibilityManipulator;
|
|||
use Symplify\RuleDocGenerator\ValueObject\CodeSample\CodeSample;
|
||||
use Symplify\RuleDocGenerator\ValueObject\RuleDefinition;
|
||||
/**
|
||||
* @see https://github.com/laravel/framework/issues/26450#issuecomment-449401202
|
||||
* @see https://github.com/laravel/framework/commit/055fe52dbb7169dc51bd5d5deeb05e8da9be0470#diff-76a649cb397ea47f5613459c335f88c1b68e5f93e51d46e9fb5308ec55ded221
|
||||
* @changelog https://github.com/laravel/framework/issues/26450#issuecomment-449401202
|
||||
* @changelog https://github.com/laravel/framework/commit/055fe52dbb7169dc51bd5d5deeb05e8da9be0470#diff-76a649cb397ea47f5613459c335f88c1b68e5f93e51d46e9fb5308ec55ded221
|
||||
*
|
||||
* @see \Rector\Laravel\Tests\Rector\Class_\AddMockConsoleOutputFalseToConsoleTestsRector\AddMockConsoleOutputFalseToConsoleTestsRectorTest
|
||||
*/
|
||||
|
|
|
@ -13,8 +13,8 @@ use Rector\Core\Rector\AbstractRector;
|
|||
use Symplify\RuleDocGenerator\ValueObject\CodeSample\CodeSample;
|
||||
use Symplify\RuleDocGenerator\ValueObject\RuleDefinition;
|
||||
/**
|
||||
* @see https://github.com/laravel/framework/pull/36906
|
||||
* @see https://github.com/laravel/framework/pull/37352
|
||||
* @changelog https://github.com/laravel/framework/pull/36906
|
||||
* @changelog https://github.com/laravel/framework/pull/37352
|
||||
*
|
||||
* @see \Rector\Laravel\Tests\Rector\Class_\AnonymousMigrationsRector\AnonymousMigrationsRectorTest
|
||||
*/
|
||||
|
|
|
@ -12,7 +12,7 @@ use Rector\Core\Rector\AbstractRector;
|
|||
use Symplify\RuleDocGenerator\ValueObject\CodeSample\CodeSample;
|
||||
use Symplify\RuleDocGenerator\ValueObject\RuleDefinition;
|
||||
/**
|
||||
* @see https://laravel.com/docs/5.8/upgrade#deferred-service-providers
|
||||
* @changelog https://laravel.com/docs/5.8/upgrade#deferred-service-providers
|
||||
*
|
||||
* @see \Rector\Laravel\Tests\Rector\Class_\PropertyDeferToDeferrableProviderToRector\PropertyDeferToDeferrableProviderToRectorTest
|
||||
*/
|
||||
|
|
|
@ -17,7 +17,7 @@ use Symplify\RuleDocGenerator\ValueObject\CodeSample\CodeSample;
|
|||
use Symplify\RuleDocGenerator\ValueObject\RuleDefinition;
|
||||
use RectorPrefix202207\Webmozart\Assert\Assert;
|
||||
/**
|
||||
* @see https://github.com/laravel/framework/pull/32856
|
||||
* @changelog https://github.com/laravel/framework/pull/32856
|
||||
*
|
||||
* @see \Rector\Laravel\Tests\Rector\Class_\UnifyModelDatesWithCastsRector\UnifyModelDatesWithCastsRectorTest
|
||||
*/
|
||||
|
|
|
@ -12,8 +12,8 @@ use Rector\Core\Rector\AbstractRector;
|
|||
use Symplify\RuleDocGenerator\ValueObject\CodeSample\CodeSample;
|
||||
use Symplify\RuleDocGenerator\ValueObject\RuleDefinition;
|
||||
/**
|
||||
* @see https://laravel.com/docs/7.x/database-testing#creating-models
|
||||
* @see https://laravel.com/docs/8.x/database-testing#instantiating-models
|
||||
* @changelog https://laravel.com/docs/7.x/database-testing#creating-models
|
||||
* @changelog https://laravel.com/docs/8.x/database-testing#instantiating-models
|
||||
*
|
||||
* @see \Rector\Laravel\Tests\Rector\FuncCall\FactoryFuncCallToStaticCallRector\FactoryFuncCallToStaticCallRectorTest
|
||||
*/
|
||||
|
|
|
@ -9,8 +9,8 @@ use Rector\Core\Rector\AbstractRector;
|
|||
use Symplify\RuleDocGenerator\ValueObject\CodeSample\CodeSample;
|
||||
use Symplify\RuleDocGenerator\ValueObject\RuleDefinition;
|
||||
/**
|
||||
* @see https://laravel.com/docs/8.x/helpers#method-app
|
||||
* @see https://github.com/laravel/framework/blob/8.x/src/Illuminate/Foundation/helpers.php
|
||||
* @changelog https://laravel.com/docs/8.x/helpers#method-app
|
||||
* @changelog https://github.com/laravel/framework/blob/8.x/src/Illuminate/Foundation/helpers.php
|
||||
*
|
||||
* @see \Rector\Laravel\Tests\Rector\FuncCall\HelperFuncCallToFacadeClassRector\HelperFuncCallToFacadeClassRectorTest
|
||||
*/
|
||||
|
|
|
@ -13,16 +13,26 @@ use PhpParser\Node\Expr\Variable;
|
|||
use PhpParser\Node\Scalar\String_;
|
||||
use PHPStan\Type\ObjectType;
|
||||
use Rector\Core\Rector\AbstractRector;
|
||||
use Rector\PostRector\Collector\NodesToAddCollector;
|
||||
use Symplify\RuleDocGenerator\ValueObject\CodeSample\CodeSample;
|
||||
use Symplify\RuleDocGenerator\ValueObject\RuleDefinition;
|
||||
/**
|
||||
* @see https://github.com/laravel/framework/pull/25315
|
||||
* @see https://laracasts.com/discuss/channels/eloquent/laravel-eloquent-where-date-is-equal-or-smaller-than-datetime
|
||||
* @changelog https://github.com/laravel/framework/pull/25315
|
||||
* @changelog https://laracasts.com/discuss/channels/eloquent/laravel-eloquent-where-date-is-equal-or-smaller-than-datetime
|
||||
*
|
||||
* @see \Rector\Laravel\Tests\Rector\MethodCall\ChangeQueryWhereDateValueWithCarbonRector\ChangeQueryWhereDateValueWithCarbonRectorTest
|
||||
*/
|
||||
final class ChangeQueryWhereDateValueWithCarbonRector extends AbstractRector
|
||||
{
|
||||
/**
|
||||
* @readonly
|
||||
* @var \Rector\PostRector\Collector\NodesToAddCollector
|
||||
*/
|
||||
private $nodesToAddCollector;
|
||||
public function __construct(NodesToAddCollector $nodesToAddCollector)
|
||||
{
|
||||
$this->nodesToAddCollector = $nodesToAddCollector;
|
||||
}
|
||||
public function getRuleDefinition() : RuleDefinition
|
||||
{
|
||||
return new RuleDefinition('Add parent::boot(); call to boot() class method in child of Illuminate\\Database\\Eloquent\\Model', [new CodeSample(<<<'CODE_SAMPLE'
|
||||
|
|
|
@ -14,8 +14,8 @@ use Symplify\RuleDocGenerator\ValueObject\CodeSample\CodeSample;
|
|||
use Symplify\RuleDocGenerator\ValueObject\RuleDefinition;
|
||||
use RectorPrefix202207\Webmozart\Assert\Assert;
|
||||
/**
|
||||
* @see https://laravel.com/docs/7.x/database-testing#creating-models
|
||||
* @see https://laravel.com/docs/8.x/database-testing#applying-states
|
||||
* @changelog https://laravel.com/docs/7.x/database-testing#creating-models
|
||||
* @changelog https://laravel.com/docs/8.x/database-testing#applying-states
|
||||
*
|
||||
* @see \Rector\Laravel\Tests\Rector\MethodCall\FactoryApplyingStatesRector\FactoryApplyingStatesRectorTest
|
||||
*/
|
||||
|
|
|
@ -21,8 +21,8 @@ use Rector\Laravel\NodeFactory\ModelFactoryNodeFactory;
|
|||
use Symplify\RuleDocGenerator\ValueObject\CodeSample\CodeSample;
|
||||
use Symplify\RuleDocGenerator\ValueObject\RuleDefinition;
|
||||
/**
|
||||
* @see https://laravel.com/docs/7.x/database-testing#writing-factories
|
||||
* @see https://laravel.com/docs/8.x/database-testing#defining-model-factories
|
||||
* @changelog https://laravel.com/docs/7.x/database-testing#writing-factories
|
||||
* @changelog https://laravel.com/docs/8.x/database-testing#defining-model-factories
|
||||
*
|
||||
* @see \Rector\Laravel\Tests\Rector\Namespace_\FactoryDefinitionRector\FactoryDefinitionRectorTest
|
||||
*/
|
||||
|
|
|
@ -10,16 +10,26 @@ use PhpParser\Node\Expr\New_;
|
|||
use PhpParser\Node\Expr\Variable;
|
||||
use PhpParser\Node\Scalar\String_;
|
||||
use Rector\Core\Rector\AbstractRector;
|
||||
use Rector\PostRector\Collector\NodesToAddCollector;
|
||||
use Symplify\RuleDocGenerator\ValueObject\CodeSample\CodeSample;
|
||||
use Symplify\RuleDocGenerator\ValueObject\RuleDefinition;
|
||||
/**
|
||||
* @see https://github.com/laravel/framework/commit/f5d8c0a673aa9fc6cd94aa4858a0027fe550a22e#diff-162a49c054acde9f386ec735607b95bc4a1c0c765a6f46da8de9a8a4ef5199d3
|
||||
* @see https://github.com/laravel/framework/pull/25261
|
||||
* @changelog https://github.com/laravel/framework/commit/f5d8c0a673aa9fc6cd94aa4858a0027fe550a22e#diff-162a49c054acde9f386ec735607b95bc4a1c0c765a6f46da8de9a8a4ef5199d3
|
||||
* @changelog https://github.com/laravel/framework/pull/25261
|
||||
*
|
||||
* @see \Rector\Laravel\Tests\Rector\New_\AddGuardToLoginEventRector\AddGuardToLoginEventRectorTest
|
||||
*/
|
||||
final class AddGuardToLoginEventRector extends AbstractRector
|
||||
{
|
||||
/**
|
||||
* @readonly
|
||||
* @var \Rector\PostRector\Collector\NodesToAddCollector
|
||||
*/
|
||||
private $nodesToAddCollector;
|
||||
public function __construct(NodesToAddCollector $nodesToAddCollector)
|
||||
{
|
||||
$this->nodesToAddCollector = $nodesToAddCollector;
|
||||
}
|
||||
public function getRuleDefinition() : RuleDefinition
|
||||
{
|
||||
return new RuleDefinition('Add new $guard argument to Illuminate\\Auth\\Events\\Login', [new CodeSample(<<<'CODE_SAMPLE'
|
||||
|
|
|
@ -25,9 +25,9 @@ use Symplify\RuleDocGenerator\ValueObject\CodeSample\ConfiguredCodeSample;
|
|||
use Symplify\RuleDocGenerator\ValueObject\RuleDefinition;
|
||||
use RectorPrefix202207\Webmozart\Assert\Assert;
|
||||
/**
|
||||
* @see https://github.com/laravel/laravel/pull/5670
|
||||
* @see https://github.com/laravel/framework/pull/38868
|
||||
* @see https://wiki.php.net/rfc/nullsafe_operator
|
||||
* @changelog https://github.com/laravel/laravel/pull/5670
|
||||
* @changelog https://github.com/laravel/framework/pull/38868
|
||||
* @changelog https://wiki.php.net/rfc/nullsafe_operator
|
||||
*
|
||||
* @see \Rector\Laravel\Tests\Rector\PropertyFetch\OptionalToNullsafeOperatorRector\OptionalToNullsafeOperatorRectorTest
|
||||
*/
|
||||
|
|
|
@ -15,8 +15,8 @@ use Rector\Laravel\ValueObject\TypeToTimeMethodAndPosition;
|
|||
use Symplify\RuleDocGenerator\ValueObject\CodeSample\CodeSample;
|
||||
use Symplify\RuleDocGenerator\ValueObject\RuleDefinition;
|
||||
/**
|
||||
* @see https://github.com/laravel/framework/pull/27276
|
||||
* @see https://laravel.com/docs/5.8/upgrade#cache-ttl-in-seconds
|
||||
* @changelog https://github.com/laravel/framework/pull/27276
|
||||
* @changelog https://laravel.com/docs/5.8/upgrade#cache-ttl-in-seconds
|
||||
*
|
||||
* @see \Rector\Laravel\Tests\Rector\StaticCall\MinutesToSecondsInCacheRector\MinutesToSecondsInCacheRectorTest
|
||||
*/
|
||||
|
|
|
@ -12,7 +12,7 @@ use Rector\Core\Rector\AbstractRector;
|
|||
use Symplify\RuleDocGenerator\ValueObject\CodeSample\CodeSample;
|
||||
use Symplify\RuleDocGenerator\ValueObject\RuleDefinition;
|
||||
/**
|
||||
* @see https://laravel.com/docs/5.7/upgrade
|
||||
* @changelog https://laravel.com/docs/5.7/upgrade
|
||||
* @see \Rector\Laravel\Tests\Rector\StaticCall\Redirect301ToPermanentRedirectRector\Redirect301ToPermanentRedirectRectorTest
|
||||
*/
|
||||
final class Redirect301ToPermanentRedirectRector extends AbstractRector
|
||||
|
|
|
@ -16,7 +16,7 @@ use Rector\Core\Rector\AbstractRector;
|
|||
use Symplify\RuleDocGenerator\ValueObject\CodeSample\CodeSample;
|
||||
use Symplify\RuleDocGenerator\ValueObject\RuleDefinition;
|
||||
/**
|
||||
* @see https://github.com/laravel/framework/pull/27276
|
||||
* @changelog https://github.com/laravel/framework/pull/27276
|
||||
* @see \Rector\Laravel\Tests\Rector\StaticCall\RequestStaticValidateToInjectRector\RequestStaticValidateToInjectRectorTest
|
||||
*/
|
||||
final class RequestStaticValidateToInjectRector extends AbstractRector
|
||||
|
|
|
@ -21,7 +21,7 @@ use Symplify\RuleDocGenerator\ValueObject\RuleDefinition;
|
|||
use RectorPrefix202207\Symplify\SmartFileSystem\SmartFileInfo;
|
||||
use RectorPrefix202207\Webmozart\Assert\Assert;
|
||||
/**
|
||||
* @see https://laravel.com/docs/8.x/upgrade#automatic-controller-namespace-prefixing
|
||||
* @changelog https://laravel.com/docs/8.x/upgrade#automatic-controller-namespace-prefixing
|
||||
*
|
||||
* @see \Rector\Laravel\Tests\Rector\StaticCall\RouteActionCallableRector\RouteActionCallableRectorTest
|
||||
*/
|
||||
|
|
|
@ -19,7 +19,6 @@ use Rector\Renaming\ValueObject\MethodCallRename;
|
|||
use Rector\Renaming\ValueObject\RenameStaticMethod;
|
||||
use Rector\Transform\Rector\Assign\DimFetchAssignToMethodCallRector;
|
||||
use Rector\Transform\Rector\Assign\PropertyFetchToMethodCallRector;
|
||||
use Rector\Transform\Rector\MethodCall\CallableInMethodCallToVariableRector;
|
||||
use Rector\Transform\ValueObject\CallableInMethodCallToVariable;
|
||||
use Rector\Transform\ValueObject\DimFetchAssignToMethodCall;
|
||||
use Rector\Transform\ValueObject\PropertyFetchToMethodCall;
|
||||
|
@ -30,10 +29,6 @@ return static function (RectorConfig $rectorConfig) : void {
|
|||
$rectorConfig->ruleWithConfiguration(PropertyFetchToMethodCallRector::class, [new PropertyFetchToMethodCall('Nette\\Application\\UI\\Form', 'values', 'getValues')]);
|
||||
// some attributes were added in nette 3.0, but only in one of latest patch versions; it's is safer to add them in 3.1
|
||||
$rectorConfig->sets([NetteSetList::ANNOTATIONS_TO_ATTRIBUTES]);
|
||||
$rectorConfig->ruleWithConfiguration(CallableInMethodCallToVariableRector::class, [
|
||||
// see https://github.com/nette/caching/commit/5ffe263752af5ccf3866a28305e7b2669ab4da82
|
||||
new CallableInMethodCallToVariable('Nette\\Caching\\Cache', 'save', 1),
|
||||
]);
|
||||
$rectorConfig->ruleWithConfiguration(RenameClassRector::class, [
|
||||
'Nette\\Bridges\\ApplicationLatte\\Template' => 'Nette\\Bridges\\ApplicationLatte\\DefaultTemplate',
|
||||
// https://github.com/nette/application/compare/v3.0.7...v3.1.0
|
||||
|
|
|
@ -4,30 +4,30 @@ declare (strict_types=1);
|
|||
namespace RectorPrefix202207;
|
||||
|
||||
use Rector\Config\RectorConfig;
|
||||
use Rector\Core\Configuration\Option;
|
||||
use Rector\Php55\Rector\String_\StringClassNameToClassConstantRector;
|
||||
use Rector\Set\ValueObject\LevelSetList;
|
||||
use Rector\Set\ValueObject\SetList;
|
||||
return static function (RectorConfig $rectorConfig) : void {
|
||||
$parameters = $rectorConfig->parameters();
|
||||
$parameters->set(Option::AUTO_IMPORT_NAMES, \true);
|
||||
$parameters->set(Option::PARALLEL, \true);
|
||||
$parameters->set(Option::PATHS, [__DIR__ . '/src', __DIR__ . '/tests']);
|
||||
$parameters->set(Option::SKIP, [
|
||||
$rectorConfig->importNames();
|
||||
$rectorConfig->parallel();
|
||||
$rectorConfig->paths([__DIR__ . '/src', __DIR__ . '/tests']);
|
||||
$rectorConfig->skip([
|
||||
// for tests
|
||||
'*/Source/*',
|
||||
'*/Fixture/*',
|
||||
// object types
|
||||
StringClassNameToClassConstantRector::class => [__DIR__ . '/src/Rector/MethodCall/UseSpecificWillMethodRector.php', __DIR__ . '/src/Rector/Class_/TestListenerToHooksRector.php', __DIR__ . '/src/NodeFactory/ConsecutiveAssertionFactory.php', __DIR__ . '/src/NodeAnalyzer/TestsNodeAnalyzer.php', __DIR__ . '/src/NodeFactory/DataProviderClassMethodFactory.php', __DIR__ . '/config'],
|
||||
]);
|
||||
// needed for DEAD_CODE list, just in split package like this
|
||||
$rectorConfig->import(__DIR__ . '/config/config.php');
|
||||
$rectorConfig->import(LevelSetList::UP_TO_PHP_81);
|
||||
$rectorConfig->import(SetList::DEAD_CODE);
|
||||
$rectorConfig->import(SetList::CODE_QUALITY);
|
||||
$rectorConfig->import(SetList::CODING_STYLE);
|
||||
$rectorConfig->import(SetList::EARLY_RETURN);
|
||||
$rectorConfig->import(SetList::NAMING);
|
||||
$rectorConfig->sets([
|
||||
// needed for DEAD_CODE list, just in split package like this
|
||||
__DIR__ . '/config/config.php',
|
||||
LevelSetList::UP_TO_PHP_81,
|
||||
SetList::DEAD_CODE,
|
||||
SetList::CODE_QUALITY,
|
||||
SetList::CODING_STYLE,
|
||||
SetList::EARLY_RETURN,
|
||||
SetList::NAMING,
|
||||
]);
|
||||
$rectorConfig->ruleWithConfiguration(StringClassNameToClassConstantRector::class, [
|
||||
// keep unprefixed to protected from downgrade
|
||||
'PHPUnit\\Framework\\Assert',
|
||||
|
|
Loading…
Reference in New Issue