mirror of
https://github.com/rectorphp/rector.git
synced 2024-05-28 23:10:51 +00:00
Updated Rector to commit ce03029084e1d8c860de15ee6fcfef8f6f35dbdb
ce03029084
[DeadCode] Remove RemoveJustVariableAssignRector as often done on purpose or with side effect (#4450)
This commit is contained in:
parent
0c4f4be946
commit
2d4dfa7604
|
@ -42,7 +42,6 @@ use Rector\DeadCode\Rector\Return_\RemoveDeadConditionAboveReturnRector;
|
|||
use Rector\DeadCode\Rector\StaticCall\RemoveParentCallWithoutParentRector;
|
||||
use Rector\DeadCode\Rector\Stmt\RemoveUnreachableStatementRector;
|
||||
use Rector\DeadCode\Rector\StmtsAwareInterface\RemoveJustPropertyFetchForAssignRector;
|
||||
use Rector\DeadCode\Rector\StmtsAwareInterface\RemoveJustVariableAssignRector;
|
||||
use Rector\DeadCode\Rector\Switch_\RemoveDuplicatedCaseInSwitchRector;
|
||||
use Rector\DeadCode\Rector\Ternary\TernaryToBooleanOrFalseToBooleanAndRector;
|
||||
use Rector\DeadCode\Rector\TryCatch\RemoveDeadTryCatchRector;
|
||||
|
@ -89,7 +88,6 @@ return static function (RectorConfig $rectorConfig) : void {
|
|||
RemoveUselessVarTagRector::class,
|
||||
RemoveUnusedPromotedPropertyRector::class,
|
||||
RemoveJustPropertyFetchForAssignRector::class,
|
||||
RemoveJustVariableAssignRector::class,
|
||||
RemoveAlwaysTrueIfConditionRector::class,
|
||||
RemoveDeadZeroAndOneOperationRector::class,
|
||||
RemovePhpVersionIdCheckRector::class,
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
# 367 Rules Overview
|
||||
# 362 Rules Overview
|
||||
|
||||
<br>
|
||||
|
||||
|
@ -10,12 +10,10 @@
|
|||
|
||||
- [CodingStyle](#codingstyle) (31)
|
||||
|
||||
- [DeadCode](#deadcode) (43)
|
||||
- [DeadCode](#deadcode) (42)
|
||||
|
||||
- [EarlyReturn](#earlyreturn) (10)
|
||||
|
||||
- [MysqlToMysqli](#mysqltomysqli) (4)
|
||||
|
||||
- [Naming](#naming) (6)
|
||||
|
||||
- [Php52](#php52) (2)
|
||||
|
@ -2730,27 +2728,6 @@ Inline property fetch assign to a variable, that has no added value
|
|||
|
||||
<br>
|
||||
|
||||
### RemoveJustVariableAssignRector
|
||||
|
||||
Remove variable just to assign value or return value
|
||||
|
||||
- class: [`Rector\DeadCode\Rector\StmtsAwareInterface\RemoveJustVariableAssignRector`](../rules/DeadCode/Rector/StmtsAwareInterface/RemoveJustVariableAssignRector.php)
|
||||
|
||||
```diff
|
||||
final class SomeClass
|
||||
{
|
||||
public function run()
|
||||
{
|
||||
- $result = 100;
|
||||
-
|
||||
- $this->temporaryValue = $result;
|
||||
+ $this->temporaryValue = 100;
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||
<br>
|
||||
|
||||
### RemoveNonExistingVarAnnotationRector
|
||||
|
||||
Removes non-existing `@var` annotations above the code
|
||||
|
@ -3468,80 +3445,6 @@ Replace if conditioned variable override with direct return
|
|||
|
||||
<br>
|
||||
|
||||
## MysqlToMysqli
|
||||
|
||||
### MysqlAssignToMysqliRector
|
||||
|
||||
Converts more complex mysql functions to mysqli
|
||||
|
||||
- class: [`Rector\MysqlToMysqli\Rector\Assign\MysqlAssignToMysqliRector`](../rules/MysqlToMysqli/Rector/Assign/MysqlAssignToMysqliRector.php)
|
||||
|
||||
```diff
|
||||
-$data = mysql_db_name($result, $row);
|
||||
+mysqli_data_seek($result, $row);
|
||||
+$fetch = mysql_fetch_row($result);
|
||||
+$data = $fetch[0];
|
||||
```
|
||||
|
||||
<br>
|
||||
|
||||
### MysqlFuncCallToMysqliRector
|
||||
|
||||
Converts more complex mysql functions to mysqli
|
||||
|
||||
- class: [`Rector\MysqlToMysqli\Rector\FuncCall\MysqlFuncCallToMysqliRector`](../rules/MysqlToMysqli/Rector/FuncCall/MysqlFuncCallToMysqliRector.php)
|
||||
|
||||
```diff
|
||||
-mysql_drop_db($database);
|
||||
+mysqli_query('DROP DATABASE ' . $database);
|
||||
```
|
||||
|
||||
<br>
|
||||
|
||||
### MysqlPConnectToMysqliConnectRector
|
||||
|
||||
Replace `mysql_pconnect()` with `mysqli_connect()` with host p: prefix
|
||||
|
||||
- class: [`Rector\MysqlToMysqli\Rector\FuncCall\MysqlPConnectToMysqliConnectRector`](../rules/MysqlToMysqli/Rector/FuncCall/MysqlPConnectToMysqliConnectRector.php)
|
||||
|
||||
```diff
|
||||
final class SomeClass
|
||||
{
|
||||
public function run($host, $username, $password)
|
||||
{
|
||||
- return mysql_pconnect($host, $username, $password);
|
||||
+ return mysqli_connect('p:' . $host, $username, $password);
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||
<br>
|
||||
|
||||
### MysqlQueryMysqlErrorWithLinkRector
|
||||
|
||||
Add mysql_query and mysql_error with connection
|
||||
|
||||
- class: [`Rector\MysqlToMysqli\Rector\FuncCall\MysqlQueryMysqlErrorWithLinkRector`](../rules/MysqlToMysqli/Rector/FuncCall/MysqlQueryMysqlErrorWithLinkRector.php)
|
||||
|
||||
```diff
|
||||
class SomeClass
|
||||
{
|
||||
public function run()
|
||||
{
|
||||
$conn = mysqli_connect('host', 'user', 'pass');
|
||||
|
||||
- mysql_error();
|
||||
+ mysqli_error($conn);
|
||||
$sql = 'SELECT';
|
||||
|
||||
- return mysql_query($sql);
|
||||
+ return mysqli_query($conn, $sql);
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||
<br>
|
||||
|
||||
## Naming
|
||||
|
||||
### RenameForeachValueVariableToMatchExprVariableRector
|
||||
|
|
|
@ -1,32 +0,0 @@
|
|||
<?php
|
||||
|
||||
declare (strict_types=1);
|
||||
namespace Rector\DeadCode\NodeAnalyzer;
|
||||
|
||||
use PhpParser\Node;
|
||||
use PhpParser\Node\Expr\Variable;
|
||||
use Rector\Core\PhpParser\Node\BetterNodeFinder;
|
||||
final class ExprUsedInNextNodeAnalyzer
|
||||
{
|
||||
/**
|
||||
* @readonly
|
||||
* @var \Rector\Core\PhpParser\Node\BetterNodeFinder
|
||||
*/
|
||||
private $betterNodeFinder;
|
||||
/**
|
||||
* @readonly
|
||||
* @var \Rector\DeadCode\NodeAnalyzer\ExprUsedInNodeAnalyzer
|
||||
*/
|
||||
private $exprUsedInNodeAnalyzer;
|
||||
public function __construct(BetterNodeFinder $betterNodeFinder, \Rector\DeadCode\NodeAnalyzer\ExprUsedInNodeAnalyzer $exprUsedInNodeAnalyzer)
|
||||
{
|
||||
$this->betterNodeFinder = $betterNodeFinder;
|
||||
$this->exprUsedInNodeAnalyzer = $exprUsedInNodeAnalyzer;
|
||||
}
|
||||
public function isUsed(Variable $variable) : bool
|
||||
{
|
||||
return (bool) $this->betterNodeFinder->findFirstNext($variable, function (Node $node) use($variable) : bool {
|
||||
return $this->exprUsedInNodeAnalyzer->isUsed($node, $variable);
|
||||
});
|
||||
}
|
||||
}
|
|
@ -1,177 +0,0 @@
|
|||
<?php
|
||||
|
||||
declare (strict_types=1);
|
||||
namespace Rector\DeadCode\Rector\StmtsAwareInterface;
|
||||
|
||||
use PhpParser\Node;
|
||||
use PhpParser\Node\Expr\ArrayDimFetch;
|
||||
use PhpParser\Node\Expr\Assign;
|
||||
use PhpParser\Node\Expr\BinaryOp\Concat;
|
||||
use PhpParser\Node\Expr\Ternary;
|
||||
use PhpParser\Node\Expr\Variable;
|
||||
use PhpParser\Node\Stmt;
|
||||
use PhpParser\Node\Stmt\Expression;
|
||||
use PHPStan\PhpDocParser\Ast\PhpDoc\VarTagValueNode;
|
||||
use Rector\BetterPhpDocParser\Comment\CommentsMerger;
|
||||
use Rector\Core\Contract\PhpParser\Node\StmtsAwareInterface;
|
||||
use Rector\Core\NodeAnalyzer\VariableAnalyzer;
|
||||
use Rector\Core\Rector\AbstractRector;
|
||||
use Rector\DeadCode\NodeAnalyzer\ExprUsedInNextNodeAnalyzer;
|
||||
use Symplify\RuleDocGenerator\ValueObject\CodeSample\CodeSample;
|
||||
use Symplify\RuleDocGenerator\ValueObject\RuleDefinition;
|
||||
/**
|
||||
* @see \Rector\Tests\DeadCode\Rector\StmtsAwareInterface\RemoveJustVariableAssignRector\RemoveJustVariableAssignRectorTest
|
||||
*/
|
||||
final class RemoveJustVariableAssignRector extends AbstractRector
|
||||
{
|
||||
/**
|
||||
* @readonly
|
||||
* @var \Rector\Core\NodeAnalyzer\VariableAnalyzer
|
||||
*/
|
||||
private $variableAnalyzer;
|
||||
/**
|
||||
* @readonly
|
||||
* @var \Rector\DeadCode\NodeAnalyzer\ExprUsedInNextNodeAnalyzer
|
||||
*/
|
||||
private $exprUsedInNextNodeAnalyzer;
|
||||
/**
|
||||
* @readonly
|
||||
* @var \Rector\BetterPhpDocParser\Comment\CommentsMerger
|
||||
*/
|
||||
private $commentsMerger;
|
||||
public function __construct(VariableAnalyzer $variableAnalyzer, ExprUsedInNextNodeAnalyzer $exprUsedInNextNodeAnalyzer, CommentsMerger $commentsMerger)
|
||||
{
|
||||
$this->variableAnalyzer = $variableAnalyzer;
|
||||
$this->exprUsedInNextNodeAnalyzer = $exprUsedInNextNodeAnalyzer;
|
||||
$this->commentsMerger = $commentsMerger;
|
||||
}
|
||||
public function getRuleDefinition() : RuleDefinition
|
||||
{
|
||||
return new RuleDefinition('Remove variable just to assign value or return value', [new CodeSample(<<<'CODE_SAMPLE'
|
||||
final class SomeClass
|
||||
{
|
||||
public function run()
|
||||
{
|
||||
$result = 100;
|
||||
|
||||
$this->temporaryValue = $result;
|
||||
}
|
||||
}
|
||||
CODE_SAMPLE
|
||||
, <<<'CODE_SAMPLE'
|
||||
final class SomeClass
|
||||
{
|
||||
public function run()
|
||||
{
|
||||
$this->temporaryValue = 100;
|
||||
}
|
||||
}
|
||||
CODE_SAMPLE
|
||||
)]);
|
||||
}
|
||||
/**
|
||||
* @return array<class-string<Node>>
|
||||
*/
|
||||
public function getNodeTypes() : array
|
||||
{
|
||||
return [StmtsAwareInterface::class];
|
||||
}
|
||||
/**
|
||||
* @param StmtsAwareInterface $node
|
||||
*/
|
||||
public function refactor(Node $node) : ?Node
|
||||
{
|
||||
$stmts = (array) $node->stmts;
|
||||
if ($stmts === []) {
|
||||
return null;
|
||||
}
|
||||
$originalStmts = $stmts;
|
||||
foreach ($stmts as $key => $stmt) {
|
||||
$nextStmt = $stmts[$key + 1] ?? null;
|
||||
if (!$nextStmt instanceof Stmt) {
|
||||
continue;
|
||||
}
|
||||
$currentAssign = $this->matchExpressionAssign($stmt);
|
||||
if (!$currentAssign instanceof Assign) {
|
||||
continue;
|
||||
}
|
||||
$phpDocInfo = $this->phpDocInfoFactory->createFromNodeOrEmpty($stmt);
|
||||
if ($phpDocInfo->getVarTagValueNode() instanceof VarTagValueNode) {
|
||||
continue;
|
||||
}
|
||||
$nextAssign = $this->matchExpressionAssign($nextStmt);
|
||||
if (!$nextAssign instanceof Assign) {
|
||||
continue;
|
||||
}
|
||||
if ($this->areTooComplexAssignsToShorten($currentAssign, $nextAssign)) {
|
||||
continue;
|
||||
}
|
||||
if (!$this->areTwoVariablesCrossAssign($currentAssign, $nextAssign)) {
|
||||
continue;
|
||||
}
|
||||
// ...
|
||||
$currentAssign->var = $nextAssign->var;
|
||||
$this->commentsMerger->keepComments($stmt, [$stmts[$key + 1]]);
|
||||
unset($stmts[$key + 1]);
|
||||
}
|
||||
if ($originalStmts === $stmts) {
|
||||
return null;
|
||||
}
|
||||
$node->stmts = $stmts;
|
||||
return $node;
|
||||
}
|
||||
/**
|
||||
* This detects if two variables are cross assigned:
|
||||
*
|
||||
* $<some> = 1000;
|
||||
* $this->value = $<some>;
|
||||
*
|
||||
* + not used $<some> below, so removal will not break it
|
||||
*/
|
||||
private function areTwoVariablesCrossAssign(Assign $currentAssign, Assign $nextAssign) : bool
|
||||
{
|
||||
// is just re-assign to variable
|
||||
if (!$currentAssign->var instanceof Variable) {
|
||||
return \false;
|
||||
}
|
||||
if (!$nextAssign->expr instanceof Variable) {
|
||||
return \false;
|
||||
}
|
||||
if (!$this->nodeComparator->areNodesEqual($currentAssign->var, $nextAssign->expr)) {
|
||||
return \false;
|
||||
}
|
||||
if ($this->variableAnalyzer->isUsedByReference($currentAssign->var)) {
|
||||
return \false;
|
||||
}
|
||||
if ($this->variableAnalyzer->isUsedByReference($nextAssign->expr)) {
|
||||
return \false;
|
||||
}
|
||||
if ($this->variableAnalyzer->isStaticOrGlobal($currentAssign->var)) {
|
||||
return \false;
|
||||
}
|
||||
return !$this->exprUsedInNextNodeAnalyzer->isUsed($nextAssign->expr);
|
||||
}
|
||||
/**
|
||||
* Shortening should not make code less readable.
|
||||
*/
|
||||
private function areTooComplexAssignsToShorten(Assign $currentAssign, Assign $nextAssign) : bool
|
||||
{
|
||||
if ($currentAssign->expr instanceof Ternary) {
|
||||
return \true;
|
||||
}
|
||||
if ($currentAssign->expr instanceof Concat) {
|
||||
return \true;
|
||||
}
|
||||
return $nextAssign->var instanceof ArrayDimFetch;
|
||||
}
|
||||
private function matchExpressionAssign(Stmt $stmt) : ?Assign
|
||||
{
|
||||
if (!$stmt instanceof Expression) {
|
||||
return null;
|
||||
}
|
||||
if (!$stmt->expr instanceof Assign) {
|
||||
return null;
|
||||
}
|
||||
return $stmt->expr;
|
||||
}
|
||||
}
|
|
@ -19,12 +19,12 @@ final class VersionResolver
|
|||
* @api
|
||||
* @var string
|
||||
*/
|
||||
public const PACKAGE_VERSION = '33019ba2ff8abfa658b998db5a7ca88f2fa87da3';
|
||||
public const PACKAGE_VERSION = 'ce03029084e1d8c860de15ee6fcfef8f6f35dbdb';
|
||||
/**
|
||||
* @api
|
||||
* @var string
|
||||
*/
|
||||
public const RELEASE_DATE = '2023-07-09 09:41:01';
|
||||
public const RELEASE_DATE = '2023-07-09 10:31:17';
|
||||
/**
|
||||
* @var int
|
||||
*/
|
||||
|
|
2
vendor/autoload.php
vendored
2
vendor/autoload.php
vendored
|
@ -22,4 +22,4 @@ if (PHP_VERSION_ID < 50600) {
|
|||
|
||||
require_once __DIR__ . '/composer/autoload_real.php';
|
||||
|
||||
return ComposerAutoloaderInitf8e9ccc0f12c774a04430ed940bbf147::getLoader();
|
||||
return ComposerAutoloaderInitedfb2f18c84b12f92d11c1ea4357e517::getLoader();
|
||||
|
|
2
vendor/composer/autoload_classmap.php
vendored
2
vendor/composer/autoload_classmap.php
vendored
|
@ -1668,7 +1668,6 @@ return array(
|
|||
'Rector\\DeadCode\\ConditionResolver' => $baseDir . '/rules/DeadCode/ConditionResolver.php',
|
||||
'Rector\\DeadCode\\Contract\\ConditionInterface' => $baseDir . '/rules/DeadCode/Contract/ConditionInterface.php',
|
||||
'Rector\\DeadCode\\NodeAnalyzer\\CallCollectionAnalyzer' => $baseDir . '/rules/DeadCode/NodeAnalyzer/CallCollectionAnalyzer.php',
|
||||
'Rector\\DeadCode\\NodeAnalyzer\\ExprUsedInNextNodeAnalyzer' => $baseDir . '/rules/DeadCode/NodeAnalyzer/ExprUsedInNextNodeAnalyzer.php',
|
||||
'Rector\\DeadCode\\NodeAnalyzer\\ExprUsedInNodeAnalyzer' => $baseDir . '/rules/DeadCode/NodeAnalyzer/ExprUsedInNodeAnalyzer.php',
|
||||
'Rector\\DeadCode\\NodeAnalyzer\\IsClassMethodUsedAnalyzer' => $baseDir . '/rules/DeadCode/NodeAnalyzer/IsClassMethodUsedAnalyzer.php',
|
||||
'Rector\\DeadCode\\NodeAnalyzer\\JustPropertyFetchVariableAssignMatcher' => $baseDir . '/rules/DeadCode/NodeAnalyzer/JustPropertyFetchVariableAssignMatcher.php',
|
||||
|
@ -1725,7 +1724,6 @@ return array(
|
|||
'Rector\\DeadCode\\Rector\\Stmt\\RemoveUnreachableStatementRector' => $baseDir . '/rules/DeadCode/Rector/Stmt/RemoveUnreachableStatementRector.php',
|
||||
'Rector\\DeadCode\\Rector\\StmtsAwareInterface\\RemoveJustPropertyFetchForAssignRector' => $baseDir . '/rules/DeadCode/Rector/StmtsAwareInterface/RemoveJustPropertyFetchForAssignRector.php',
|
||||
'Rector\\DeadCode\\Rector\\StmtsAwareInterface\\RemoveJustPropertyFetchRector' => $baseDir . '/rules/DeadCode/Rector/StmtsAwareInterface/RemoveJustPropertyFetchRector.php',
|
||||
'Rector\\DeadCode\\Rector\\StmtsAwareInterface\\RemoveJustVariableAssignRector' => $baseDir . '/rules/DeadCode/Rector/StmtsAwareInterface/RemoveJustVariableAssignRector.php',
|
||||
'Rector\\DeadCode\\Rector\\Switch_\\RemoveDuplicatedCaseInSwitchRector' => $baseDir . '/rules/DeadCode/Rector/Switch_/RemoveDuplicatedCaseInSwitchRector.php',
|
||||
'Rector\\DeadCode\\Rector\\Ternary\\TernaryToBooleanOrFalseToBooleanAndRector' => $baseDir . '/rules/DeadCode/Rector/Ternary/TernaryToBooleanOrFalseToBooleanAndRector.php',
|
||||
'Rector\\DeadCode\\Rector\\TryCatch\\RemoveDeadTryCatchRector' => $baseDir . '/rules/DeadCode/Rector/TryCatch/RemoveDeadTryCatchRector.php',
|
||||
|
|
10
vendor/composer/autoload_real.php
vendored
10
vendor/composer/autoload_real.php
vendored
|
@ -2,7 +2,7 @@
|
|||
|
||||
// autoload_real.php @generated by Composer
|
||||
|
||||
class ComposerAutoloaderInitf8e9ccc0f12c774a04430ed940bbf147
|
||||
class ComposerAutoloaderInitedfb2f18c84b12f92d11c1ea4357e517
|
||||
{
|
||||
private static $loader;
|
||||
|
||||
|
@ -22,17 +22,17 @@ class ComposerAutoloaderInitf8e9ccc0f12c774a04430ed940bbf147
|
|||
return self::$loader;
|
||||
}
|
||||
|
||||
spl_autoload_register(array('ComposerAutoloaderInitf8e9ccc0f12c774a04430ed940bbf147', 'loadClassLoader'), true, true);
|
||||
spl_autoload_register(array('ComposerAutoloaderInitedfb2f18c84b12f92d11c1ea4357e517', 'loadClassLoader'), true, true);
|
||||
self::$loader = $loader = new \Composer\Autoload\ClassLoader(\dirname(__DIR__));
|
||||
spl_autoload_unregister(array('ComposerAutoloaderInitf8e9ccc0f12c774a04430ed940bbf147', 'loadClassLoader'));
|
||||
spl_autoload_unregister(array('ComposerAutoloaderInitedfb2f18c84b12f92d11c1ea4357e517', 'loadClassLoader'));
|
||||
|
||||
require __DIR__ . '/autoload_static.php';
|
||||
call_user_func(\Composer\Autoload\ComposerStaticInitf8e9ccc0f12c774a04430ed940bbf147::getInitializer($loader));
|
||||
call_user_func(\Composer\Autoload\ComposerStaticInitedfb2f18c84b12f92d11c1ea4357e517::getInitializer($loader));
|
||||
|
||||
$loader->setClassMapAuthoritative(true);
|
||||
$loader->register(true);
|
||||
|
||||
$filesToLoad = \Composer\Autoload\ComposerStaticInitf8e9ccc0f12c774a04430ed940bbf147::$files;
|
||||
$filesToLoad = \Composer\Autoload\ComposerStaticInitedfb2f18c84b12f92d11c1ea4357e517::$files;
|
||||
$requireFile = \Closure::bind(static function ($fileIdentifier, $file) {
|
||||
if (empty($GLOBALS['__composer_autoload_files'][$fileIdentifier])) {
|
||||
$GLOBALS['__composer_autoload_files'][$fileIdentifier] = true;
|
||||
|
|
10
vendor/composer/autoload_static.php
vendored
10
vendor/composer/autoload_static.php
vendored
|
@ -4,7 +4,7 @@
|
|||
|
||||
namespace Composer\Autoload;
|
||||
|
||||
class ComposerStaticInitf8e9ccc0f12c774a04430ed940bbf147
|
||||
class ComposerStaticInitedfb2f18c84b12f92d11c1ea4357e517
|
||||
{
|
||||
public static $files = array (
|
||||
'ad155f8f1cf0d418fe49e248db8c661b' => __DIR__ . '/..' . '/react/promise/src/functions_include.php',
|
||||
|
@ -1920,7 +1920,6 @@ class ComposerStaticInitf8e9ccc0f12c774a04430ed940bbf147
|
|||
'Rector\\DeadCode\\ConditionResolver' => __DIR__ . '/../..' . '/rules/DeadCode/ConditionResolver.php',
|
||||
'Rector\\DeadCode\\Contract\\ConditionInterface' => __DIR__ . '/../..' . '/rules/DeadCode/Contract/ConditionInterface.php',
|
||||
'Rector\\DeadCode\\NodeAnalyzer\\CallCollectionAnalyzer' => __DIR__ . '/../..' . '/rules/DeadCode/NodeAnalyzer/CallCollectionAnalyzer.php',
|
||||
'Rector\\DeadCode\\NodeAnalyzer\\ExprUsedInNextNodeAnalyzer' => __DIR__ . '/../..' . '/rules/DeadCode/NodeAnalyzer/ExprUsedInNextNodeAnalyzer.php',
|
||||
'Rector\\DeadCode\\NodeAnalyzer\\ExprUsedInNodeAnalyzer' => __DIR__ . '/../..' . '/rules/DeadCode/NodeAnalyzer/ExprUsedInNodeAnalyzer.php',
|
||||
'Rector\\DeadCode\\NodeAnalyzer\\IsClassMethodUsedAnalyzer' => __DIR__ . '/../..' . '/rules/DeadCode/NodeAnalyzer/IsClassMethodUsedAnalyzer.php',
|
||||
'Rector\\DeadCode\\NodeAnalyzer\\JustPropertyFetchVariableAssignMatcher' => __DIR__ . '/../..' . '/rules/DeadCode/NodeAnalyzer/JustPropertyFetchVariableAssignMatcher.php',
|
||||
|
@ -1977,7 +1976,6 @@ class ComposerStaticInitf8e9ccc0f12c774a04430ed940bbf147
|
|||
'Rector\\DeadCode\\Rector\\Stmt\\RemoveUnreachableStatementRector' => __DIR__ . '/../..' . '/rules/DeadCode/Rector/Stmt/RemoveUnreachableStatementRector.php',
|
||||
'Rector\\DeadCode\\Rector\\StmtsAwareInterface\\RemoveJustPropertyFetchForAssignRector' => __DIR__ . '/../..' . '/rules/DeadCode/Rector/StmtsAwareInterface/RemoveJustPropertyFetchForAssignRector.php',
|
||||
'Rector\\DeadCode\\Rector\\StmtsAwareInterface\\RemoveJustPropertyFetchRector' => __DIR__ . '/../..' . '/rules/DeadCode/Rector/StmtsAwareInterface/RemoveJustPropertyFetchRector.php',
|
||||
'Rector\\DeadCode\\Rector\\StmtsAwareInterface\\RemoveJustVariableAssignRector' => __DIR__ . '/../..' . '/rules/DeadCode/Rector/StmtsAwareInterface/RemoveJustVariableAssignRector.php',
|
||||
'Rector\\DeadCode\\Rector\\Switch_\\RemoveDuplicatedCaseInSwitchRector' => __DIR__ . '/../..' . '/rules/DeadCode/Rector/Switch_/RemoveDuplicatedCaseInSwitchRector.php',
|
||||
'Rector\\DeadCode\\Rector\\Ternary\\TernaryToBooleanOrFalseToBooleanAndRector' => __DIR__ . '/../..' . '/rules/DeadCode/Rector/Ternary/TernaryToBooleanOrFalseToBooleanAndRector.php',
|
||||
'Rector\\DeadCode\\Rector\\TryCatch\\RemoveDeadTryCatchRector' => __DIR__ . '/../..' . '/rules/DeadCode/Rector/TryCatch/RemoveDeadTryCatchRector.php',
|
||||
|
@ -3072,9 +3070,9 @@ class ComposerStaticInitf8e9ccc0f12c774a04430ed940bbf147
|
|||
public static function getInitializer(ClassLoader $loader)
|
||||
{
|
||||
return \Closure::bind(function () use ($loader) {
|
||||
$loader->prefixLengthsPsr4 = ComposerStaticInitf8e9ccc0f12c774a04430ed940bbf147::$prefixLengthsPsr4;
|
||||
$loader->prefixDirsPsr4 = ComposerStaticInitf8e9ccc0f12c774a04430ed940bbf147::$prefixDirsPsr4;
|
||||
$loader->classMap = ComposerStaticInitf8e9ccc0f12c774a04430ed940bbf147::$classMap;
|
||||
$loader->prefixLengthsPsr4 = ComposerStaticInitedfb2f18c84b12f92d11c1ea4357e517::$prefixLengthsPsr4;
|
||||
$loader->prefixDirsPsr4 = ComposerStaticInitedfb2f18c84b12f92d11c1ea4357e517::$prefixDirsPsr4;
|
||||
$loader->classMap = ComposerStaticInitedfb2f18c84b12f92d11c1ea4357e517::$classMap;
|
||||
|
||||
}, null, ClassLoader::class);
|
||||
}
|
||||
|
|
8
vendor/composer/installed.json
vendored
8
vendor/composer/installed.json
vendored
|
@ -1982,12 +1982,12 @@
|
|||
"source": {
|
||||
"type": "git",
|
||||
"url": "https:\/\/github.com\/rectorphp\/rector-downgrade-php.git",
|
||||
"reference": "be7752f22944ac99aab48b91cf8e86734ffce572"
|
||||
"reference": "9e5a36d271b6cec5f89ec413378dd80d9d1b9e00"
|
||||
},
|
||||
"dist": {
|
||||
"type": "zip",
|
||||
"url": "https:\/\/api.github.com\/repos\/rectorphp\/rector-downgrade-php\/zipball\/be7752f22944ac99aab48b91cf8e86734ffce572",
|
||||
"reference": "be7752f22944ac99aab48b91cf8e86734ffce572",
|
||||
"url": "https:\/\/api.github.com\/repos\/rectorphp\/rector-downgrade-php\/zipball\/9e5a36d271b6cec5f89ec413378dd80d9d1b9e00",
|
||||
"reference": "9e5a36d271b6cec5f89ec413378dd80d9d1b9e00",
|
||||
"shasum": ""
|
||||
},
|
||||
"require": {
|
||||
|
@ -2011,7 +2011,7 @@
|
|||
"tomasvotruba\/type-coverage": "^0.2",
|
||||
"tomasvotruba\/unused-public": "^0.1"
|
||||
},
|
||||
"time": "2023-07-09T09:34:19+00:00",
|
||||
"time": "2023-07-09T10:06:07+00:00",
|
||||
"default-branch": true,
|
||||
"type": "rector-extension",
|
||||
"extra": {
|
||||
|
|
2
vendor/composer/installed.php
vendored
2
vendor/composer/installed.php
vendored
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-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 8afdccb'), '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 be7752f'), '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 c6bf48b'), '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 e788554'));
|
||||
public const EXTENSIONS = array('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 8afdccb'), '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 9e5a36d'), '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 c6bf48b'), '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 e788554'));
|
||||
private function __construct()
|
||||
{
|
||||
}
|
||||
|
|
|
@ -208,7 +208,6 @@ CODE_SAMPLE
|
|||
{
|
||||
$switchCases = [];
|
||||
$isInsideArrayItem = (bool) $match->getAttribute(AttributeKey::INSIDE_ARRAY_ITEM);
|
||||
// $parentNode = $match->getAttribute(AttributeKey::PARENT_NODE);
|
||||
foreach ($match->arms as $matchArm) {
|
||||
if (\count((array) $matchArm->conds) > 1) {
|
||||
$lastCase = null;
|
||||
|
|
Loading…
Reference in New Issue
Block a user