Updated Rector to commit 076642f73eee5814a096552c33b28740fbbd48ce

076642f73e [Scoper] Remove manual register DowngradeEnumToConstantListClassRector on config-downgrade.php (#3138)
This commit is contained in:
Tomas Votruba 2022-12-02 12:28:08 +00:00
parent 949696b350
commit 91f18482f3
11 changed files with 129 additions and 18 deletions

2
vendor/autoload.php vendored
View File

@ -22,4 +22,4 @@ if (PHP_VERSION_ID < 50600) {
require_once __DIR__ . '/composer/autoload_real.php';
return ComposerAutoloaderInit81f547123b36a4802fac2fc0ea851b07::getLoader();
return ComposerAutoloaderInit55970196bbd8338c66afbe01bdac3ec6::getLoader();

View File

@ -1745,6 +1745,7 @@ return array(
'Rector\\DowngradePhp74\\Rector\\ClassMethod\\DowngradeCovariantReturnTypeRector' => $vendorDir . '/rector/rector-downgrade-php/rules/DowngradePhp74/Rector/ClassMethod/DowngradeCovariantReturnTypeRector.php',
'Rector\\DowngradePhp74\\Rector\\Coalesce\\DowngradeNullCoalescingOperatorRector' => $vendorDir . '/rector/rector-downgrade-php/rules/DowngradePhp74/Rector/Coalesce/DowngradeNullCoalescingOperatorRector.php',
'Rector\\DowngradePhp74\\Rector\\FuncCall\\DowngradeArrayMergeCallWithoutArgumentsRector' => $vendorDir . '/rector/rector-downgrade-php/rules/DowngradePhp74/Rector/FuncCall/DowngradeArrayMergeCallWithoutArgumentsRector.php',
'Rector\\DowngradePhp74\\Rector\\FuncCall\\DowngradeProcOpenArrayCommandArgRector' => $vendorDir . '/rector/rector-downgrade-php/rules/DowngradePhp74/Rector/FuncCall/DowngradeProcOpenArrayCommandArgRector.php',
'Rector\\DowngradePhp74\\Rector\\FuncCall\\DowngradeStripTagsCallWithArrayRector' => $vendorDir . '/rector/rector-downgrade-php/rules/DowngradePhp74/Rector/FuncCall/DowngradeStripTagsCallWithArrayRector.php',
'Rector\\DowngradePhp74\\Rector\\Identical\\DowngradeFreadFwriteFalsyToNegationRector' => $vendorDir . '/rector/rector-downgrade-php/rules/DowngradePhp74/Rector/Identical/DowngradeFreadFwriteFalsyToNegationRector.php',
'Rector\\DowngradePhp74\\Rector\\Interface_\\DowngradePreviouslyImplementedInterfaceRector' => $vendorDir . '/rector/rector-downgrade-php/rules/DowngradePhp74/Rector/Interface_/DowngradePreviouslyImplementedInterfaceRector.php',

View File

@ -2,7 +2,7 @@
// autoload_real.php @generated by Composer
class ComposerAutoloaderInit81f547123b36a4802fac2fc0ea851b07
class ComposerAutoloaderInit55970196bbd8338c66afbe01bdac3ec6
{
private static $loader;
@ -22,19 +22,19 @@ class ComposerAutoloaderInit81f547123b36a4802fac2fc0ea851b07
return self::$loader;
}
spl_autoload_register(array('ComposerAutoloaderInit81f547123b36a4802fac2fc0ea851b07', 'loadClassLoader'), true, true);
spl_autoload_register(array('ComposerAutoloaderInit55970196bbd8338c66afbe01bdac3ec6', 'loadClassLoader'), true, true);
self::$loader = $loader = new \Composer\Autoload\ClassLoader(\dirname(__DIR__));
spl_autoload_unregister(array('ComposerAutoloaderInit81f547123b36a4802fac2fc0ea851b07', 'loadClassLoader'));
spl_autoload_unregister(array('ComposerAutoloaderInit55970196bbd8338c66afbe01bdac3ec6', 'loadClassLoader'));
require __DIR__ . '/autoload_static.php';
call_user_func(\Composer\Autoload\ComposerStaticInit81f547123b36a4802fac2fc0ea851b07::getInitializer($loader));
call_user_func(\Composer\Autoload\ComposerStaticInit55970196bbd8338c66afbe01bdac3ec6::getInitializer($loader));
$loader->setClassMapAuthoritative(true);
$loader->register(true);
$includeFiles = \Composer\Autoload\ComposerStaticInit81f547123b36a4802fac2fc0ea851b07::$files;
$includeFiles = \Composer\Autoload\ComposerStaticInit55970196bbd8338c66afbe01bdac3ec6::$files;
foreach ($includeFiles as $fileIdentifier => $file) {
composerRequire81f547123b36a4802fac2fc0ea851b07($fileIdentifier, $file);
composerRequire55970196bbd8338c66afbe01bdac3ec6($fileIdentifier, $file);
}
return $loader;
@ -46,7 +46,7 @@ class ComposerAutoloaderInit81f547123b36a4802fac2fc0ea851b07
* @param string $file
* @return void
*/
function composerRequire81f547123b36a4802fac2fc0ea851b07($fileIdentifier, $file)
function composerRequire55970196bbd8338c66afbe01bdac3ec6($fileIdentifier, $file)
{
if (empty($GLOBALS['__composer_autoload_files'][$fileIdentifier])) {
$GLOBALS['__composer_autoload_files'][$fileIdentifier] = true;

View File

@ -4,7 +4,7 @@
namespace Composer\Autoload;
class ComposerStaticInit81f547123b36a4802fac2fc0ea851b07
class ComposerStaticInit55970196bbd8338c66afbe01bdac3ec6
{
public static $files = array (
'ad155f8f1cf0d418fe49e248db8c661b' => __DIR__ . '/..' . '/react/promise/src/functions_include.php',
@ -1995,6 +1995,7 @@ class ComposerStaticInit81f547123b36a4802fac2fc0ea851b07
'Rector\\DowngradePhp74\\Rector\\ClassMethod\\DowngradeCovariantReturnTypeRector' => __DIR__ . '/..' . '/rector/rector-downgrade-php/rules/DowngradePhp74/Rector/ClassMethod/DowngradeCovariantReturnTypeRector.php',
'Rector\\DowngradePhp74\\Rector\\Coalesce\\DowngradeNullCoalescingOperatorRector' => __DIR__ . '/..' . '/rector/rector-downgrade-php/rules/DowngradePhp74/Rector/Coalesce/DowngradeNullCoalescingOperatorRector.php',
'Rector\\DowngradePhp74\\Rector\\FuncCall\\DowngradeArrayMergeCallWithoutArgumentsRector' => __DIR__ . '/..' . '/rector/rector-downgrade-php/rules/DowngradePhp74/Rector/FuncCall/DowngradeArrayMergeCallWithoutArgumentsRector.php',
'Rector\\DowngradePhp74\\Rector\\FuncCall\\DowngradeProcOpenArrayCommandArgRector' => __DIR__ . '/..' . '/rector/rector-downgrade-php/rules/DowngradePhp74/Rector/FuncCall/DowngradeProcOpenArrayCommandArgRector.php',
'Rector\\DowngradePhp74\\Rector\\FuncCall\\DowngradeStripTagsCallWithArrayRector' => __DIR__ . '/..' . '/rector/rector-downgrade-php/rules/DowngradePhp74/Rector/FuncCall/DowngradeStripTagsCallWithArrayRector.php',
'Rector\\DowngradePhp74\\Rector\\Identical\\DowngradeFreadFwriteFalsyToNegationRector' => __DIR__ . '/..' . '/rector/rector-downgrade-php/rules/DowngradePhp74/Rector/Identical/DowngradeFreadFwriteFalsyToNegationRector.php',
'Rector\\DowngradePhp74\\Rector\\Interface_\\DowngradePreviouslyImplementedInterfaceRector' => __DIR__ . '/..' . '/rector/rector-downgrade-php/rules/DowngradePhp74/Rector/Interface_/DowngradePreviouslyImplementedInterfaceRector.php',
@ -3046,9 +3047,9 @@ class ComposerStaticInit81f547123b36a4802fac2fc0ea851b07
public static function getInitializer(ClassLoader $loader)
{
return \Closure::bind(function () use ($loader) {
$loader->prefixLengthsPsr4 = ComposerStaticInit81f547123b36a4802fac2fc0ea851b07::$prefixLengthsPsr4;
$loader->prefixDirsPsr4 = ComposerStaticInit81f547123b36a4802fac2fc0ea851b07::$prefixDirsPsr4;
$loader->classMap = ComposerStaticInit81f547123b36a4802fac2fc0ea851b07::$classMap;
$loader->prefixLengthsPsr4 = ComposerStaticInit55970196bbd8338c66afbe01bdac3ec6::$prefixLengthsPsr4;
$loader->prefixDirsPsr4 = ComposerStaticInit55970196bbd8338c66afbe01bdac3ec6::$prefixDirsPsr4;
$loader->classMap = ComposerStaticInit55970196bbd8338c66afbe01bdac3ec6::$classMap;
}, null, ClassLoader::class);
}

View File

@ -1849,12 +1849,12 @@
"source": {
"type": "git",
"url": "https:\/\/github.com\/rectorphp\/rector-downgrade-php.git",
"reference": "5f52c8b69f6f5ac654ffe6415c7cdd246c43ddbf"
"reference": "d64a1239d1b151ab4f3705eeaec42e24f080ef34"
},
"dist": {
"type": "zip",
"url": "https:\/\/api.github.com\/repos\/rectorphp\/rector-downgrade-php\/zipball\/5f52c8b69f6f5ac654ffe6415c7cdd246c43ddbf",
"reference": "5f52c8b69f6f5ac654ffe6415c7cdd246c43ddbf",
"url": "https:\/\/api.github.com\/repos\/rectorphp\/rector-downgrade-php\/zipball\/d64a1239d1b151ab4f3705eeaec42e24f080ef34",
"reference": "d64a1239d1b151ab4f3705eeaec42e24f080ef34",
"shasum": ""
},
"require": {
@ -1880,7 +1880,7 @@
"symplify\/rule-doc-generator": "^11.1",
"symplify\/vendor-patches": "^11.1"
},
"time": "2022-12-02T12:12:16+00:00",
"time": "2022-12-02T12:14:30+00:00",
"default-branch": true,
"type": "rector-extension",
"extra": {

File diff suppressed because one or more lines are too long

View File

@ -237,6 +237,9 @@ class XdebugHandler
$cmd = '"' . $cmd . '"';
}
}
if (\is_array($cmd)) {
$cmd = \implode(' ', $cmd);
}
$process = \proc_open($cmd, [], $pipes);
if (\is_resource($process)) {
$exitCode = \proc_close($process);

View File

@ -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 bf394ee'), '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 5f52c8b'), 'rector/rector-php-parser' => array('install_path' => '/home/runner/work/rector-src/rector-src/vendor/rector/rector-php-parser', 'relative_install_path' => '../../rector-php-parser', 'extra' => array('includes' => array(0 => 'config/config.php')), 'version' => 'dev-main 9ea5f62'), '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 e646c56'), '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 caa1373'));
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 bf394ee'), '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 d64a123'), 'rector/rector-php-parser' => array('install_path' => '/home/runner/work/rector-src/rector-src/vendor/rector/rector-php-parser', 'relative_install_path' => '../../rector-php-parser', 'extra' => array('includes' => array(0 => 'config/config.php')), 'version' => 'dev-main 9ea5f62'), '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 e646c56'), '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 caa1373'));
private function __construct()
{
}

View File

@ -11,6 +11,7 @@ use Rector\DowngradePhp74\Rector\ClassMethod\DowngradeContravariantArgumentTypeR
use Rector\DowngradePhp74\Rector\ClassMethod\DowngradeCovariantReturnTypeRector;
use Rector\DowngradePhp74\Rector\Coalesce\DowngradeNullCoalescingOperatorRector;
use Rector\DowngradePhp74\Rector\FuncCall\DowngradeArrayMergeCallWithoutArgumentsRector;
use Rector\DowngradePhp74\Rector\FuncCall\DowngradeProcOpenArrayCommandArgRector;
use Rector\DowngradePhp74\Rector\FuncCall\DowngradeStripTagsCallWithArrayRector;
use Rector\DowngradePhp74\Rector\Identical\DowngradeFreadFwriteFalsyToNegationRector;
use Rector\DowngradePhp74\Rector\Interface_\DowngradePreviouslyImplementedInterfaceRector;
@ -31,4 +32,5 @@ return static function (RectorConfig $rectorConfig) : void {
$rectorConfig->rule(DowngradeFreadFwriteFalsyToNegationRector::class);
$rectorConfig->rule(DowngradePreviouslyImplementedInterfaceRector::class);
$rectorConfig->rule(DowngradeReflectionGetTypeRector::class);
$rectorConfig->rule(DowngradeProcOpenArrayCommandArgRector::class);
};

View File

@ -0,0 +1,101 @@
<?php
declare (strict_types=1);
namespace Rector\DowngradePhp74\Rector\FuncCall;
use PhpParser\Node;
use PhpParser\Node\Arg;
use PhpParser\Node\Expr\Assign;
use PhpParser\Node\Expr\FuncCall;
use PhpParser\Node\Expr\Variable;
use PhpParser\Node\Scalar\String_;
use PhpParser\Node\Stmt;
use PhpParser\Node\Stmt\Expression;
use PhpParser\Node\Stmt\If_;
use PHPStan\Analyser\Scope;
use Rector\Core\Rector\AbstractScopeAwareRector;
use Rector\Naming\Naming\VariableNaming;
use Rector\PostRector\Collector\NodesToAddCollector;
use Symplify\RuleDocGenerator\ValueObject\CodeSample\CodeSample;
use Symplify\RuleDocGenerator\ValueObject\RuleDefinition;
/**
* @see \Rector\Tests\DowngradePhp74\Rector\FuncCall\DowngradeProcOpenArrayCommandArgRector\DowngradeProcOpenArrayCommandArgRectorTest
*/
final class DowngradeProcOpenArrayCommandArgRector extends AbstractScopeAwareRector
{
/**
* @readonly
* @var \Rector\PostRector\Collector\NodesToAddCollector
*/
private $nodesToAddCollector;
/**
* @readonly
* @var \Rector\Naming\Naming\VariableNaming
*/
private $variableNaming;
public function __construct(NodesToAddCollector $nodesToAddCollector, VariableNaming $variableNaming)
{
$this->nodesToAddCollector = $nodesToAddCollector;
$this->variableNaming = $variableNaming;
}
public function getRuleDefinition() : RuleDefinition
{
return new RuleDefinition('Change array command argument on proc_open to implode spaced string', [new CodeSample(<<<'CODE_SAMPLE'
function (array|string $command)
{
$process = proc_open($command, $descriptorspec, $pipes, null, null, ['suppress_errors' => true]);
}
CODE_SAMPLE
, <<<'CODE_SAMPLE'
function (array|string $command)
{
if (is_array($command)) {
$command = implode(" ", $command);
}
$process = proc_open($command, $descriptorspec, $pipes, null, null, ['suppress_errors' => true]);
}
CODE_SAMPLE
)]);
}
/**
* @return array<class-string<Node>>
*/
public function getNodeTypes() : array
{
return [FuncCall::class];
}
/**
* @param FuncCall $node
*/
public function refactorWithScope(Node $node, Scope $scope) : ?FuncCall
{
if (!$this->isName($node, 'proc_open')) {
return null;
}
if ($node->isFirstClassCallable()) {
return null;
}
$args = $node->getArgs();
if (!isset($args[0])) {
return null;
}
$commandType = $this->getType($args[0]->value);
if ($commandType->isString()->yes()) {
return null;
}
$currentStmt = $this->betterNodeFinder->resolveCurrentStatement($node);
if (!$currentStmt instanceof Stmt) {
return null;
}
$variable = $args[0]->value instanceof Variable ? $args[0]->value : new Variable($this->variableNaming->createCountedValueName('command', $scope));
if ($args[0]->value !== $variable) {
$assign = new Assign($variable, $args[0]->value);
$this->nodesToAddCollector->addNodeBeforeNode(new Expression($assign), $currentStmt);
$node->args[0] = new Arg($variable);
}
$implode = $this->nodeFactory->createFuncCall('implode', [new String_(' '), $variable]);
$this->nodesToAddCollector->addNodeBeforeNode(new If_($this->nodeFactory->createFuncCall('is_array', [$args[0]->value]), ['stmts' => [new Expression(new Assign($variable, $implode))]]), $currentStmt);
return $node;
}
}

View File

@ -191,6 +191,9 @@ class Terminal
return null;
}
$descriptorspec = [1 => ['pipe', 'w'], 2 => ['pipe', 'w']];
if (\is_array($command)) {
$command = \implode(' ', $command);
}
$process = \proc_open($command, $descriptorspec, $pipes, null, null, ['suppress_errors' => \true]);
if (!\is_resource($process)) {
return null;