mirror of https://github.com/rectorphp/rector.git
Updated Rector to commit d2ae72e1fe616bb5c2d98c497a59991cfb5cca55
d2ae72e1fe
Remove NEXT_NODE from IfToSpaceshipRector (#3860)
This commit is contained in:
parent
ddec6bfaa0
commit
3847b0c3b5
|
@ -3,13 +3,13 @@
|
|||
declare (strict_types=1);
|
||||
namespace Rector\EarlyReturn\Rector\Return_;
|
||||
|
||||
use PHPStan\Analyser\Scope;
|
||||
use PhpParser\Node;
|
||||
use PhpParser\Node\Expr;
|
||||
use PhpParser\Node\Expr\BinaryOp\BooleanAnd;
|
||||
use PhpParser\Node\Expr\BinaryOp\BooleanOr;
|
||||
use PhpParser\Node\Stmt\If_;
|
||||
use PhpParser\Node\Stmt\Return_;
|
||||
use PHPStan\Analyser\Scope;
|
||||
use Rector\Core\NodeAnalyzer\CallAnalyzer;
|
||||
use Rector\Core\NodeManipulator\IfManipulator;
|
||||
use Rector\Core\PhpParser\Node\AssignAndBinaryMap;
|
||||
|
|
|
@ -0,0 +1,16 @@
|
|||
<?php
|
||||
|
||||
declare (strict_types=1);
|
||||
namespace Rector\Php70\Enum;
|
||||
|
||||
final class BattleshipCompareOrder
|
||||
{
|
||||
/**
|
||||
* @var string
|
||||
*/
|
||||
public const ASC = 'asc';
|
||||
/**
|
||||
* @var string
|
||||
*/
|
||||
public const DESC = 'desc';
|
||||
}
|
|
@ -0,0 +1,106 @@
|
|||
<?php
|
||||
|
||||
declare (strict_types=1);
|
||||
namespace Rector\Php70\NodeAnalyzer;
|
||||
|
||||
use PhpParser\Node\Expr;
|
||||
use PhpParser\Node\Expr\BinaryOp\Greater;
|
||||
use PhpParser\Node\Expr\BinaryOp\Smaller;
|
||||
use PhpParser\Node\Expr\Ternary;
|
||||
use Rector\Core\PhpParser\Comparing\NodeComparator;
|
||||
use Rector\Core\PhpParser\Node\Value\ValueResolver;
|
||||
use Rector\Php70\Enum\BattleshipCompareOrder;
|
||||
use Rector\Php70\ValueObject\ComparedExprs;
|
||||
final class BattleshipTernaryAnalyzer
|
||||
{
|
||||
/**
|
||||
* @readonly
|
||||
* @var \Rector\Core\PhpParser\Comparing\NodeComparator
|
||||
*/
|
||||
private $nodeComparator;
|
||||
/**
|
||||
* @readonly
|
||||
* @var \Rector\Core\PhpParser\Node\Value\ValueResolver
|
||||
*/
|
||||
private $valueResolver;
|
||||
public function __construct(NodeComparator $nodeComparator, ValueResolver $valueResolver)
|
||||
{
|
||||
$this->nodeComparator = $nodeComparator;
|
||||
$this->valueResolver = $valueResolver;
|
||||
}
|
||||
/**
|
||||
* @return BattleshipCompareOrder::*|null
|
||||
*/
|
||||
public function isGreaterLowerCompareReturnOneAndMinusOne(Ternary $ternary, ComparedExprs $comparedExprs) : ?string
|
||||
{
|
||||
if (!$ternary->if instanceof Expr) {
|
||||
return null;
|
||||
}
|
||||
if ($ternary->cond instanceof Greater) {
|
||||
return $this->evaluateGreater($ternary->cond, $ternary, $comparedExprs);
|
||||
}
|
||||
if ($ternary->cond instanceof Smaller) {
|
||||
return $this->evaluateSmaller($ternary->cond, $ternary, $comparedExprs);
|
||||
}
|
||||
return null;
|
||||
}
|
||||
/**
|
||||
* We look for:
|
||||
*
|
||||
* $firstValue > $secondValue ? 1 : -1
|
||||
*
|
||||
* @return BattleshipCompareOrder::*|null
|
||||
*/
|
||||
private function evaluateGreater(Greater $greater, Ternary $ternary, ComparedExprs $comparedExprs) : ?string
|
||||
{
|
||||
if (!$ternary->if instanceof Expr) {
|
||||
return null;
|
||||
}
|
||||
if (!$this->nodeComparator->areNodesEqual($greater->left, $comparedExprs->getFirstExpr())) {
|
||||
return null;
|
||||
}
|
||||
if (!$this->nodeComparator->areNodesEqual($greater->right, $comparedExprs->getSecondExpr())) {
|
||||
return null;
|
||||
}
|
||||
if ($this->isValueOneAndMinusOne($ternary->if, $ternary->else)) {
|
||||
return BattleshipCompareOrder::DESC;
|
||||
}
|
||||
if ($this->isValueOneAndMinusOne($ternary->else, $ternary->if)) {
|
||||
return BattleshipCompareOrder::ASC;
|
||||
}
|
||||
return null;
|
||||
}
|
||||
/**
|
||||
* We look for:
|
||||
*
|
||||
* $firstValue < $secondValue ? -1 : 1
|
||||
*
|
||||
* @return BattleshipCompareOrder::*|null
|
||||
*/
|
||||
private function evaluateSmaller(Smaller $smaller, Ternary $ternary, ComparedExprs $comparedExprs) : ?string
|
||||
{
|
||||
if (!$ternary->if instanceof Expr) {
|
||||
return null;
|
||||
}
|
||||
if (!$this->nodeComparator->areNodesEqual($smaller->left, $comparedExprs->getFirstExpr())) {
|
||||
return null;
|
||||
}
|
||||
if (!$this->nodeComparator->areNodesEqual($smaller->right, $comparedExprs->getSecondExpr())) {
|
||||
return null;
|
||||
}
|
||||
if ($this->isValueOneAndMinusOne($ternary->if, $ternary->else)) {
|
||||
return BattleshipCompareOrder::ASC;
|
||||
}
|
||||
if ($this->isValueOneAndMinusOne($ternary->else, $ternary->if)) {
|
||||
return BattleshipCompareOrder::DESC;
|
||||
}
|
||||
return null;
|
||||
}
|
||||
private function isValueOneAndMinusOne(Expr $firstExpr, Expr $seconcExpr) : bool
|
||||
{
|
||||
if (!$this->valueResolver->isValue($firstExpr, 1)) {
|
||||
return \false;
|
||||
}
|
||||
return $this->valueResolver->isValue($seconcExpr, -1);
|
||||
}
|
||||
}
|
|
@ -6,17 +6,18 @@ namespace Rector\Php70\Rector\If_;
|
|||
use PhpParser\Node;
|
||||
use PhpParser\Node\Expr;
|
||||
use PhpParser\Node\Expr\BinaryOp\Equal;
|
||||
use PhpParser\Node\Expr\BinaryOp\Greater;
|
||||
use PhpParser\Node\Expr\BinaryOp\Identical;
|
||||
use PhpParser\Node\Expr\BinaryOp\Smaller;
|
||||
use PhpParser\Node\Expr\BinaryOp\Spaceship;
|
||||
use PhpParser\Node\Expr\Ternary;
|
||||
use PhpParser\Node\Stmt\Else_;
|
||||
use PhpParser\Node\Stmt\If_;
|
||||
use PhpParser\Node\Stmt\Return_;
|
||||
use Rector\Core\Contract\PhpParser\Node\StmtsAwareInterface;
|
||||
use Rector\Core\Rector\AbstractRector;
|
||||
use Rector\Core\ValueObject\PhpVersionFeature;
|
||||
use Rector\NodeTypeResolver\Node\AttributeKey;
|
||||
use Rector\Php70\Enum\BattleshipCompareOrder;
|
||||
use Rector\Php70\NodeAnalyzer\BattleshipTernaryAnalyzer;
|
||||
use Rector\Php70\ValueObject\ComparedExprs;
|
||||
use Rector\VersionBonding\Contract\MinPhpVersionInterface;
|
||||
use Symplify\RuleDocGenerator\ValueObject\CodeSample\CodeSample;
|
||||
use Symplify\RuleDocGenerator\ValueObject\RuleDefinition;
|
||||
|
@ -28,60 +29,29 @@ use Symplify\RuleDocGenerator\ValueObject\RuleDefinition;
|
|||
final class IfToSpaceshipRector extends AbstractRector implements MinPhpVersionInterface
|
||||
{
|
||||
/**
|
||||
* @var int|float|string|bool|mixed[]|null
|
||||
* @readonly
|
||||
* @var \Rector\Php70\NodeAnalyzer\BattleshipTernaryAnalyzer
|
||||
*/
|
||||
private $onEqual = null;
|
||||
/**
|
||||
* @var int|float|string|bool|mixed[]|null
|
||||
*/
|
||||
private $onSmaller = null;
|
||||
/**
|
||||
* @var int|float|string|bool|mixed[]|null
|
||||
*/
|
||||
private $onGreater = null;
|
||||
/**
|
||||
* @var \PhpParser\Node\Expr|null
|
||||
*/
|
||||
private $firstValue;
|
||||
/**
|
||||
* @var \PhpParser\Node\Expr|null
|
||||
*/
|
||||
private $secondValue;
|
||||
/**
|
||||
* @var \PhpParser\Node|null
|
||||
*/
|
||||
private $nextNode = null;
|
||||
/**
|
||||
* @var \PhpParser\Node\Expr\Ternary|null
|
||||
*/
|
||||
private $ternary = null;
|
||||
private $battleshipTernaryAnalyzer;
|
||||
public function __construct(BattleshipTernaryAnalyzer $battleshipTernaryAnalyzer)
|
||||
{
|
||||
$this->battleshipTernaryAnalyzer = $battleshipTernaryAnalyzer;
|
||||
}
|
||||
public function getRuleDefinition() : RuleDefinition
|
||||
{
|
||||
return new RuleDefinition('Changes if/else to spaceship <=> where useful', [new CodeSample(<<<'CODE_SAMPLE'
|
||||
class SomeClass
|
||||
{
|
||||
public function run()
|
||||
{
|
||||
usort($languages, function ($a, $b) {
|
||||
if ($a[0] === $b[0]) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
return ($a[0] < $b[0]) ? 1 : -1;
|
||||
});
|
||||
}
|
||||
usort($languages, function ($first, $second) {
|
||||
if ($first[0] === $second[0]) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
return ($first[0] < $second[0]) ? 1 : -1;
|
||||
});
|
||||
CODE_SAMPLE
|
||||
, <<<'CODE_SAMPLE'
|
||||
class SomeClass
|
||||
{
|
||||
public function run()
|
||||
{
|
||||
usort($languages, function ($a, $b) {
|
||||
return $b[0] <=> $a[0];
|
||||
});
|
||||
}
|
||||
}
|
||||
usort($languages, function ($first, $second) {
|
||||
return $second[0] <=> $first[0];
|
||||
});
|
||||
CODE_SAMPLE
|
||||
)]);
|
||||
}
|
||||
|
@ -90,31 +60,43 @@ CODE_SAMPLE
|
|||
*/
|
||||
public function getNodeTypes() : array
|
||||
{
|
||||
return [If_::class];
|
||||
return [StmtsAwareInterface::class, If_::class];
|
||||
}
|
||||
/**
|
||||
* @param If_ $node
|
||||
* @param StmtsAwareInterface|If_ $node
|
||||
*/
|
||||
public function refactor(Node $node) : ?Node
|
||||
{
|
||||
if (!$node->cond instanceof Equal && !$node->cond instanceof Identical) {
|
||||
if ($node instanceof If_) {
|
||||
return $this->refactorIf($node);
|
||||
}
|
||||
if ($node->stmts === null) {
|
||||
return null;
|
||||
}
|
||||
$this->reset();
|
||||
$this->matchOnEqualFirstValueAndSecondValue($node);
|
||||
if (!isset($this->firstValue, $this->secondValue)) {
|
||||
return null;
|
||||
}
|
||||
/** @var Equal|Identical $condition */
|
||||
$condition = $node->cond;
|
||||
if (!$this->areVariablesEqual($condition, $this->firstValue, $this->secondValue)) {
|
||||
return null;
|
||||
}
|
||||
if ([$this->onGreater, $this->onEqual, $this->onSmaller] === [1, 0, -1]) {
|
||||
return $this->processAscendingSort($this->ternary, $this->firstValue, $this->secondValue);
|
||||
}
|
||||
if ([$this->onGreater, $this->onEqual, $this->onSmaller] === [-1, 0, 1]) {
|
||||
return $this->processDescendingSort($this->ternary, $this->firstValue, $this->secondValue);
|
||||
foreach ($node->stmts as $key => $stmt) {
|
||||
if (!$stmt instanceof Return_) {
|
||||
continue;
|
||||
}
|
||||
if (!$stmt->expr instanceof Ternary) {
|
||||
continue;
|
||||
}
|
||||
// preceeded by if
|
||||
$prevStmt = $node->stmts[$key - 1] ?? null;
|
||||
if (!$prevStmt instanceof If_) {
|
||||
continue;
|
||||
}
|
||||
$comparedExprs = $this->matchExprComparedExprsReturnZero($prevStmt);
|
||||
if (!$comparedExprs instanceof ComparedExprs) {
|
||||
continue;
|
||||
}
|
||||
$battleshipCompareOrder = $this->battleshipTernaryAnalyzer->isGreaterLowerCompareReturnOneAndMinusOne($stmt->expr, $comparedExprs);
|
||||
$returnSpaceship = $this->createReturnSpaceship($battleshipCompareOrder, $comparedExprs);
|
||||
if (!$returnSpaceship instanceof Return_) {
|
||||
continue;
|
||||
}
|
||||
unset($node->stmts[$key - 1]);
|
||||
$node->stmts[$key] = $returnSpaceship;
|
||||
return $node;
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
@ -122,114 +104,80 @@ CODE_SAMPLE
|
|||
{
|
||||
return PhpVersionFeature::SPACESHIP;
|
||||
}
|
||||
private function processReturnSpaceship(Expr $firstValue, Expr $secondValue) : Return_
|
||||
private function refactorIf(If_ $if) : ?Return_
|
||||
{
|
||||
if ($this->nextNode instanceof Return_) {
|
||||
$this->removeNode($this->nextNode);
|
||||
if ($if->elseifs !== []) {
|
||||
return null;
|
||||
}
|
||||
// spaceship ready!
|
||||
$spaceship = new Spaceship($secondValue, $firstValue);
|
||||
return new Return_($spaceship);
|
||||
}
|
||||
private function reset() : void
|
||||
{
|
||||
$this->onEqual = null;
|
||||
$this->onSmaller = null;
|
||||
$this->onGreater = null;
|
||||
$this->firstValue = null;
|
||||
$this->secondValue = null;
|
||||
}
|
||||
private function matchOnEqualFirstValueAndSecondValue(If_ $if) : void
|
||||
{
|
||||
$this->matchOnEqual($if);
|
||||
if ($if->else instanceof Else_) {
|
||||
$this->processElse($if->else);
|
||||
} else {
|
||||
$nextNode = $if->getAttribute(AttributeKey::NEXT_NODE);
|
||||
if ($nextNode instanceof Return_ && $nextNode->expr instanceof Ternary) {
|
||||
$this->ternary = $nextNode->expr;
|
||||
$this->processTernary($this->ternary, $nextNode);
|
||||
}
|
||||
if (!$if->else instanceof Else_) {
|
||||
return null;
|
||||
}
|
||||
$comparedExprs = $this->matchExprComparedExprsReturnZero($if);
|
||||
if (!$comparedExprs instanceof ComparedExprs) {
|
||||
return null;
|
||||
}
|
||||
$ternary = $this->matchElseOnlyStmtTernary($if->else);
|
||||
if (!$ternary instanceof Ternary) {
|
||||
return null;
|
||||
}
|
||||
$battleshipCompareOrder = $this->battleshipTernaryAnalyzer->isGreaterLowerCompareReturnOneAndMinusOne($ternary, $comparedExprs);
|
||||
return $this->createReturnSpaceship($battleshipCompareOrder, $comparedExprs);
|
||||
}
|
||||
/**
|
||||
* @param \PhpParser\Node\Expr\BinaryOp\Equal|\PhpParser\Node\Expr\BinaryOp\Identical $binaryOp
|
||||
* We look for:
|
||||
*
|
||||
* if ($firstValue === $secondValue) {
|
||||
* return 0;
|
||||
* }
|
||||
*/
|
||||
private function areVariablesEqual($binaryOp, Expr $firstValue, Expr $secondValue) : bool
|
||||
private function matchExprComparedExprsReturnZero(If_ $if) : ?ComparedExprs
|
||||
{
|
||||
if ($this->nodeComparator->areNodesEqual($binaryOp->left, $firstValue) && $this->nodeComparator->areNodesEqual($binaryOp->right, $secondValue)) {
|
||||
return \true;
|
||||
if (!$if->cond instanceof Equal && !$if->cond instanceof Identical) {
|
||||
return null;
|
||||
}
|
||||
if (!$this->nodeComparator->areNodesEqual($binaryOp->right, $firstValue)) {
|
||||
return \false;
|
||||
}
|
||||
return $this->nodeComparator->areNodesEqual($binaryOp->left, $secondValue);
|
||||
}
|
||||
private function matchOnEqual(If_ $if) : void
|
||||
{
|
||||
$binaryOp = $if->cond;
|
||||
if (\count($if->stmts) !== 1) {
|
||||
return;
|
||||
return null;
|
||||
}
|
||||
$onlyIfStmt = $if->stmts[0];
|
||||
if ($onlyIfStmt instanceof Return_) {
|
||||
if (!$onlyIfStmt->expr instanceof Expr) {
|
||||
return;
|
||||
}
|
||||
// on Enum usage not in same file, it got object
|
||||
$value = $this->valueResolver->getValue($onlyIfStmt->expr);
|
||||
if (\is_object($value)) {
|
||||
return;
|
||||
}
|
||||
$this->onEqual = $value;
|
||||
$onlyStmt = $if->stmts[0];
|
||||
if (!$onlyStmt instanceof Return_) {
|
||||
return null;
|
||||
}
|
||||
if (!$onlyStmt->expr instanceof Expr) {
|
||||
return null;
|
||||
}
|
||||
if (!$this->valueResolver->isValue($onlyStmt->expr, 0)) {
|
||||
return null;
|
||||
}
|
||||
return new ComparedExprs($binaryOp->left, $binaryOp->right);
|
||||
}
|
||||
private function processElse(Else_ $else) : void
|
||||
/**
|
||||
* @param BattleshipCompareOrder::*|null $battleshipCompareOrder
|
||||
*/
|
||||
private function createReturnSpaceship(?string $battleshipCompareOrder, ComparedExprs $comparedExprs) : ?Return_
|
||||
{
|
||||
if ($battleshipCompareOrder === null) {
|
||||
return null;
|
||||
}
|
||||
if ($battleshipCompareOrder === BattleshipCompareOrder::DESC) {
|
||||
$spaceship = new Spaceship($comparedExprs->getFirstExpr(), $comparedExprs->getSecondExpr());
|
||||
} else {
|
||||
$spaceship = new Spaceship($comparedExprs->getSecondExpr(), $comparedExprs->getFirstExpr());
|
||||
}
|
||||
return new Return_($spaceship);
|
||||
}
|
||||
private function matchElseOnlyStmtTernary(Else_ $else) : ?\PhpParser\Node\Expr\Ternary
|
||||
{
|
||||
if (\count($else->stmts) !== 1) {
|
||||
return;
|
||||
return null;
|
||||
}
|
||||
if (!$else->stmts[0] instanceof Return_) {
|
||||
return;
|
||||
$onlyElseStmt = $else->stmts[0];
|
||||
if (!$onlyElseStmt instanceof Return_) {
|
||||
return null;
|
||||
}
|
||||
/** @var Return_ $returnNode */
|
||||
$returnNode = $else->stmts[0];
|
||||
if ($returnNode->expr instanceof Ternary) {
|
||||
$this->ternary = $returnNode->expr;
|
||||
$this->processTernary($returnNode->expr, null);
|
||||
if (!$onlyElseStmt->expr instanceof Ternary) {
|
||||
return null;
|
||||
}
|
||||
}
|
||||
private function processTernary(Ternary $ternary, ?Return_ $return) : void
|
||||
{
|
||||
if ($ternary->cond instanceof Smaller) {
|
||||
$this->firstValue = $ternary->cond->left;
|
||||
$this->secondValue = $ternary->cond->right;
|
||||
if ($ternary->if instanceof Expr) {
|
||||
$this->onSmaller = $this->valueResolver->getValue($ternary->if);
|
||||
}
|
||||
$this->onGreater = $this->valueResolver->getValue($ternary->else);
|
||||
$this->nextNode = $return;
|
||||
} elseif ($ternary->cond instanceof Greater) {
|
||||
$this->firstValue = $ternary->cond->right;
|
||||
$this->secondValue = $ternary->cond->left;
|
||||
if ($ternary->if instanceof Expr) {
|
||||
$this->onGreater = $this->valueResolver->getValue($ternary->if);
|
||||
}
|
||||
$this->onSmaller = $this->valueResolver->getValue($ternary->else);
|
||||
$this->nextNode = $return;
|
||||
}
|
||||
}
|
||||
private function processAscendingSort(?Ternary $ternary, Expr $firstValue, Expr $secondValue) : Return_
|
||||
{
|
||||
if ($ternary instanceof Ternary && !$ternary->cond instanceof Greater) {
|
||||
return $this->processReturnSpaceship($secondValue, $firstValue);
|
||||
}
|
||||
return $this->processReturnSpaceship($firstValue, $secondValue);
|
||||
}
|
||||
private function processDescendingSort(?Ternary $ternary, Expr $firstValue, Expr $secondValue) : Return_
|
||||
{
|
||||
if ($ternary instanceof Ternary && !$ternary->cond instanceof Smaller) {
|
||||
return $this->processReturnSpaceship($secondValue, $firstValue);
|
||||
}
|
||||
return $this->processReturnSpaceship($firstValue, $secondValue);
|
||||
return $onlyElseStmt->expr;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -0,0 +1,32 @@
|
|||
<?php
|
||||
|
||||
declare (strict_types=1);
|
||||
namespace Rector\Php70\ValueObject;
|
||||
|
||||
use PhpParser\Node\Expr;
|
||||
final class ComparedExprs
|
||||
{
|
||||
/**
|
||||
* @readonly
|
||||
* @var \PhpParser\Node\Expr
|
||||
*/
|
||||
private $firstExpr;
|
||||
/**
|
||||
* @readonly
|
||||
* @var \PhpParser\Node\Expr
|
||||
*/
|
||||
private $secondExpr;
|
||||
public function __construct(Expr $firstExpr, Expr $secondExpr)
|
||||
{
|
||||
$this->firstExpr = $firstExpr;
|
||||
$this->secondExpr = $secondExpr;
|
||||
}
|
||||
public function getFirstExpr() : Expr
|
||||
{
|
||||
return $this->firstExpr;
|
||||
}
|
||||
public function getSecondExpr() : Expr
|
||||
{
|
||||
return $this->secondExpr;
|
||||
}
|
||||
}
|
|
@ -14,7 +14,6 @@ use PHPStan\Type\ObjectType;
|
|||
use Rector\Core\Contract\Rector\ConfigurableRectorInterface;
|
||||
use Rector\Core\NodeAnalyzer\PropertyFetchAnalyzer;
|
||||
use Rector\Core\NodeManipulator\MagicPropertyFetchAnalyzer;
|
||||
use Rector\Core\Rector\AbstractRector;
|
||||
use Rector\Core\Rector\AbstractScopeAwareRector;
|
||||
use Rector\NodeTypeResolver\Node\AttributeKey;
|
||||
use Rector\Transform\ValueObject\GetAndSetToMethodCall;
|
||||
|
|
|
@ -19,12 +19,12 @@ final class VersionResolver
|
|||
* @api
|
||||
* @var string
|
||||
*/
|
||||
public const PACKAGE_VERSION = 'c0a042c3b68eb657d7e525ae2c2648d0ec96fb19';
|
||||
public const PACKAGE_VERSION = 'd2ae72e1fe616bb5c2d98c497a59991cfb5cca55';
|
||||
/**
|
||||
* @api
|
||||
* @var string
|
||||
*/
|
||||
public const RELEASE_DATE = '2023-05-16 12:32:32';
|
||||
public const RELEASE_DATE = '2023-05-16 12:46:18';
|
||||
/**
|
||||
* @var int
|
||||
*/
|
||||
|
|
|
@ -15,7 +15,7 @@ final class RectorKernel
|
|||
/**
|
||||
* @var string
|
||||
*/
|
||||
private const CACHE_KEY = 'v8';
|
||||
private const CACHE_KEY = 'v9';
|
||||
/**
|
||||
* @var \Symfony\Component\DependencyInjection\ContainerInterface|null
|
||||
*/
|
||||
|
|
|
@ -22,4 +22,4 @@ if (PHP_VERSION_ID < 50600) {
|
|||
|
||||
require_once __DIR__ . '/composer/autoload_real.php';
|
||||
|
||||
return ComposerAutoloaderInitbecc49e92c90914d9f48d7a2c7da99f5::getLoader();
|
||||
return ComposerAutoloaderInit527c958222df83203b5281f72b24c52b::getLoader();
|
||||
|
|
|
@ -2171,8 +2171,10 @@ return array(
|
|||
'Rector\\Php56\\NodeAnalyzer\\UndefinedVariableResolver' => $baseDir . '/rules/Php56/NodeAnalyzer/UndefinedVariableResolver.php',
|
||||
'Rector\\Php56\\Rector\\FuncCall\\PowToExpRector' => $baseDir . '/rules/Php56/Rector/FuncCall/PowToExpRector.php',
|
||||
'Rector\\Php56\\Rector\\FunctionLike\\AddDefaultValueForUndefinedVariableRector' => $baseDir . '/rules/Php56/Rector/FunctionLike/AddDefaultValueForUndefinedVariableRector.php',
|
||||
'Rector\\Php70\\Enum\\BattleshipCompareOrder' => $baseDir . '/rules/Php70/Enum/BattleshipCompareOrder.php',
|
||||
'Rector\\Php70\\EregToPcreTransformer' => $baseDir . '/rules/Php70/EregToPcreTransformer.php',
|
||||
'Rector\\Php70\\Exception\\InvalidEregException' => $baseDir . '/rules/Php70/Exception/InvalidEregException.php',
|
||||
'Rector\\Php70\\NodeAnalyzer\\BattleshipTernaryAnalyzer' => $baseDir . '/rules/Php70/NodeAnalyzer/BattleshipTernaryAnalyzer.php',
|
||||
'Rector\\Php70\\NodeAnalyzer\\Php4ConstructorClassMethodAnalyzer' => $baseDir . '/rules/Php70/NodeAnalyzer/Php4ConstructorClassMethodAnalyzer.php',
|
||||
'Rector\\Php70\\Rector\\Assign\\ListSplitStringRector' => $baseDir . '/rules/Php70/Rector/Assign/ListSplitStringRector.php',
|
||||
'Rector\\Php70\\Rector\\Assign\\ListSwapArrayOrderRector' => $baseDir . '/rules/Php70/Rector/Assign/ListSwapArrayOrderRector.php',
|
||||
|
@ -2192,6 +2194,7 @@ return array(
|
|||
'Rector\\Php70\\Rector\\Ternary\\TernaryToNullCoalescingRector' => $baseDir . '/rules/Php70/Rector/Ternary/TernaryToNullCoalescingRector.php',
|
||||
'Rector\\Php70\\Rector\\Ternary\\TernaryToSpaceshipRector' => $baseDir . '/rules/Php70/Rector/Ternary/TernaryToSpaceshipRector.php',
|
||||
'Rector\\Php70\\Rector\\Variable\\WrapVariableVariableNameInCurlyBracesRector' => $baseDir . '/rules/Php70/Rector/Variable/WrapVariableVariableNameInCurlyBracesRector.php',
|
||||
'Rector\\Php70\\ValueObject\\ComparedExprs' => $baseDir . '/rules/Php70/ValueObject/ComparedExprs.php',
|
||||
'Rector\\Php71\\IsArrayAndDualCheckToAble' => $baseDir . '/rules/Php71/IsArrayAndDualCheckToAble.php',
|
||||
'Rector\\Php71\\NodeAnalyzer\\CountableAnalyzer' => $baseDir . '/rules/Php71/NodeAnalyzer/CountableAnalyzer.php',
|
||||
'Rector\\Php71\\Rector\\Assign\\AssignArrayToStringRector' => $baseDir . '/rules/Php71/Rector/Assign/AssignArrayToStringRector.php',
|
||||
|
|
|
@ -2,7 +2,7 @@
|
|||
|
||||
// autoload_real.php @generated by Composer
|
||||
|
||||
class ComposerAutoloaderInitbecc49e92c90914d9f48d7a2c7da99f5
|
||||
class ComposerAutoloaderInit527c958222df83203b5281f72b24c52b
|
||||
{
|
||||
private static $loader;
|
||||
|
||||
|
@ -22,17 +22,17 @@ class ComposerAutoloaderInitbecc49e92c90914d9f48d7a2c7da99f5
|
|||
return self::$loader;
|
||||
}
|
||||
|
||||
spl_autoload_register(array('ComposerAutoloaderInitbecc49e92c90914d9f48d7a2c7da99f5', 'loadClassLoader'), true, true);
|
||||
spl_autoload_register(array('ComposerAutoloaderInit527c958222df83203b5281f72b24c52b', 'loadClassLoader'), true, true);
|
||||
self::$loader = $loader = new \Composer\Autoload\ClassLoader(\dirname(__DIR__));
|
||||
spl_autoload_unregister(array('ComposerAutoloaderInitbecc49e92c90914d9f48d7a2c7da99f5', 'loadClassLoader'));
|
||||
spl_autoload_unregister(array('ComposerAutoloaderInit527c958222df83203b5281f72b24c52b', 'loadClassLoader'));
|
||||
|
||||
require __DIR__ . '/autoload_static.php';
|
||||
call_user_func(\Composer\Autoload\ComposerStaticInitbecc49e92c90914d9f48d7a2c7da99f5::getInitializer($loader));
|
||||
call_user_func(\Composer\Autoload\ComposerStaticInit527c958222df83203b5281f72b24c52b::getInitializer($loader));
|
||||
|
||||
$loader->setClassMapAuthoritative(true);
|
||||
$loader->register(true);
|
||||
|
||||
$filesToLoad = \Composer\Autoload\ComposerStaticInitbecc49e92c90914d9f48d7a2c7da99f5::$files;
|
||||
$filesToLoad = \Composer\Autoload\ComposerStaticInit527c958222df83203b5281f72b24c52b::$files;
|
||||
$requireFile = \Closure::bind(static function ($fileIdentifier, $file) {
|
||||
if (empty($GLOBALS['__composer_autoload_files'][$fileIdentifier])) {
|
||||
$GLOBALS['__composer_autoload_files'][$fileIdentifier] = true;
|
||||
|
|
|
@ -4,7 +4,7 @@
|
|||
|
||||
namespace Composer\Autoload;
|
||||
|
||||
class ComposerStaticInitbecc49e92c90914d9f48d7a2c7da99f5
|
||||
class ComposerStaticInit527c958222df83203b5281f72b24c52b
|
||||
{
|
||||
public static $files = array (
|
||||
'ad155f8f1cf0d418fe49e248db8c661b' => __DIR__ . '/..' . '/react/promise/src/functions_include.php',
|
||||
|
@ -2413,8 +2413,10 @@ class ComposerStaticInitbecc49e92c90914d9f48d7a2c7da99f5
|
|||
'Rector\\Php56\\NodeAnalyzer\\UndefinedVariableResolver' => __DIR__ . '/../..' . '/rules/Php56/NodeAnalyzer/UndefinedVariableResolver.php',
|
||||
'Rector\\Php56\\Rector\\FuncCall\\PowToExpRector' => __DIR__ . '/../..' . '/rules/Php56/Rector/FuncCall/PowToExpRector.php',
|
||||
'Rector\\Php56\\Rector\\FunctionLike\\AddDefaultValueForUndefinedVariableRector' => __DIR__ . '/../..' . '/rules/Php56/Rector/FunctionLike/AddDefaultValueForUndefinedVariableRector.php',
|
||||
'Rector\\Php70\\Enum\\BattleshipCompareOrder' => __DIR__ . '/../..' . '/rules/Php70/Enum/BattleshipCompareOrder.php',
|
||||
'Rector\\Php70\\EregToPcreTransformer' => __DIR__ . '/../..' . '/rules/Php70/EregToPcreTransformer.php',
|
||||
'Rector\\Php70\\Exception\\InvalidEregException' => __DIR__ . '/../..' . '/rules/Php70/Exception/InvalidEregException.php',
|
||||
'Rector\\Php70\\NodeAnalyzer\\BattleshipTernaryAnalyzer' => __DIR__ . '/../..' . '/rules/Php70/NodeAnalyzer/BattleshipTernaryAnalyzer.php',
|
||||
'Rector\\Php70\\NodeAnalyzer\\Php4ConstructorClassMethodAnalyzer' => __DIR__ . '/../..' . '/rules/Php70/NodeAnalyzer/Php4ConstructorClassMethodAnalyzer.php',
|
||||
'Rector\\Php70\\Rector\\Assign\\ListSplitStringRector' => __DIR__ . '/../..' . '/rules/Php70/Rector/Assign/ListSplitStringRector.php',
|
||||
'Rector\\Php70\\Rector\\Assign\\ListSwapArrayOrderRector' => __DIR__ . '/../..' . '/rules/Php70/Rector/Assign/ListSwapArrayOrderRector.php',
|
||||
|
@ -2434,6 +2436,7 @@ class ComposerStaticInitbecc49e92c90914d9f48d7a2c7da99f5
|
|||
'Rector\\Php70\\Rector\\Ternary\\TernaryToNullCoalescingRector' => __DIR__ . '/../..' . '/rules/Php70/Rector/Ternary/TernaryToNullCoalescingRector.php',
|
||||
'Rector\\Php70\\Rector\\Ternary\\TernaryToSpaceshipRector' => __DIR__ . '/../..' . '/rules/Php70/Rector/Ternary/TernaryToSpaceshipRector.php',
|
||||
'Rector\\Php70\\Rector\\Variable\\WrapVariableVariableNameInCurlyBracesRector' => __DIR__ . '/../..' . '/rules/Php70/Rector/Variable/WrapVariableVariableNameInCurlyBracesRector.php',
|
||||
'Rector\\Php70\\ValueObject\\ComparedExprs' => __DIR__ . '/../..' . '/rules/Php70/ValueObject/ComparedExprs.php',
|
||||
'Rector\\Php71\\IsArrayAndDualCheckToAble' => __DIR__ . '/../..' . '/rules/Php71/IsArrayAndDualCheckToAble.php',
|
||||
'Rector\\Php71\\NodeAnalyzer\\CountableAnalyzer' => __DIR__ . '/../..' . '/rules/Php71/NodeAnalyzer/CountableAnalyzer.php',
|
||||
'Rector\\Php71\\Rector\\Assign\\AssignArrayToStringRector' => __DIR__ . '/../..' . '/rules/Php71/Rector/Assign/AssignArrayToStringRector.php',
|
||||
|
@ -3103,9 +3106,9 @@ class ComposerStaticInitbecc49e92c90914d9f48d7a2c7da99f5
|
|||
public static function getInitializer(ClassLoader $loader)
|
||||
{
|
||||
return \Closure::bind(function () use ($loader) {
|
||||
$loader->prefixLengthsPsr4 = ComposerStaticInitbecc49e92c90914d9f48d7a2c7da99f5::$prefixLengthsPsr4;
|
||||
$loader->prefixDirsPsr4 = ComposerStaticInitbecc49e92c90914d9f48d7a2c7da99f5::$prefixDirsPsr4;
|
||||
$loader->classMap = ComposerStaticInitbecc49e92c90914d9f48d7a2c7da99f5::$classMap;
|
||||
$loader->prefixLengthsPsr4 = ComposerStaticInit527c958222df83203b5281f72b24c52b::$prefixLengthsPsr4;
|
||||
$loader->prefixDirsPsr4 = ComposerStaticInit527c958222df83203b5281f72b24c52b::$prefixDirsPsr4;
|
||||
$loader->classMap = ComposerStaticInit527c958222df83203b5281f72b24c52b::$classMap;
|
||||
|
||||
}, null, ClassLoader::class);
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue