mirror of https://github.com/rectorphp/rector.git
Updated Rector to commit a771c5621971eb1c527c75de17119a82ac8294e6
a771c56219
[DX] Remove autowrapping of expr/stmt to make return values in the same type and reliable (#4466)
This commit is contained in:
parent
11aabec02c
commit
9bef88551a
|
@ -90,7 +90,11 @@ CODE_SAMPLE
|
|||
if (!$node->expr instanceof FuncCall) {
|
||||
return null;
|
||||
}
|
||||
return $this->refactorFuncCall($node->expr, \true);
|
||||
$assignOrCast = $this->refactorFuncCall($node->expr, \true);
|
||||
if (!$assignOrCast instanceof Expr) {
|
||||
return null;
|
||||
}
|
||||
return new Expression($assignOrCast);
|
||||
}
|
||||
return $this->refactorFuncCall($node, \false);
|
||||
}
|
||||
|
|
|
@ -74,7 +74,8 @@ CODE_SAMPLE
|
|||
// only key: list($key, ) = each($values);
|
||||
if ($listNode->items[0] instanceof ArrayItem && !$listNode->items[1] instanceof ArrayItem) {
|
||||
$keyFuncCall = $this->nodeFactory->createFuncCall('key', $eachFuncCall->args);
|
||||
return new Assign($listNode->items[0]->value, $keyFuncCall);
|
||||
$keyFuncCallAssign = new Assign($listNode->items[0]->value, $keyFuncCall);
|
||||
return new Expression($keyFuncCallAssign);
|
||||
}
|
||||
// only value: list(, $value) = each($values);
|
||||
if ($listNode->items[1] instanceof ArrayItem && !$listNode->items[0] instanceof ArrayItem) {
|
||||
|
|
|
@ -19,12 +19,12 @@ final class VersionResolver
|
|||
* @api
|
||||
* @var string
|
||||
*/
|
||||
public const PACKAGE_VERSION = '5c85bb6c455815d93d2026b430983ab28fb8d46e';
|
||||
public const PACKAGE_VERSION = 'a771c5621971eb1c527c75de17119a82ac8294e6';
|
||||
/**
|
||||
* @api
|
||||
* @var string
|
||||
*/
|
||||
public const RELEASE_DATE = '2023-07-09 14:51:25';
|
||||
public const RELEASE_DATE = '2023-07-09 17:26:22';
|
||||
/**
|
||||
* @var int
|
||||
*/
|
||||
|
|
|
@ -5,9 +5,6 @@ namespace Rector\Core\Rector;
|
|||
|
||||
use PhpParser\Node;
|
||||
use PhpParser\Node\Arg;
|
||||
use PhpParser\Node\Expr;
|
||||
use PhpParser\Node\Stmt;
|
||||
use PhpParser\Node\Stmt\Expression;
|
||||
use PhpParser\Node\Stmt\InlineHTML;
|
||||
use PhpParser\Node\Stmt\Nop;
|
||||
use PhpParser\NodeTraverser;
|
||||
|
@ -326,7 +323,6 @@ CODE_SAMPLE;
|
|||
// will be replaced in leaveNode() the original node must be passed
|
||||
return $originalNode;
|
||||
}
|
||||
$refactoredNode = $originalNode instanceof Stmt && $refactoredNode instanceof Expr ? new Expression($refactoredNode) : $refactoredNode;
|
||||
$this->updateParentNodes($refactoredNode, $parentNode);
|
||||
$this->refreshScopeNodes($refactoredNode, $filePath, $currentScope);
|
||||
$this->nodesToReturn[$originalNodeHash] = $refactoredNode;
|
||||
|
|
|
@ -22,4 +22,4 @@ if (PHP_VERSION_ID < 50600) {
|
|||
|
||||
require_once __DIR__ . '/composer/autoload_real.php';
|
||||
|
||||
return ComposerAutoloaderInit45f3f12c06bda031b2e5ddfd3167038d::getLoader();
|
||||
return ComposerAutoloaderInitd87870bba647133abcf187f88c151efc::getLoader();
|
||||
|
|
|
@ -2,7 +2,7 @@
|
|||
|
||||
// autoload_real.php @generated by Composer
|
||||
|
||||
class ComposerAutoloaderInit45f3f12c06bda031b2e5ddfd3167038d
|
||||
class ComposerAutoloaderInitd87870bba647133abcf187f88c151efc
|
||||
{
|
||||
private static $loader;
|
||||
|
||||
|
@ -22,17 +22,17 @@ class ComposerAutoloaderInit45f3f12c06bda031b2e5ddfd3167038d
|
|||
return self::$loader;
|
||||
}
|
||||
|
||||
spl_autoload_register(array('ComposerAutoloaderInit45f3f12c06bda031b2e5ddfd3167038d', 'loadClassLoader'), true, true);
|
||||
spl_autoload_register(array('ComposerAutoloaderInitd87870bba647133abcf187f88c151efc', 'loadClassLoader'), true, true);
|
||||
self::$loader = $loader = new \Composer\Autoload\ClassLoader(\dirname(__DIR__));
|
||||
spl_autoload_unregister(array('ComposerAutoloaderInit45f3f12c06bda031b2e5ddfd3167038d', 'loadClassLoader'));
|
||||
spl_autoload_unregister(array('ComposerAutoloaderInitd87870bba647133abcf187f88c151efc', 'loadClassLoader'));
|
||||
|
||||
require __DIR__ . '/autoload_static.php';
|
||||
call_user_func(\Composer\Autoload\ComposerStaticInit45f3f12c06bda031b2e5ddfd3167038d::getInitializer($loader));
|
||||
call_user_func(\Composer\Autoload\ComposerStaticInitd87870bba647133abcf187f88c151efc::getInitializer($loader));
|
||||
|
||||
$loader->setClassMapAuthoritative(true);
|
||||
$loader->register(true);
|
||||
|
||||
$filesToLoad = \Composer\Autoload\ComposerStaticInit45f3f12c06bda031b2e5ddfd3167038d::$files;
|
||||
$filesToLoad = \Composer\Autoload\ComposerStaticInitd87870bba647133abcf187f88c151efc::$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 ComposerStaticInit45f3f12c06bda031b2e5ddfd3167038d
|
||||
class ComposerStaticInitd87870bba647133abcf187f88c151efc
|
||||
{
|
||||
public static $files = array (
|
||||
'ad155f8f1cf0d418fe49e248db8c661b' => __DIR__ . '/..' . '/react/promise/src/functions_include.php',
|
||||
|
@ -3067,9 +3067,9 @@ class ComposerStaticInit45f3f12c06bda031b2e5ddfd3167038d
|
|||
public static function getInitializer(ClassLoader $loader)
|
||||
{
|
||||
return \Closure::bind(function () use ($loader) {
|
||||
$loader->prefixLengthsPsr4 = ComposerStaticInit45f3f12c06bda031b2e5ddfd3167038d::$prefixLengthsPsr4;
|
||||
$loader->prefixDirsPsr4 = ComposerStaticInit45f3f12c06bda031b2e5ddfd3167038d::$prefixDirsPsr4;
|
||||
$loader->classMap = ComposerStaticInit45f3f12c06bda031b2e5ddfd3167038d::$classMap;
|
||||
$loader->prefixLengthsPsr4 = ComposerStaticInitd87870bba647133abcf187f88c151efc::$prefixLengthsPsr4;
|
||||
$loader->prefixDirsPsr4 = ComposerStaticInitd87870bba647133abcf187f88c151efc::$prefixDirsPsr4;
|
||||
$loader->classMap = ComposerStaticInitd87870bba647133abcf187f88c151efc::$classMap;
|
||||
|
||||
}, null, ClassLoader::class);
|
||||
}
|
||||
|
|
|
@ -2049,12 +2049,12 @@
|
|||
"source": {
|
||||
"type": "git",
|
||||
"url": "https:\/\/github.com\/rectorphp\/rector-phpunit.git",
|
||||
"reference": "c6bf48b06e04ad2eb4d9f5a3c808eb0bd09ff6f1"
|
||||
"reference": "0a640b3068c0375a0318b0f21842b242638ec4fc"
|
||||
},
|
||||
"dist": {
|
||||
"type": "zip",
|
||||
"url": "https:\/\/api.github.com\/repos\/rectorphp\/rector-phpunit\/zipball\/c6bf48b06e04ad2eb4d9f5a3c808eb0bd09ff6f1",
|
||||
"reference": "c6bf48b06e04ad2eb4d9f5a3c808eb0bd09ff6f1",
|
||||
"url": "https:\/\/api.github.com\/repos\/rectorphp\/rector-phpunit\/zipball\/0a640b3068c0375a0318b0f21842b242638ec4fc",
|
||||
"reference": "0a640b3068c0375a0318b0f21842b242638ec4fc",
|
||||
"shasum": ""
|
||||
},
|
||||
"require": {
|
||||
|
@ -2083,7 +2083,7 @@
|
|||
"tomasvotruba\/type-coverage": "^0.1",
|
||||
"tomasvotruba\/unused-public": "^0.1"
|
||||
},
|
||||
"time": "2023-06-26T07:34:40+00:00",
|
||||
"time": "2023-07-09T17:09:00+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-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'));
|
||||
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 0a640b3'), '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()
|
||||
{
|
||||
}
|
||||
|
|
|
@ -67,8 +67,10 @@ CODE_SAMPLE
|
|||
}
|
||||
$newArgs = [$expr->getArgs()[0], new Arg($node->expr)];
|
||||
if ($expr instanceof StaticCall) {
|
||||
return new StaticCall($expr->class, 'assertContainsOnlyInstancesOf', $newArgs);
|
||||
$staticCall = new StaticCall($expr->class, 'assertContainsOnlyInstancesOf', $newArgs);
|
||||
return new Expression($staticCall);
|
||||
}
|
||||
return new MethodCall($expr->var, 'assertContainsOnlyInstancesOf', $newArgs);
|
||||
$methodCall = new MethodCall($expr->var, 'assertContainsOnlyInstancesOf', $newArgs);
|
||||
return new Expression($methodCall);
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue