mirror of
https://github.com/rectorphp/rector.git
synced 2025-04-15 21:12:34 +02:00
Updated Rector to commit 14d5c18788067f9f75fe234071814aabf42c41b1
14d5c18788
Fix just assigned variable in InlineArrayReturnAssignRector (#4363)
This commit is contained in:
parent
ff810186aa
commit
d90547ba8c
@ -5,6 +5,7 @@ namespace Rector\CodeQuality\Rector\ClassMethod;
|
||||
|
||||
use PhpParser\Node;
|
||||
use PhpParser\Node\Expr\Array_;
|
||||
use PhpParser\Node\Expr\ArrayDimFetch;
|
||||
use PhpParser\Node\Expr\ArrayItem;
|
||||
use PhpParser\Node\Expr\Assign;
|
||||
use PhpParser\Node\Expr\Variable;
|
||||
@ -76,6 +77,9 @@ CODE_SAMPLE
|
||||
if (!$variable instanceof Variable) {
|
||||
return null;
|
||||
}
|
||||
if (!$this->areAssignExclusiveToDimFetch($stmts)) {
|
||||
return null;
|
||||
}
|
||||
$lastStmt = \array_pop($stmts);
|
||||
if (!$lastStmt instanceof Stmt) {
|
||||
return null;
|
||||
@ -131,4 +135,32 @@ CODE_SAMPLE
|
||||
}
|
||||
return new Array_($arrayItems);
|
||||
}
|
||||
/**
|
||||
* Only:
|
||||
* $items['...'] = $result;
|
||||
*
|
||||
* @param Stmt[] $stmts
|
||||
*/
|
||||
private function areAssignExclusiveToDimFetch(array $stmts) : bool
|
||||
{
|
||||
\end($stmts);
|
||||
$lastKey = \key($stmts);
|
||||
foreach ($stmts as $key => $stmt) {
|
||||
if ($key === $lastKey) {
|
||||
// skip last item
|
||||
continue;
|
||||
}
|
||||
if (!$stmt instanceof Expression) {
|
||||
return \false;
|
||||
}
|
||||
if (!$stmt->expr instanceof Assign) {
|
||||
return \false;
|
||||
}
|
||||
$assign = $stmt->expr;
|
||||
if (!$assign->var instanceof ArrayDimFetch) {
|
||||
return \false;
|
||||
}
|
||||
}
|
||||
return \true;
|
||||
}
|
||||
}
|
||||
|
@ -3,17 +3,17 @@
|
||||
declare (strict_types=1);
|
||||
namespace Rector\Php82\Rector\Param;
|
||||
|
||||
use PhpParser\Node\Param;
|
||||
use PhpParser\Node\AttributeGroup;
|
||||
use PhpParser\Node\Attribute;
|
||||
use PhpParser\Node\Name\FullyQualified;
|
||||
use Symplify\RuleDocGenerator\ValueObject\CodeSample\ConfiguredCodeSample;
|
||||
use PhpParser\Node;
|
||||
use PhpParser\Node\Attribute;
|
||||
use PhpParser\Node\AttributeGroup;
|
||||
use PhpParser\Node\Name\FullyQualified;
|
||||
use PhpParser\Node\Param;
|
||||
use Rector\Core\Contract\Rector\ConfigurableRectorInterface;
|
||||
use Rector\Core\Rector\AbstractRector;
|
||||
use Rector\Core\ValueObject\PhpVersionFeature;
|
||||
use Rector\Php80\NodeAnalyzer\PhpAttributeAnalyzer;
|
||||
use Rector\VersionBonding\Contract\MinPhpVersionInterface;
|
||||
use Symplify\RuleDocGenerator\ValueObject\CodeSample\ConfiguredCodeSample;
|
||||
use Symplify\RuleDocGenerator\ValueObject\RuleDefinition;
|
||||
use RectorPrefix202306\Webmozart\Assert\Assert;
|
||||
/**
|
||||
|
@ -19,12 +19,12 @@ final class VersionResolver
|
||||
* @api
|
||||
* @var string
|
||||
*/
|
||||
public const PACKAGE_VERSION = 'a653146486eea313a569bd84a19e6ebaec7015d9';
|
||||
public const PACKAGE_VERSION = '14d5c18788067f9f75fe234071814aabf42c41b1';
|
||||
/**
|
||||
* @api
|
||||
* @var string
|
||||
*/
|
||||
public const RELEASE_DATE = '2023-06-27 11:00:04';
|
||||
public const RELEASE_DATE = '2023-06-27 11:02:34';
|
||||
/**
|
||||
* @var int
|
||||
*/
|
||||
|
@ -113,7 +113,7 @@ final class ProcessCommand extends \Rector\Core\Console\Command\AbstractProcessC
|
||||
// 1. add files and directories to static locator
|
||||
$this->dynamicSourceLocatorDecorator->addPaths($paths);
|
||||
if ($this->dynamicSourceLocatorDecorator->isPathsEmpty()) {
|
||||
$this->rectorOutputStyle->error("The given paths do not match any files");
|
||||
$this->rectorOutputStyle->error('The given paths do not match any files');
|
||||
return ExitCode::FAILURE;
|
||||
}
|
||||
// 2. inform user about registering configurable rule without configuration
|
||||
|
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 ComposerAutoloaderInitbfb7ecf9710a4af1b98d0446d332a80b::getLoader();
|
||||
return ComposerAutoloaderInit07d80b11ff860eb44e353927e48a7f8e::getLoader();
|
||||
|
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 ComposerAutoloaderInitbfb7ecf9710a4af1b98d0446d332a80b
|
||||
class ComposerAutoloaderInit07d80b11ff860eb44e353927e48a7f8e
|
||||
{
|
||||
private static $loader;
|
||||
|
||||
@ -22,17 +22,17 @@ class ComposerAutoloaderInitbfb7ecf9710a4af1b98d0446d332a80b
|
||||
return self::$loader;
|
||||
}
|
||||
|
||||
spl_autoload_register(array('ComposerAutoloaderInitbfb7ecf9710a4af1b98d0446d332a80b', 'loadClassLoader'), true, true);
|
||||
spl_autoload_register(array('ComposerAutoloaderInit07d80b11ff860eb44e353927e48a7f8e', 'loadClassLoader'), true, true);
|
||||
self::$loader = $loader = new \Composer\Autoload\ClassLoader(\dirname(__DIR__));
|
||||
spl_autoload_unregister(array('ComposerAutoloaderInitbfb7ecf9710a4af1b98d0446d332a80b', 'loadClassLoader'));
|
||||
spl_autoload_unregister(array('ComposerAutoloaderInit07d80b11ff860eb44e353927e48a7f8e', 'loadClassLoader'));
|
||||
|
||||
require __DIR__ . '/autoload_static.php';
|
||||
call_user_func(\Composer\Autoload\ComposerStaticInitbfb7ecf9710a4af1b98d0446d332a80b::getInitializer($loader));
|
||||
call_user_func(\Composer\Autoload\ComposerStaticInit07d80b11ff860eb44e353927e48a7f8e::getInitializer($loader));
|
||||
|
||||
$loader->setClassMapAuthoritative(true);
|
||||
$loader->register(true);
|
||||
|
||||
$filesToLoad = \Composer\Autoload\ComposerStaticInitbfb7ecf9710a4af1b98d0446d332a80b::$files;
|
||||
$filesToLoad = \Composer\Autoload\ComposerStaticInit07d80b11ff860eb44e353927e48a7f8e::$files;
|
||||
$requireFile = \Closure::bind(static function ($fileIdentifier, $file) {
|
||||
if (empty($GLOBALS['__composer_autoload_files'][$fileIdentifier])) {
|
||||
$GLOBALS['__composer_autoload_files'][$fileIdentifier] = true;
|
||||
|
8
vendor/composer/autoload_static.php
vendored
8
vendor/composer/autoload_static.php
vendored
@ -4,7 +4,7 @@
|
||||
|
||||
namespace Composer\Autoload;
|
||||
|
||||
class ComposerStaticInitbfb7ecf9710a4af1b98d0446d332a80b
|
||||
class ComposerStaticInit07d80b11ff860eb44e353927e48a7f8e
|
||||
{
|
||||
public static $files = array (
|
||||
'ad155f8f1cf0d418fe49e248db8c661b' => __DIR__ . '/..' . '/react/promise/src/functions_include.php',
|
||||
@ -3098,9 +3098,9 @@ class ComposerStaticInitbfb7ecf9710a4af1b98d0446d332a80b
|
||||
public static function getInitializer(ClassLoader $loader)
|
||||
{
|
||||
return \Closure::bind(function () use ($loader) {
|
||||
$loader->prefixLengthsPsr4 = ComposerStaticInitbfb7ecf9710a4af1b98d0446d332a80b::$prefixLengthsPsr4;
|
||||
$loader->prefixDirsPsr4 = ComposerStaticInitbfb7ecf9710a4af1b98d0446d332a80b::$prefixDirsPsr4;
|
||||
$loader->classMap = ComposerStaticInitbfb7ecf9710a4af1b98d0446d332a80b::$classMap;
|
||||
$loader->prefixLengthsPsr4 = ComposerStaticInit07d80b11ff860eb44e353927e48a7f8e::$prefixLengthsPsr4;
|
||||
$loader->prefixDirsPsr4 = ComposerStaticInit07d80b11ff860eb44e353927e48a7f8e::$prefixDirsPsr4;
|
||||
$loader->classMap = ComposerStaticInit07d80b11ff860eb44e353927e48a7f8e::$classMap;
|
||||
|
||||
}, null, ClassLoader::class);
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user