mirror of
https://github.com/rectorphp/rector.git
synced 2025-03-14 20:39:43 +01:00
Updated Rector to commit 73f5fc13bbc8ae2a2f6031c8bbfcf637eeb33d88
73f5fc13bb
[Php81] Handle non-dynamic + dynamic args (non-array, non-scalar) passed to New_ on NewInInitializerRector (#1737)
This commit is contained in:
parent
2ebc6821cc
commit
28f8cfafaf
71
rules/Php81/NodeAnalyzer/ComplexNewAnalyzer.php
Normal file
71
rules/Php81/NodeAnalyzer/ComplexNewAnalyzer.php
Normal file
@ -0,0 +1,71 @@
|
||||
<?php
|
||||
|
||||
declare (strict_types=1);
|
||||
namespace Rector\Php81\NodeAnalyzer;
|
||||
|
||||
use PhpParser\Node\Expr;
|
||||
use PhpParser\Node\Expr\Array_;
|
||||
use PhpParser\Node\Expr\ArrayItem;
|
||||
use PhpParser\Node\Expr\New_;
|
||||
use PhpParser\Node\Name\FullyQualified;
|
||||
use PhpParser\Node\Scalar;
|
||||
use Rector\Core\NodeAnalyzer\ExprAnalyzer;
|
||||
final class ComplexNewAnalyzer
|
||||
{
|
||||
/**
|
||||
* @readonly
|
||||
* @var \Rector\Core\NodeAnalyzer\ExprAnalyzer
|
||||
*/
|
||||
private $exprAnalyzer;
|
||||
public function __construct(\Rector\Core\NodeAnalyzer\ExprAnalyzer $exprAnalyzer)
|
||||
{
|
||||
$this->exprAnalyzer = $exprAnalyzer;
|
||||
}
|
||||
public function isDynamic(\PhpParser\Node\Expr\New_ $new) : bool
|
||||
{
|
||||
if (!$new->class instanceof \PhpParser\Node\Name\FullyQualified) {
|
||||
return \true;
|
||||
}
|
||||
$args = $new->getArgs();
|
||||
foreach ($args as $arg) {
|
||||
$value = $arg->value;
|
||||
if ($this->isAllowedNew($value)) {
|
||||
continue;
|
||||
}
|
||||
if ($value instanceof \PhpParser\Node\Expr\Array_ && $this->isAllowedArray($value)) {
|
||||
continue;
|
||||
}
|
||||
if ($value instanceof \PhpParser\Node\Scalar) {
|
||||
continue;
|
||||
}
|
||||
return \true;
|
||||
}
|
||||
return \false;
|
||||
}
|
||||
private function isAllowedNew(\PhpParser\Node\Expr $expr) : bool
|
||||
{
|
||||
if ($expr instanceof \PhpParser\Node\Expr\New_) {
|
||||
return !$this->isDynamic($expr);
|
||||
}
|
||||
return \false;
|
||||
}
|
||||
private function isAllowedArray(\PhpParser\Node\Expr\Array_ $array) : bool
|
||||
{
|
||||
if (!$this->exprAnalyzer->isDynamicArray($array)) {
|
||||
return \true;
|
||||
}
|
||||
$arrayItems = $array->items;
|
||||
foreach ($arrayItems as $arrayItem) {
|
||||
if (!$arrayItem instanceof \PhpParser\Node\Expr\ArrayItem) {
|
||||
continue;
|
||||
}
|
||||
if (!$arrayItem->value instanceof \PhpParser\Node\Expr\New_) {
|
||||
return \false;
|
||||
}
|
||||
if ($this->isDynamic($arrayItem->value)) {
|
||||
return \false;
|
||||
}
|
||||
}
|
||||
return \true;
|
||||
}
|
||||
}
|
@ -4,10 +4,8 @@ declare (strict_types=1);
|
||||
namespace Rector\Php81\Rector\ClassMethod;
|
||||
|
||||
use PhpParser\Node;
|
||||
use PhpParser\Node\Expr;
|
||||
use PhpParser\Node\Expr\BinaryOp\Coalesce;
|
||||
use PhpParser\Node\Expr\New_;
|
||||
use PhpParser\Node\Name\FullyQualified;
|
||||
use PhpParser\Node\NullableType;
|
||||
use PhpParser\Node\Param;
|
||||
use PhpParser\Node\Stmt\Class_;
|
||||
@ -18,6 +16,7 @@ use PhpParser\Node\Stmt\Property;
|
||||
use Rector\Core\Rector\AbstractRector;
|
||||
use Rector\Core\ValueObject\MethodName;
|
||||
use Rector\Core\ValueObject\PhpVersionFeature;
|
||||
use Rector\Php81\NodeAnalyzer\ComplexNewAnalyzer;
|
||||
use Rector\VersionBonding\Contract\MinPhpVersionInterface;
|
||||
use Symplify\RuleDocGenerator\ValueObject\CodeSample\CodeSample;
|
||||
use Symplify\RuleDocGenerator\ValueObject\RuleDefinition;
|
||||
@ -28,6 +27,15 @@ use Symplify\RuleDocGenerator\ValueObject\RuleDefinition;
|
||||
*/
|
||||
final class NewInInitializerRector extends \Rector\Core\Rector\AbstractRector implements \Rector\VersionBonding\Contract\MinPhpVersionInterface
|
||||
{
|
||||
/**
|
||||
* @readonly
|
||||
* @var \Rector\Php81\NodeAnalyzer\ComplexNewAnalyzer
|
||||
*/
|
||||
private $complexNewAnalyzer;
|
||||
public function __construct(\Rector\Php81\NodeAnalyzer\ComplexNewAnalyzer $complexNewAnalyzer)
|
||||
{
|
||||
$this->complexNewAnalyzer = $complexNewAnalyzer;
|
||||
}
|
||||
public function getRuleDefinition() : \Symplify\RuleDocGenerator\ValueObject\RuleDefinition
|
||||
{
|
||||
return new \Symplify\RuleDocGenerator\ValueObject\RuleDefinition('Replace property declaration of new state with direct new', [new \Symplify\RuleDocGenerator\ValueObject\CodeSample\CodeSample(<<<'CODE_SAMPLE'
|
||||
@ -69,27 +77,28 @@ CODE_SAMPLE
|
||||
return null;
|
||||
}
|
||||
$params = $this->matchConstructorParams($node);
|
||||
if ($params === null) {
|
||||
if ($params === []) {
|
||||
return null;
|
||||
}
|
||||
foreach ($params as $param) {
|
||||
if (!$param->type instanceof \PhpParser\Node\NullableType) {
|
||||
continue;
|
||||
}
|
||||
/** @var string $paramName */
|
||||
$paramName = $this->getName($param->var);
|
||||
$toPropertyAssigns = $this->betterNodeFinder->findClassMethodAssignsToLocalProperty($node, $paramName);
|
||||
$toPropertyAssigns = \array_filter($toPropertyAssigns, function ($v) : bool {
|
||||
return $v->expr instanceof \PhpParser\Node\Expr\BinaryOp\Coalesce;
|
||||
});
|
||||
foreach ($toPropertyAssigns as $toPropertyAssign) {
|
||||
if (!$toPropertyAssign->expr instanceof \PhpParser\Node\Expr\BinaryOp\Coalesce) {
|
||||
/** @var Coalesce $coalesce */
|
||||
$coalesce = $toPropertyAssign->expr;
|
||||
if (!$coalesce->right instanceof \PhpParser\Node\Expr\New_) {
|
||||
continue;
|
||||
}
|
||||
if ($this->isNotNewOrWithDynamicClass($toPropertyAssign->expr->right)) {
|
||||
if ($this->complexNewAnalyzer->isDynamic($coalesce->right)) {
|
||||
continue;
|
||||
}
|
||||
/** @var NullableType $currentParamType */
|
||||
$currentParamType = $param->type;
|
||||
$param->type = $currentParamType->type;
|
||||
$coalesce = $toPropertyAssign->expr;
|
||||
$param->default = $coalesce->right;
|
||||
$this->removeNode($toPropertyAssign);
|
||||
$this->processPropertyPromotion($node, $param, $paramName);
|
||||
@ -101,10 +110,6 @@ CODE_SAMPLE
|
||||
{
|
||||
return \Rector\Core\ValueObject\PhpVersionFeature::NEW_INITIALIZERS;
|
||||
}
|
||||
private function isNotNewOrWithDynamicClass(\PhpParser\Node\Expr $expr) : bool
|
||||
{
|
||||
return !$expr instanceof \PhpParser\Node\Expr\New_ || !$expr->class instanceof \PhpParser\Node\Name\FullyQualified;
|
||||
}
|
||||
private function processPropertyPromotion(\PhpParser\Node\Stmt\ClassMethod $classMethod, \PhpParser\Node\Param $param, string $paramName) : void
|
||||
{
|
||||
$classLike = $this->betterNodeFinder->findParentType($classMethod, \PhpParser\Node\Stmt\ClassLike::class);
|
||||
@ -130,19 +135,21 @@ CODE_SAMPLE
|
||||
return \true;
|
||||
}
|
||||
/**
|
||||
* @return mixed[]|null
|
||||
* @return Param[]
|
||||
*/
|
||||
private function matchConstructorParams(\PhpParser\Node\Stmt\ClassMethod $classMethod)
|
||||
private function matchConstructorParams(\PhpParser\Node\Stmt\ClassMethod $classMethod) : array
|
||||
{
|
||||
if (!$this->isName($classMethod, \Rector\Core\ValueObject\MethodName::CONSTRUCT)) {
|
||||
return null;
|
||||
return [];
|
||||
}
|
||||
if ($classMethod->params === []) {
|
||||
return null;
|
||||
return [];
|
||||
}
|
||||
if ($classMethod->stmts === []) {
|
||||
return null;
|
||||
return [];
|
||||
}
|
||||
return $classMethod->params;
|
||||
return \array_filter($classMethod->params, function ($v) : bool {
|
||||
return $v->type instanceof \PhpParser\Node\NullableType;
|
||||
});
|
||||
}
|
||||
}
|
||||
|
@ -16,11 +16,11 @@ final class VersionResolver
|
||||
/**
|
||||
* @var string
|
||||
*/
|
||||
public const PACKAGE_VERSION = '79dd9bb5f4da949fc2b308628f0aa39bd7ced60c';
|
||||
public const PACKAGE_VERSION = '73f5fc13bbc8ae2a2f6031c8bbfcf637eeb33d88';
|
||||
/**
|
||||
* @var string
|
||||
*/
|
||||
public const RELEASE_DATE = '2022-01-28 17:59:35';
|
||||
public const RELEASE_DATE = '2022-01-28 13:13:57';
|
||||
public static function resolvePackageVersion() : string
|
||||
{
|
||||
$process = new \RectorPrefix20220128\Symfony\Component\Process\Process(['git', 'log', '--pretty="%H"', '-n1', 'HEAD'], __DIR__);
|
||||
|
@ -4,8 +4,13 @@ declare (strict_types=1);
|
||||
namespace Rector\Core\NodeAnalyzer;
|
||||
|
||||
use PhpParser\Node\Expr;
|
||||
use PhpParser\Node\Expr\Array_;
|
||||
use PhpParser\Node\Expr\ArrayItem;
|
||||
use PhpParser\Node\Expr\Variable;
|
||||
use PhpParser\Node\FunctionLike;
|
||||
use PhpParser\Node\Scalar;
|
||||
use PhpParser\Node\Scalar\LNumber;
|
||||
use PhpParser\Node\Scalar\String_;
|
||||
use Rector\Core\PhpParser\Comparing\NodeComparator;
|
||||
use Rector\Core\PhpParser\Node\BetterNodeFinder;
|
||||
final class ExprAnalyzer
|
||||
@ -43,4 +48,42 @@ final class ExprAnalyzer
|
||||
}
|
||||
return \false;
|
||||
}
|
||||
public function isDynamicArray(\PhpParser\Node\Expr\Array_ $array) : bool
|
||||
{
|
||||
foreach ($array->items as $item) {
|
||||
if (!$item instanceof \PhpParser\Node\Expr\ArrayItem) {
|
||||
continue;
|
||||
}
|
||||
$key = $item->key;
|
||||
if (!$this->isAllowedArrayKey($key)) {
|
||||
return \true;
|
||||
}
|
||||
$value = $item->value;
|
||||
if (!$this->isAllowedArrayValue($value)) {
|
||||
return \true;
|
||||
}
|
||||
}
|
||||
return \false;
|
||||
}
|
||||
private function isAllowedArrayKey(?\PhpParser\Node\Expr $expr) : bool
|
||||
{
|
||||
if (!$expr instanceof \PhpParser\Node\Expr) {
|
||||
return \true;
|
||||
}
|
||||
return \in_array(\get_class($expr), [\PhpParser\Node\Scalar\String_::class, \PhpParser\Node\Scalar\LNumber::class], \true);
|
||||
}
|
||||
private function isAllowedArrayValue(\PhpParser\Node\Expr $expr) : bool
|
||||
{
|
||||
if ($expr instanceof \PhpParser\Node\Expr\Array_) {
|
||||
return \true;
|
||||
}
|
||||
return $this->isAllowedArrayOrScalar($expr);
|
||||
}
|
||||
private function isAllowedArrayOrScalar(\PhpParser\Node\Expr $expr) : bool
|
||||
{
|
||||
if (!$expr instanceof \PhpParser\Node\Expr\Array_) {
|
||||
return $expr instanceof \PhpParser\Node\Scalar;
|
||||
}
|
||||
return !$this->isDynamicArray($expr);
|
||||
}
|
||||
}
|
||||
|
2
vendor/autoload.php
vendored
2
vendor/autoload.php
vendored
@ -4,4 +4,4 @@
|
||||
|
||||
require_once __DIR__ . '/composer/autoload_real.php';
|
||||
|
||||
return ComposerAutoloaderInit91c87b5f78a348c1eeced48483150f0c::getLoader();
|
||||
return ComposerAutoloaderInit7ed4d0b806593520bbd214577c57fa63::getLoader();
|
||||
|
1
vendor/composer/autoload_classmap.php
vendored
1
vendor/composer/autoload_classmap.php
vendored
@ -2678,6 +2678,7 @@ return array(
|
||||
'Rector\\Php80\\ValueObject\\DoctrineTagAndAnnotationToAttribute' => $baseDir . '/rules/Php80/ValueObject/DoctrineTagAndAnnotationToAttribute.php',
|
||||
'Rector\\Php80\\ValueObject\\PropertyPromotionCandidate' => $baseDir . '/rules/Php80/ValueObject/PropertyPromotionCandidate.php',
|
||||
'Rector\\Php80\\ValueObject\\StrStartsWith' => $baseDir . '/rules/Php80/ValueObject/StrStartsWith.php',
|
||||
'Rector\\Php81\\NodeAnalyzer\\ComplexNewAnalyzer' => $baseDir . '/rules/Php81/NodeAnalyzer/ComplexNewAnalyzer.php',
|
||||
'Rector\\Php81\\NodeFactory\\EnumFactory' => $baseDir . '/rules/Php81/NodeFactory/EnumFactory.php',
|
||||
'Rector\\Php81\\Rector\\ClassConst\\FinalizePublicClassConstantRector' => $baseDir . '/rules/Php81/Rector/ClassConst/FinalizePublicClassConstantRector.php',
|
||||
'Rector\\Php81\\Rector\\ClassMethod\\NewInInitializerRector' => $baseDir . '/rules/Php81/Rector/ClassMethod/NewInInitializerRector.php',
|
||||
|
14
vendor/composer/autoload_real.php
vendored
14
vendor/composer/autoload_real.php
vendored
@ -2,7 +2,7 @@
|
||||
|
||||
// autoload_real.php @generated by Composer
|
||||
|
||||
class ComposerAutoloaderInit91c87b5f78a348c1eeced48483150f0c
|
||||
class ComposerAutoloaderInit7ed4d0b806593520bbd214577c57fa63
|
||||
{
|
||||
private static $loader;
|
||||
|
||||
@ -22,15 +22,15 @@ class ComposerAutoloaderInit91c87b5f78a348c1eeced48483150f0c
|
||||
return self::$loader;
|
||||
}
|
||||
|
||||
spl_autoload_register(array('ComposerAutoloaderInit91c87b5f78a348c1eeced48483150f0c', 'loadClassLoader'), true, true);
|
||||
spl_autoload_register(array('ComposerAutoloaderInit7ed4d0b806593520bbd214577c57fa63', 'loadClassLoader'), true, true);
|
||||
self::$loader = $loader = new \Composer\Autoload\ClassLoader(\dirname(\dirname(__FILE__)));
|
||||
spl_autoload_unregister(array('ComposerAutoloaderInit91c87b5f78a348c1eeced48483150f0c', 'loadClassLoader'));
|
||||
spl_autoload_unregister(array('ComposerAutoloaderInit7ed4d0b806593520bbd214577c57fa63', 'loadClassLoader'));
|
||||
|
||||
$useStaticLoader = PHP_VERSION_ID >= 50600 && !defined('HHVM_VERSION') && (!function_exists('zend_loader_file_encoded') || !zend_loader_file_encoded());
|
||||
if ($useStaticLoader) {
|
||||
require __DIR__ . '/autoload_static.php';
|
||||
|
||||
call_user_func(\Composer\Autoload\ComposerStaticInit91c87b5f78a348c1eeced48483150f0c::getInitializer($loader));
|
||||
call_user_func(\Composer\Autoload\ComposerStaticInit7ed4d0b806593520bbd214577c57fa63::getInitializer($loader));
|
||||
} else {
|
||||
$classMap = require __DIR__ . '/autoload_classmap.php';
|
||||
if ($classMap) {
|
||||
@ -42,12 +42,12 @@ class ComposerAutoloaderInit91c87b5f78a348c1eeced48483150f0c
|
||||
$loader->register(true);
|
||||
|
||||
if ($useStaticLoader) {
|
||||
$includeFiles = Composer\Autoload\ComposerStaticInit91c87b5f78a348c1eeced48483150f0c::$files;
|
||||
$includeFiles = Composer\Autoload\ComposerStaticInit7ed4d0b806593520bbd214577c57fa63::$files;
|
||||
} else {
|
||||
$includeFiles = require __DIR__ . '/autoload_files.php';
|
||||
}
|
||||
foreach ($includeFiles as $fileIdentifier => $file) {
|
||||
composerRequire91c87b5f78a348c1eeced48483150f0c($fileIdentifier, $file);
|
||||
composerRequire7ed4d0b806593520bbd214577c57fa63($fileIdentifier, $file);
|
||||
}
|
||||
|
||||
return $loader;
|
||||
@ -59,7 +59,7 @@ class ComposerAutoloaderInit91c87b5f78a348c1eeced48483150f0c
|
||||
* @param string $file
|
||||
* @return void
|
||||
*/
|
||||
function composerRequire91c87b5f78a348c1eeced48483150f0c($fileIdentifier, $file)
|
||||
function composerRequire7ed4d0b806593520bbd214577c57fa63($fileIdentifier, $file)
|
||||
{
|
||||
if (empty($GLOBALS['__composer_autoload_files'][$fileIdentifier])) {
|
||||
$GLOBALS['__composer_autoload_files'][$fileIdentifier] = true;
|
||||
|
9
vendor/composer/autoload_static.php
vendored
9
vendor/composer/autoload_static.php
vendored
@ -4,7 +4,7 @@
|
||||
|
||||
namespace Composer\Autoload;
|
||||
|
||||
class ComposerStaticInit91c87b5f78a348c1eeced48483150f0c
|
||||
class ComposerStaticInit7ed4d0b806593520bbd214577c57fa63
|
||||
{
|
||||
public static $files = array (
|
||||
'0e6d7bf4a5811bfa5cf40c5ccd6fae6a' => __DIR__ . '/..' . '/symfony/polyfill-mbstring/bootstrap.php',
|
||||
@ -3068,6 +3068,7 @@ class ComposerStaticInit91c87b5f78a348c1eeced48483150f0c
|
||||
'Rector\\Php80\\ValueObject\\DoctrineTagAndAnnotationToAttribute' => __DIR__ . '/../..' . '/rules/Php80/ValueObject/DoctrineTagAndAnnotationToAttribute.php',
|
||||
'Rector\\Php80\\ValueObject\\PropertyPromotionCandidate' => __DIR__ . '/../..' . '/rules/Php80/ValueObject/PropertyPromotionCandidate.php',
|
||||
'Rector\\Php80\\ValueObject\\StrStartsWith' => __DIR__ . '/../..' . '/rules/Php80/ValueObject/StrStartsWith.php',
|
||||
'Rector\\Php81\\NodeAnalyzer\\ComplexNewAnalyzer' => __DIR__ . '/../..' . '/rules/Php81/NodeAnalyzer/ComplexNewAnalyzer.php',
|
||||
'Rector\\Php81\\NodeFactory\\EnumFactory' => __DIR__ . '/../..' . '/rules/Php81/NodeFactory/EnumFactory.php',
|
||||
'Rector\\Php81\\Rector\\ClassConst\\FinalizePublicClassConstantRector' => __DIR__ . '/../..' . '/rules/Php81/Rector/ClassConst/FinalizePublicClassConstantRector.php',
|
||||
'Rector\\Php81\\Rector\\ClassMethod\\NewInInitializerRector' => __DIR__ . '/../..' . '/rules/Php81/Rector/ClassMethod/NewInInitializerRector.php',
|
||||
@ -3867,9 +3868,9 @@ class ComposerStaticInit91c87b5f78a348c1eeced48483150f0c
|
||||
public static function getInitializer(ClassLoader $loader)
|
||||
{
|
||||
return \Closure::bind(function () use ($loader) {
|
||||
$loader->prefixLengthsPsr4 = ComposerStaticInit91c87b5f78a348c1eeced48483150f0c::$prefixLengthsPsr4;
|
||||
$loader->prefixDirsPsr4 = ComposerStaticInit91c87b5f78a348c1eeced48483150f0c::$prefixDirsPsr4;
|
||||
$loader->classMap = ComposerStaticInit91c87b5f78a348c1eeced48483150f0c::$classMap;
|
||||
$loader->prefixLengthsPsr4 = ComposerStaticInit7ed4d0b806593520bbd214577c57fa63::$prefixLengthsPsr4;
|
||||
$loader->prefixDirsPsr4 = ComposerStaticInit7ed4d0b806593520bbd214577c57fa63::$prefixDirsPsr4;
|
||||
$loader->classMap = ComposerStaticInit7ed4d0b806593520bbd214577c57fa63::$classMap;
|
||||
|
||||
}, null, ClassLoader::class);
|
||||
}
|
||||
|
98
vendor/composer/installed.json
vendored
98
vendor/composer/installed.json
vendored
@ -2814,17 +2814,17 @@
|
||||
},
|
||||
{
|
||||
"name": "symfony\/config",
|
||||
"version": "v5.4.2",
|
||||
"version_normalized": "5.4.2.0",
|
||||
"version": "v5.4.3",
|
||||
"version_normalized": "5.4.3.0",
|
||||
"source": {
|
||||
"type": "git",
|
||||
"url": "https:\/\/github.com\/symfony\/config.git",
|
||||
"reference": "2e082dae50da563c639119b7b52347a2a3db4ba5"
|
||||
"reference": "d65e1bd990c740e31feb07d2b0927b8d4df9956f"
|
||||
},
|
||||
"dist": {
|
||||
"type": "zip",
|
||||
"url": "https:\/\/api.github.com\/repos\/symfony\/config\/zipball\/2e082dae50da563c639119b7b52347a2a3db4ba5",
|
||||
"reference": "2e082dae50da563c639119b7b52347a2a3db4ba5",
|
||||
"url": "https:\/\/api.github.com\/repos\/symfony\/config\/zipball\/d65e1bd990c740e31feb07d2b0927b8d4df9956f",
|
||||
"reference": "d65e1bd990c740e31feb07d2b0927b8d4df9956f",
|
||||
"shasum": ""
|
||||
},
|
||||
"require": {
|
||||
@ -2848,7 +2848,7 @@
|
||||
"suggest": {
|
||||
"symfony\/yaml": "To use the yaml reference dumper"
|
||||
},
|
||||
"time": "2021-12-15T11:06:13+00:00",
|
||||
"time": "2022-01-03T09:50:52+00:00",
|
||||
"type": "library",
|
||||
"installation-source": "dist",
|
||||
"autoload": {
|
||||
@ -2876,7 +2876,7 @@
|
||||
"description": "Helps you find, load, combine, autofill and validate configuration values of any kind",
|
||||
"homepage": "https:\/\/symfony.com",
|
||||
"support": {
|
||||
"source": "https:\/\/github.com\/symfony\/config\/tree\/v5.4.2"
|
||||
"source": "https:\/\/github.com\/symfony\/config\/tree\/v5.4.3"
|
||||
},
|
||||
"funding": [
|
||||
{
|
||||
@ -2896,17 +2896,17 @@
|
||||
},
|
||||
{
|
||||
"name": "symfony\/console",
|
||||
"version": "v6.0.2",
|
||||
"version_normalized": "6.0.2.0",
|
||||
"version": "v6.0.3",
|
||||
"version_normalized": "6.0.3.0",
|
||||
"source": {
|
||||
"type": "git",
|
||||
"url": "https:\/\/github.com\/symfony\/console.git",
|
||||
"reference": "dd434fa8d69325e5d210f63070014d889511fcb3"
|
||||
"reference": "22e8efd019c3270c4f79376234a3f8752cd25490"
|
||||
},
|
||||
"dist": {
|
||||
"type": "zip",
|
||||
"url": "https:\/\/api.github.com\/repos\/symfony\/console\/zipball\/dd434fa8d69325e5d210f63070014d889511fcb3",
|
||||
"reference": "dd434fa8d69325e5d210f63070014d889511fcb3",
|
||||
"url": "https:\/\/api.github.com\/repos\/symfony\/console\/zipball\/22e8efd019c3270c4f79376234a3f8752cd25490",
|
||||
"reference": "22e8efd019c3270c4f79376234a3f8752cd25490",
|
||||
"shasum": ""
|
||||
},
|
||||
"require": {
|
||||
@ -2940,7 +2940,7 @@
|
||||
"symfony\/lock": "",
|
||||
"symfony\/process": ""
|
||||
},
|
||||
"time": "2021-12-27T21:05:08+00:00",
|
||||
"time": "2022-01-26T17:23:29+00:00",
|
||||
"type": "library",
|
||||
"installation-source": "dist",
|
||||
"autoload": {
|
||||
@ -2974,7 +2974,7 @@
|
||||
"terminal"
|
||||
],
|
||||
"support": {
|
||||
"source": "https:\/\/github.com\/symfony\/console\/tree\/v6.0.2"
|
||||
"source": "https:\/\/github.com\/symfony\/console\/tree\/v6.0.3"
|
||||
},
|
||||
"funding": [
|
||||
{
|
||||
@ -3098,17 +3098,17 @@
|
||||
},
|
||||
{
|
||||
"name": "symfony\/dependency-injection",
|
||||
"version": "v5.4.2",
|
||||
"version_normalized": "5.4.2.0",
|
||||
"version": "v5.4.3",
|
||||
"version_normalized": "5.4.3.0",
|
||||
"source": {
|
||||
"type": "git",
|
||||
"url": "https:\/\/github.com\/symfony\/dependency-injection.git",
|
||||
"reference": "ba94559be9738d77cd29e24b5d81cf3b89b7d628"
|
||||
"reference": "974580fd67f14d65b045c11b09eb149cd4b13df5"
|
||||
},
|
||||
"dist": {
|
||||
"type": "zip",
|
||||
"url": "https:\/\/api.github.com\/repos\/symfony\/dependency-injection\/zipball\/ba94559be9738d77cd29e24b5d81cf3b89b7d628",
|
||||
"reference": "ba94559be9738d77cd29e24b5d81cf3b89b7d628",
|
||||
"url": "https:\/\/api.github.com\/repos\/symfony\/dependency-injection\/zipball\/974580fd67f14d65b045c11b09eb149cd4b13df5",
|
||||
"reference": "974580fd67f14d65b045c11b09eb149cd4b13df5",
|
||||
"shasum": ""
|
||||
},
|
||||
"require": {
|
||||
@ -3142,7 +3142,7 @@
|
||||
"symfony\/proxy-manager-bridge": "Generate service proxies to lazy load them",
|
||||
"symfony\/yaml": ""
|
||||
},
|
||||
"time": "2021-12-29T10:10:35+00:00",
|
||||
"time": "2022-01-26T16:28:35+00:00",
|
||||
"type": "library",
|
||||
"extra": {
|
||||
"patches_applied": [
|
||||
@ -3175,7 +3175,7 @@
|
||||
"description": "Allows you to standardize and centralize the way objects are constructed in your application",
|
||||
"homepage": "https:\/\/symfony.com",
|
||||
"support": {
|
||||
"source": "https:\/\/github.com\/symfony\/dependency-injection\/tree\/v5.4.2"
|
||||
"source": "https:\/\/github.com\/symfony\/dependency-injection\/tree\/v5.4.3"
|
||||
},
|
||||
"funding": [
|
||||
{
|
||||
@ -3261,23 +3261,23 @@
|
||||
},
|
||||
{
|
||||
"name": "symfony\/finder",
|
||||
"version": "v6.0.2",
|
||||
"version_normalized": "6.0.2.0",
|
||||
"version": "v6.0.3",
|
||||
"version_normalized": "6.0.3.0",
|
||||
"source": {
|
||||
"type": "git",
|
||||
"url": "https:\/\/github.com\/symfony\/finder.git",
|
||||
"reference": "03d2833e677d48317cac852f9c0287fb048c3c5c"
|
||||
"reference": "8661b74dbabc23223f38c9b99d3f8ade71170430"
|
||||
},
|
||||
"dist": {
|
||||
"type": "zip",
|
||||
"url": "https:\/\/api.github.com\/repos\/symfony\/finder\/zipball\/03d2833e677d48317cac852f9c0287fb048c3c5c",
|
||||
"reference": "03d2833e677d48317cac852f9c0287fb048c3c5c",
|
||||
"url": "https:\/\/api.github.com\/repos\/symfony\/finder\/zipball\/8661b74dbabc23223f38c9b99d3f8ade71170430",
|
||||
"reference": "8661b74dbabc23223f38c9b99d3f8ade71170430",
|
||||
"shasum": ""
|
||||
},
|
||||
"require": {
|
||||
"php": ">=8.0.2"
|
||||
},
|
||||
"time": "2021-12-20T16:21:45+00:00",
|
||||
"time": "2022-01-26T17:23:29+00:00",
|
||||
"type": "library",
|
||||
"installation-source": "dist",
|
||||
"autoload": {
|
||||
@ -3305,7 +3305,7 @@
|
||||
"description": "Finds files and directories via an intuitive fluent interface",
|
||||
"homepage": "https:\/\/symfony.com",
|
||||
"support": {
|
||||
"source": "https:\/\/github.com\/symfony\/finder\/tree\/v6.0.2"
|
||||
"source": "https:\/\/github.com\/symfony\/finder\/tree\/v6.0.3"
|
||||
},
|
||||
"funding": [
|
||||
{
|
||||
@ -3835,23 +3835,23 @@
|
||||
},
|
||||
{
|
||||
"name": "symfony\/process",
|
||||
"version": "v6.0.2",
|
||||
"version_normalized": "6.0.2.0",
|
||||
"version": "v6.0.3",
|
||||
"version_normalized": "6.0.3.0",
|
||||
"source": {
|
||||
"type": "git",
|
||||
"url": "https:\/\/github.com\/symfony\/process.git",
|
||||
"reference": "71da2b7f3fdba460fcf61a97c8d3d14bbf3391ad"
|
||||
"reference": "298ed357274c1868c20a0061df256a1250a6c4af"
|
||||
},
|
||||
"dist": {
|
||||
"type": "zip",
|
||||
"url": "https:\/\/api.github.com\/repos\/symfony\/process\/zipball\/71da2b7f3fdba460fcf61a97c8d3d14bbf3391ad",
|
||||
"reference": "71da2b7f3fdba460fcf61a97c8d3d14bbf3391ad",
|
||||
"url": "https:\/\/api.github.com\/repos\/symfony\/process\/zipball\/298ed357274c1868c20a0061df256a1250a6c4af",
|
||||
"reference": "298ed357274c1868c20a0061df256a1250a6c4af",
|
||||
"shasum": ""
|
||||
},
|
||||
"require": {
|
||||
"php": ">=8.0.2"
|
||||
},
|
||||
"time": "2021-12-27T21:05:08+00:00",
|
||||
"time": "2022-01-26T17:23:29+00:00",
|
||||
"type": "library",
|
||||
"installation-source": "dist",
|
||||
"autoload": {
|
||||
@ -3879,7 +3879,7 @@
|
||||
"description": "Executes commands in sub-processes",
|
||||
"homepage": "https:\/\/symfony.com",
|
||||
"support": {
|
||||
"source": "https:\/\/github.com\/symfony\/process\/tree\/v6.0.2"
|
||||
"source": "https:\/\/github.com\/symfony\/process\/tree\/v6.0.3"
|
||||
},
|
||||
"funding": [
|
||||
{
|
||||
@ -3899,17 +3899,17 @@
|
||||
},
|
||||
{
|
||||
"name": "symfony\/string",
|
||||
"version": "v6.0.2",
|
||||
"version_normalized": "6.0.2.0",
|
||||
"version": "v6.0.3",
|
||||
"version_normalized": "6.0.3.0",
|
||||
"source": {
|
||||
"type": "git",
|
||||
"url": "https:\/\/github.com\/symfony\/string.git",
|
||||
"reference": "bae261d0c3ac38a1f802b4dfed42094296100631"
|
||||
"reference": "522144f0c4c004c80d56fa47e40e17028e2eefc2"
|
||||
},
|
||||
"dist": {
|
||||
"type": "zip",
|
||||
"url": "https:\/\/api.github.com\/repos\/symfony\/string\/zipball\/bae261d0c3ac38a1f802b4dfed42094296100631",
|
||||
"reference": "bae261d0c3ac38a1f802b4dfed42094296100631",
|
||||
"url": "https:\/\/api.github.com\/repos\/symfony\/string\/zipball\/522144f0c4c004c80d56fa47e40e17028e2eefc2",
|
||||
"reference": "522144f0c4c004c80d56fa47e40e17028e2eefc2",
|
||||
"shasum": ""
|
||||
},
|
||||
"require": {
|
||||
@ -3928,7 +3928,7 @@
|
||||
"symfony\/translation-contracts": "^2.0|^3.0",
|
||||
"symfony\/var-exporter": "^5.4|^6.0"
|
||||
},
|
||||
"time": "2021-12-16T22:13:01+00:00",
|
||||
"time": "2022-01-02T09:55:41+00:00",
|
||||
"type": "library",
|
||||
"installation-source": "dist",
|
||||
"autoload": {
|
||||
@ -3967,7 +3967,7 @@
|
||||
"utf8"
|
||||
],
|
||||
"support": {
|
||||
"source": "https:\/\/github.com\/symfony\/string\/tree\/v6.0.2"
|
||||
"source": "https:\/\/github.com\/symfony\/string\/tree\/v6.0.3"
|
||||
},
|
||||
"funding": [
|
||||
{
|
||||
@ -3987,17 +3987,17 @@
|
||||
},
|
||||
{
|
||||
"name": "symfony\/yaml",
|
||||
"version": "v5.4.2",
|
||||
"version_normalized": "5.4.2.0",
|
||||
"version": "v5.4.3",
|
||||
"version_normalized": "5.4.3.0",
|
||||
"source": {
|
||||
"type": "git",
|
||||
"url": "https:\/\/github.com\/symfony\/yaml.git",
|
||||
"reference": "b9eb163846a61bb32dfc147f7859e274fab38b58"
|
||||
"reference": "e80f87d2c9495966768310fc531b487ce64237a2"
|
||||
},
|
||||
"dist": {
|
||||
"type": "zip",
|
||||
"url": "https:\/\/api.github.com\/repos\/symfony\/yaml\/zipball\/b9eb163846a61bb32dfc147f7859e274fab38b58",
|
||||
"reference": "b9eb163846a61bb32dfc147f7859e274fab38b58",
|
||||
"url": "https:\/\/api.github.com\/repos\/symfony\/yaml\/zipball\/e80f87d2c9495966768310fc531b487ce64237a2",
|
||||
"reference": "e80f87d2c9495966768310fc531b487ce64237a2",
|
||||
"shasum": ""
|
||||
},
|
||||
"require": {
|
||||
@ -4014,7 +4014,7 @@
|
||||
"suggest": {
|
||||
"symfony\/console": "For validating YAML files using the lint command"
|
||||
},
|
||||
"time": "2021-12-16T21:58:21+00:00",
|
||||
"time": "2022-01-26T16:32:32+00:00",
|
||||
"bin": [
|
||||
"Resources\/bin\/yaml-lint"
|
||||
],
|
||||
@ -4045,7 +4045,7 @@
|
||||
"description": "Loads and dumps YAML files",
|
||||
"homepage": "https:\/\/symfony.com",
|
||||
"support": {
|
||||
"source": "https:\/\/github.com\/symfony\/yaml\/tree\/v5.4.2"
|
||||
"source": "https:\/\/github.com\/symfony\/yaml\/tree\/v5.4.3"
|
||||
},
|
||||
"funding": [
|
||||
{
|
||||
|
2
vendor/composer/installed.php
vendored
2
vendor/composer/installed.php
vendored
File diff suppressed because one or more lines are too long
10
vendor/scoper-autoload.php
vendored
10
vendor/scoper-autoload.php
vendored
@ -9,8 +9,8 @@ $loader = require_once __DIR__.'/autoload.php';
|
||||
if (!class_exists('AutoloadIncluder', false) && !interface_exists('AutoloadIncluder', false) && !trait_exists('AutoloadIncluder', false)) {
|
||||
spl_autoload_call('RectorPrefix20220128\AutoloadIncluder');
|
||||
}
|
||||
if (!class_exists('ComposerAutoloaderInit91c87b5f78a348c1eeced48483150f0c', false) && !interface_exists('ComposerAutoloaderInit91c87b5f78a348c1eeced48483150f0c', false) && !trait_exists('ComposerAutoloaderInit91c87b5f78a348c1eeced48483150f0c', false)) {
|
||||
spl_autoload_call('RectorPrefix20220128\ComposerAutoloaderInit91c87b5f78a348c1eeced48483150f0c');
|
||||
if (!class_exists('ComposerAutoloaderInit7ed4d0b806593520bbd214577c57fa63', false) && !interface_exists('ComposerAutoloaderInit7ed4d0b806593520bbd214577c57fa63', false) && !trait_exists('ComposerAutoloaderInit7ed4d0b806593520bbd214577c57fa63', false)) {
|
||||
spl_autoload_call('RectorPrefix20220128\ComposerAutoloaderInit7ed4d0b806593520bbd214577c57fa63');
|
||||
}
|
||||
if (!class_exists('Helmich\TypoScriptParser\Parser\AST\Statement', false) && !interface_exists('Helmich\TypoScriptParser\Parser\AST\Statement', false) && !trait_exists('Helmich\TypoScriptParser\Parser\AST\Statement', false)) {
|
||||
spl_autoload_call('RectorPrefix20220128\Helmich\TypoScriptParser\Parser\AST\Statement');
|
||||
@ -71,9 +71,9 @@ if (!function_exists('print_node')) {
|
||||
return \RectorPrefix20220128\print_node(...func_get_args());
|
||||
}
|
||||
}
|
||||
if (!function_exists('composerRequire91c87b5f78a348c1eeced48483150f0c')) {
|
||||
function composerRequire91c87b5f78a348c1eeced48483150f0c() {
|
||||
return \RectorPrefix20220128\composerRequire91c87b5f78a348c1eeced48483150f0c(...func_get_args());
|
||||
if (!function_exists('composerRequire7ed4d0b806593520bbd214577c57fa63')) {
|
||||
function composerRequire7ed4d0b806593520bbd214577c57fa63() {
|
||||
return \RectorPrefix20220128\composerRequire7ed4d0b806593520bbd214577c57fa63(...func_get_args());
|
||||
}
|
||||
}
|
||||
if (!function_exists('scanPath')) {
|
||||
|
@ -85,7 +85,7 @@ class ExprBuilder
|
||||
/**
|
||||
* Tests if the value is empty.
|
||||
*
|
||||
* @return ExprBuilder
|
||||
* @return $this
|
||||
*/
|
||||
public function ifEmpty()
|
||||
{
|
||||
|
2
vendor/symfony/config/LICENSE
vendored
2
vendor/symfony/config/LICENSE
vendored
@ -1,4 +1,4 @@
|
||||
Copyright (c) 2004-2021 Fabien Potencier
|
||||
Copyright (c) 2004-2022 Fabien Potencier
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
of this software and associated documentation files (the "Software"), to deal
|
||||
|
8
vendor/symfony/console/Application.php
vendored
8
vendor/symfony/console/Application.php
vendored
@ -831,6 +831,14 @@ class Application implements \RectorPrefix20220128\Symfony\Contracts\Service\Res
|
||||
if (!$this->signalRegistry) {
|
||||
throw new \RectorPrefix20220128\Symfony\Component\Console\Exception\RuntimeException('Unable to subscribe to signal events. Make sure that the `pcntl` extension is installed and that "pcntl_*" functions are not disabled by your php.ini\'s "disable_functions" directive.');
|
||||
}
|
||||
if (\RectorPrefix20220128\Symfony\Component\Console\Terminal::hasSttyAvailable()) {
|
||||
$sttyMode = \shell_exec('stty -g');
|
||||
foreach ([\SIGINT, \SIGTERM] as $signal) {
|
||||
$this->signalRegistry->register($signal, static function () use($sttyMode) {
|
||||
\shell_exec('stty ' . $sttyMode);
|
||||
});
|
||||
}
|
||||
}
|
||||
if ($this->dispatcher) {
|
||||
foreach ($this->signalsToDispatchEvent as $signal) {
|
||||
$event = new \RectorPrefix20220128\Symfony\Component\Console\Event\ConsoleSignalEvent($command, $input, $output, $signal);
|
||||
|
@ -36,11 +36,11 @@ class OutputFormatter implements \RectorPrefix20220128\Symfony\Component\Console
|
||||
}
|
||||
}
|
||||
/**
|
||||
* Escapes "<" special char in given text.
|
||||
* Escapes "<" and ">" special chars in given text.
|
||||
*/
|
||||
public static function escape(string $text) : string
|
||||
{
|
||||
$text = \preg_replace('/([^\\\\]?)</', '$1\\<', $text);
|
||||
$text = \preg_replace('/([^\\\\]|^)([<>])/', '$1\\\\$2', $text);
|
||||
return self::escapeTrailingBackslash($text);
|
||||
}
|
||||
/**
|
||||
@ -127,9 +127,10 @@ class OutputFormatter implements \RectorPrefix20220128\Symfony\Component\Console
|
||||
{
|
||||
$offset = 0;
|
||||
$output = '';
|
||||
$tagRegex = '[a-z][^<>]*+';
|
||||
$openTagRegex = '[a-z](?:[^\\\\<>]*+ | \\\\.)*';
|
||||
$closeTagRegex = '[a-z][^<>]*+';
|
||||
$currentLineLength = 0;
|
||||
\preg_match_all("#<(({$tagRegex}) | /({$tagRegex})?)>#ix", $message, $matches, \PREG_OFFSET_CAPTURE);
|
||||
\preg_match_all("#<(({$openTagRegex}) | /({$closeTagRegex})?)>#ix", $message, $matches, \PREG_OFFSET_CAPTURE);
|
||||
foreach ($matches[0] as $i => $match) {
|
||||
$pos = $match[1];
|
||||
$text = $match[0];
|
||||
@ -157,10 +158,7 @@ class OutputFormatter implements \RectorPrefix20220128\Symfony\Component\Console
|
||||
}
|
||||
}
|
||||
$output .= $this->applyCurrentStyle(\substr($message, $offset), $output, $width, $currentLineLength);
|
||||
if (\strpos($output, "\0") !== \false) {
|
||||
return \strtr($output, ["\0" => '\\', '\\<' => '<']);
|
||||
}
|
||||
return \str_replace('\\<', '<', $output);
|
||||
return \strtr($output, ["\0" => '\\', '\\<' => '<', '\\>' => '>']);
|
||||
}
|
||||
public function getStyleStack() : \RectorPrefix20220128\Symfony\Component\Console\Formatter\OutputFormatterStyleStack
|
||||
{
|
||||
@ -186,7 +184,8 @@ class OutputFormatter implements \RectorPrefix20220128\Symfony\Component\Console
|
||||
} elseif ('bg' == $match[0]) {
|
||||
$style->setBackground(\strtolower($match[1]));
|
||||
} elseif ('href' === $match[0]) {
|
||||
$style->setHref($match[1]);
|
||||
$url = \preg_replace('{\\\\([<>])}', '$1', $match[1]);
|
||||
$style->setHref($url);
|
||||
} elseif ('options' === $match[0]) {
|
||||
\preg_match_all('([^,;]+)', \strtolower($match[1]), $options);
|
||||
$options = \array_shift($options);
|
||||
|
17
vendor/symfony/console/Helper/QuestionHelper.php
vendored
17
vendor/symfony/console/Helper/QuestionHelper.php
vendored
@ -212,16 +212,23 @@ class QuestionHelper extends \RectorPrefix20220128\Symfony\Component\Console\Hel
|
||||
$matches = $autocomplete($ret);
|
||||
$numMatches = \count($matches);
|
||||
$sttyMode = \shell_exec('stty -g');
|
||||
$isStdin = 'php://stdin' === (\stream_get_meta_data($inputStream)['uri'] ?? null);
|
||||
$r = [$inputStream];
|
||||
$w = [];
|
||||
// Disable icanon (so we can fread each keypress) and echo (we'll do echoing here instead)
|
||||
\shell_exec('stty -icanon -echo');
|
||||
// Add highlighted text style
|
||||
$output->getFormatter()->setStyle('hl', new \RectorPrefix20220128\Symfony\Component\Console\Formatter\OutputFormatterStyle('black', 'white'));
|
||||
// Read a keypress
|
||||
while (!\feof($inputStream)) {
|
||||
while ($isStdin && 0 === @\stream_select($r, $w, $w, 0, 100)) {
|
||||
// Give signal handlers a chance to run
|
||||
$r = [$inputStream];
|
||||
}
|
||||
$c = \fread($inputStream, 1);
|
||||
// as opposed to fgets(), fread() returns an empty string when the stream content is empty, not false.
|
||||
if (\false === $c || '' === $ret && '' === $c && null === $question->getDefault()) {
|
||||
\shell_exec(\sprintf('stty %s', $sttyMode));
|
||||
\shell_exec('stty ' . $sttyMode);
|
||||
throw new \RectorPrefix20220128\Symfony\Component\Console\Exception\MissingInputException('Aborted.');
|
||||
} elseif ("" === $c) {
|
||||
// Backspace Character
|
||||
@ -306,7 +313,7 @@ class QuestionHelper extends \RectorPrefix20220128\Symfony\Component\Console\Hel
|
||||
}
|
||||
}
|
||||
// Reset stty so it behaves normally again
|
||||
\shell_exec(\sprintf('stty %s', $sttyMode));
|
||||
\shell_exec('stty ' . $sttyMode);
|
||||
return $fullChoice;
|
||||
}
|
||||
private function mostRecentlyEnteredValue(string $entered) : string
|
||||
@ -355,7 +362,7 @@ class QuestionHelper extends \RectorPrefix20220128\Symfony\Component\Console\Hel
|
||||
}
|
||||
$value = \fgets($inputStream, 4096);
|
||||
if (self::$stty && \RectorPrefix20220128\Symfony\Component\Console\Terminal::hasSttyAvailable()) {
|
||||
\shell_exec(\sprintf('stty %s', $sttyMode));
|
||||
\shell_exec('stty ' . $sttyMode);
|
||||
}
|
||||
if (\false === $value) {
|
||||
throw new \RectorPrefix20220128\Symfony\Component\Console\Exception\MissingInputException('Aborted.');
|
||||
@ -400,10 +407,10 @@ class QuestionHelper extends \RectorPrefix20220128\Symfony\Component\Console\Hel
|
||||
return self::$stdinIsInteractive;
|
||||
}
|
||||
if (\function_exists('stream_isatty')) {
|
||||
return self::$stdinIsInteractive = \stream_isatty(\fopen('php://stdin', 'r'));
|
||||
return self::$stdinIsInteractive = @\stream_isatty(\fopen('php://stdin', 'r'));
|
||||
}
|
||||
if (\function_exists('posix_isatty')) {
|
||||
return self::$stdinIsInteractive = \posix_isatty(\fopen('php://stdin', 'r'));
|
||||
return self::$stdinIsInteractive = @\posix_isatty(\fopen('php://stdin', 'r'));
|
||||
}
|
||||
if (!\function_exists('exec')) {
|
||||
return self::$stdinIsInteractive = \true;
|
||||
|
21
vendor/symfony/console/Input/StringInput.php
vendored
21
vendor/symfony/console/Input/StringInput.php
vendored
@ -22,7 +22,7 @@ use RectorPrefix20220128\Symfony\Component\Console\Exception\InvalidArgumentExce
|
||||
*/
|
||||
class StringInput extends \RectorPrefix20220128\Symfony\Component\Console\Input\ArgvInput
|
||||
{
|
||||
public const REGEX_STRING = '([^\\s]+?)(?:\\s|(?<!\\\\)"|(?<!\\\\)\'|$)';
|
||||
public const REGEX_STRING = '([^\\s\\\\]+?)';
|
||||
public const REGEX_QUOTED_STRING = '(?:"([^"\\\\]*(?:\\\\.[^"\\\\]*)*)"|\'([^\'\\\\]*(?:\\\\.[^\'\\\\]*)*)\')';
|
||||
/**
|
||||
* @param string $input A string representing the parameters from the CLI
|
||||
@ -42,20 +42,33 @@ class StringInput extends \RectorPrefix20220128\Symfony\Component\Console\Input\
|
||||
$tokens = [];
|
||||
$length = \strlen($input);
|
||||
$cursor = 0;
|
||||
$token = null;
|
||||
while ($cursor < $length) {
|
||||
if ('\\' === $input[$cursor]) {
|
||||
$token .= $input[++$cursor] ?? '';
|
||||
++$cursor;
|
||||
continue;
|
||||
}
|
||||
if (\preg_match('/\\s+/A', $input, $match, 0, $cursor)) {
|
||||
if (null !== $token) {
|
||||
$tokens[] = $token;
|
||||
$token = null;
|
||||
}
|
||||
} elseif (\preg_match('/([^="\'\\s]+?)(=?)(' . self::REGEX_QUOTED_STRING . '+)/A', $input, $match, 0, $cursor)) {
|
||||
$tokens[] = $match[1] . $match[2] . \stripcslashes(\str_replace(['"\'', '\'"', '\'\'', '""'], '', \substr($match[3], 1, -1)));
|
||||
$token .= $match[1] . $match[2] . \stripcslashes(\str_replace(['"\'', '\'"', '\'\'', '""'], '', \substr($match[3], 1, -1)));
|
||||
} elseif (\preg_match('/' . self::REGEX_QUOTED_STRING . '/A', $input, $match, 0, $cursor)) {
|
||||
$tokens[] = \stripcslashes(\substr($match[0], 1, -1));
|
||||
$token .= \stripcslashes(\substr($match[0], 1, -1));
|
||||
} elseif (\preg_match('/' . self::REGEX_STRING . '/A', $input, $match, 0, $cursor)) {
|
||||
$tokens[] = \stripcslashes($match[1]);
|
||||
$token .= $match[1];
|
||||
} else {
|
||||
// should never happen
|
||||
throw new \RectorPrefix20220128\Symfony\Component\Console\Exception\InvalidArgumentException(\sprintf('Unable to parse input near "... %s ...".', \substr($input, $cursor, 10)));
|
||||
}
|
||||
$cursor += \strlen($match[0]);
|
||||
}
|
||||
if (null !== $token) {
|
||||
$tokens[] = $token;
|
||||
}
|
||||
return $tokens;
|
||||
}
|
||||
}
|
||||
|
2
vendor/symfony/console/LICENSE
vendored
2
vendor/symfony/console/LICENSE
vendored
@ -1,4 +1,4 @@
|
||||
Copyright (c) 2004-2021 Fabien Potencier
|
||||
Copyright (c) 2004-2022 Fabien Potencier
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
of this software and associated documentation files (the "Software"), to deal
|
||||
|
@ -129,13 +129,18 @@ class ConsoleOutput extends \RectorPrefix20220128\Symfony\Component\Console\Outp
|
||||
if (!$this->hasStdoutSupport()) {
|
||||
return \fopen('php://output', 'w');
|
||||
}
|
||||
return @\fopen('php://stdout', 'w') ?: \fopen('php://output', 'w');
|
||||
// Use STDOUT when possible to prevent from opening too many file descriptors
|
||||
return \defined('STDOUT') ? \STDOUT : (@\fopen('php://stdout', 'w') ?: \fopen('php://output', 'w'));
|
||||
}
|
||||
/**
|
||||
* @return resource
|
||||
*/
|
||||
private function openErrorStream()
|
||||
{
|
||||
return \fopen($this->hasStderrSupport() ? 'php://stderr' : 'php://output', 'w');
|
||||
if (!$this->hasStderrSupport()) {
|
||||
return \fopen('php://output', 'w');
|
||||
}
|
||||
// Use STDERR when possible to prevent from opening too many file descriptors
|
||||
return \defined('STDERR') ? \STDERR : (@\fopen('php://stderr', 'w') ?: \fopen('php://output', 'w'));
|
||||
}
|
||||
}
|
||||
|
@ -115,16 +115,16 @@ class ChoiceQuestion extends \RectorPrefix20220128\Symfony\Component\Console\Que
|
||||
return function ($selected) use($choices, $errorMessage, $multiselect, $isAssoc) {
|
||||
if ($multiselect) {
|
||||
// Check for a separated comma values
|
||||
if (!\preg_match('/^[^,]+(?:,[^,]+)*$/', $selected, $matches)) {
|
||||
if (!\preg_match('/^[^,]+(?:,[^,]+)*$/', (string) $selected, $matches)) {
|
||||
throw new \RectorPrefix20220128\Symfony\Component\Console\Exception\InvalidArgumentException(\sprintf($errorMessage, $selected));
|
||||
}
|
||||
$selectedChoices = \explode(',', $selected);
|
||||
$selectedChoices = \explode(',', (string) $selected);
|
||||
} else {
|
||||
$selectedChoices = [$selected];
|
||||
}
|
||||
if ($this->isTrimmable()) {
|
||||
foreach ($selectedChoices as $k => $v) {
|
||||
$selectedChoices[$k] = \trim($v);
|
||||
$selectedChoices[$k] = \trim((string) $v);
|
||||
}
|
||||
}
|
||||
$multiselectChoices = [];
|
||||
|
@ -160,6 +160,9 @@ final class CheckTypeDeclarationsPass extends \RectorPrefix20220128\Symfony\Comp
|
||||
}
|
||||
$class = null;
|
||||
if ($value instanceof \RectorPrefix20220128\Symfony\Component\DependencyInjection\Definition) {
|
||||
if ($value->getFactory()) {
|
||||
return;
|
||||
}
|
||||
$class = $value->getClass();
|
||||
if ($class && isset(self::BUILTIN_TYPES[\strtolower($class)])) {
|
||||
$class = \strtolower($class);
|
||||
|
@ -106,7 +106,7 @@ class ResolveBindingsPass extends \RectorPrefix20220128\Symfony\Component\Depend
|
||||
} elseif (!isset($this->usedBindings[$bindingId])) {
|
||||
$this->unusedBindings[$bindingId] = [$key, $this->currentId, $bindingType, $file];
|
||||
}
|
||||
if (\preg_match('/^(?:(?:array|bool|float|int|string|([^ $]++)) )\\$/', $key, $m)) {
|
||||
if (\preg_match('/^(?:(?:array|bool|float|int|string|iterable|([^ $]++)) )\\$/', $key, $m)) {
|
||||
$bindingNames[\substr($key, \strlen($m[0]))] = $binding;
|
||||
}
|
||||
if (!isset($m[1])) {
|
||||
|
@ -101,6 +101,7 @@ class ResolveChildDefinitionsPass extends \RectorPrefix20220128\Symfony\Componen
|
||||
$def->setAutowired($parentDef->isAutowired());
|
||||
$def->setChanges($parentDef->getChanges());
|
||||
$def->setBindings($definition->getBindings() + $parentDef->getBindings());
|
||||
$def->setSynthetic($definition->isSynthetic());
|
||||
// overwrite with values specified in the decorator
|
||||
$changes = $definition->getChanges();
|
||||
if (isset($changes['class'])) {
|
||||
|
@ -1205,7 +1205,7 @@ class ContainerBuilder extends \RectorPrefix20220128\Symfony\Component\Dependenc
|
||||
}
|
||||
return $result;
|
||||
}
|
||||
if (!\is_string($value) || 38 > \strlen($value)) {
|
||||
if (!\is_string($value) || 38 > \strlen($value) || !\preg_match('/env[_(]/i', $value)) {
|
||||
return $value;
|
||||
}
|
||||
$envPlaceholders = $bag instanceof \RectorPrefix20220128\Symfony\Component\DependencyInjection\ParameterBag\EnvPlaceholderParameterBag ? $bag->getEnvPlaceholders() : $this->envPlaceholders;
|
||||
|
@ -201,11 +201,15 @@ class EnvVarProcessor implements \RectorPrefix20220128\Symfony\Component\Depende
|
||||
return $result;
|
||||
}
|
||||
if ('resolve' === $prefix) {
|
||||
return \preg_replace_callback('/%%|%([^%\\s]+)%/', function ($match) use($name) {
|
||||
return \preg_replace_callback('/%%|%([^%\\s]+)%/', function ($match) use($name, $getEnv) {
|
||||
if (!isset($match[1])) {
|
||||
return '%';
|
||||
}
|
||||
if (\strncmp($match[1], 'env(', \strlen('env(')) === 0 && \substr_compare($match[1], ')', -\strlen(')')) === 0 && 'env()' !== $match[1]) {
|
||||
$value = $getEnv(\substr($match[1], 4, -1));
|
||||
} else {
|
||||
$value = $this->container->getParameter($match[1]);
|
||||
}
|
||||
if (!\is_scalar($value)) {
|
||||
throw new \RectorPrefix20220128\Symfony\Component\DependencyInjection\Exception\RuntimeException(\sprintf('Parameter "%s" found when resolving env var "%s" must be scalar, "%s" given.', $match[1], $name, \get_debug_type($value)));
|
||||
}
|
||||
|
2
vendor/symfony/dependency-injection/LICENSE
vendored
2
vendor/symfony/dependency-injection/LICENSE
vendored
@ -1,4 +1,4 @@
|
||||
Copyright (c) 2004-2021 Fabien Potencier
|
||||
Copyright (c) 2004-2022 Fabien Potencier
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
of this software and associated documentation files (the "Software"), to deal
|
||||
|
@ -11,10 +11,8 @@
|
||||
namespace RectorPrefix20220128\Symfony\Component\DependencyInjection\Loader\Configurator\Traits;
|
||||
|
||||
use RectorPrefix20220128\Symfony\Component\DependencyInjection\Argument\BoundArgument;
|
||||
use RectorPrefix20220128\Symfony\Component\DependencyInjection\Exception\InvalidArgumentException;
|
||||
use RectorPrefix20220128\Symfony\Component\DependencyInjection\Loader\Configurator\DefaultsConfigurator;
|
||||
use RectorPrefix20220128\Symfony\Component\DependencyInjection\Loader\Configurator\InstanceofConfigurator;
|
||||
use RectorPrefix20220128\Symfony\Component\DependencyInjection\Reference;
|
||||
trait BindTrait
|
||||
{
|
||||
/**
|
||||
@ -32,9 +30,6 @@ trait BindTrait
|
||||
public final function bind(string $nameOrFqcn, $valueOrRef) : self
|
||||
{
|
||||
$valueOrRef = static::processValue($valueOrRef, \true);
|
||||
if (!\preg_match('/^(?:(?:array|bool|float|int|string|iterable)[ \\t]*+)?\\$/', $nameOrFqcn) && !$valueOrRef instanceof \RectorPrefix20220128\Symfony\Component\DependencyInjection\Reference) {
|
||||
throw new \RectorPrefix20220128\Symfony\Component\DependencyInjection\Exception\InvalidArgumentException(\sprintf('Invalid binding for service "%s": named arguments must start with a "$", and FQCN must map to references. Neither applies to binding "%s".', $this->id, $nameOrFqcn));
|
||||
}
|
||||
$bindings = $this->definition->getBindings();
|
||||
$type = $this instanceof \RectorPrefix20220128\Symfony\Component\DependencyInjection\Loader\Configurator\DefaultsConfigurator ? \RectorPrefix20220128\Symfony\Component\DependencyInjection\Argument\BoundArgument::DEFAULTS_BINDING : ($this instanceof \RectorPrefix20220128\Symfony\Component\DependencyInjection\Loader\Configurator\InstanceofConfigurator ? \RectorPrefix20220128\Symfony\Component\DependencyInjection\Argument\BoundArgument::INSTANCEOF_BINDING : \RectorPrefix20220128\Symfony\Component\DependencyInjection\Argument\BoundArgument::SERVICE_BINDING);
|
||||
$bindings[$nameOrFqcn] = new \RectorPrefix20220128\Symfony\Component\DependencyInjection\Argument\BoundArgument($valueOrRef, \true, $type, $this->path ?? null);
|
||||
|
@ -47,7 +47,6 @@ final class VcsIgnoredFilterIterator extends \FilterIterator
|
||||
$ignored = \false;
|
||||
foreach ($this->parentsDirectoryDownward($fileRealPath) as $parentDirectory) {
|
||||
if ($this->isIgnored($parentDirectory)) {
|
||||
$ignored = \true;
|
||||
// rules in ignored directories are ignored, no need to check further.
|
||||
break;
|
||||
}
|
||||
|
2
vendor/symfony/finder/LICENSE
vendored
2
vendor/symfony/finder/LICENSE
vendored
@ -1,4 +1,4 @@
|
||||
Copyright (c) 2004-2021 Fabien Potencier
|
||||
Copyright (c) 2004-2022 Fabien Potencier
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
of this software and associated documentation files (the "Software"), to deal
|
||||
|
2
vendor/symfony/process/LICENSE
vendored
2
vendor/symfony/process/LICENSE
vendored
@ -1,4 +1,4 @@
|
||||
Copyright (c) 2004-2021 Fabien Potencier
|
||||
Copyright (c) 2004-2022 Fabien Potencier
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
of this software and associated documentation files (the "Software"), to deal
|
||||
|
@ -45,8 +45,10 @@ abstract class AbstractPipes implements \RectorPrefix20220128\Symfony\Component\
|
||||
public function close()
|
||||
{
|
||||
foreach ($this->pipes as $pipe) {
|
||||
if (\is_resource($pipe)) {
|
||||
\fclose($pipe);
|
||||
}
|
||||
}
|
||||
$this->pipes = [];
|
||||
}
|
||||
/**
|
||||
|
2
vendor/symfony/string/LICENSE
vendored
2
vendor/symfony/string/LICENSE
vendored
@ -1,4 +1,4 @@
|
||||
Copyright (c) 2019-2021 Fabien Potencier
|
||||
Copyright (c) 2019-2022 Fabien Potencier
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
of this software and associated documentation files (the "Software"), to deal
|
||||
|
12
vendor/symfony/yaml/Inline.php
vendored
12
vendor/symfony/yaml/Inline.php
vendored
@ -556,19 +556,15 @@ class Inline
|
||||
return (float) \substr($scalar, 8);
|
||||
case 0 === \strpos($scalar, '!!binary '):
|
||||
return self::evaluateBinaryScalar(\substr($scalar, 9));
|
||||
default:
|
||||
throw new \RectorPrefix20220128\Symfony\Component\Yaml\Exception\ParseException(\sprintf('The string "%s" could not be parsed as it uses an unsupported built-in tag.', $scalar), self::$parsedLineNumber, $scalar, self::$parsedFilename);
|
||||
}
|
||||
// no break
|
||||
throw new \RectorPrefix20220128\Symfony\Component\Yaml\Exception\ParseException(\sprintf('The string "%s" could not be parsed as it uses an unsupported built-in tag.', $scalar), self::$parsedLineNumber, $scalar, self::$parsedFilename);
|
||||
case \preg_match('/^(?:\\+|-)?0o(?P<value>[0-7_]++)$/', $scalar, $matches):
|
||||
$value = \str_replace('_', '', $matches['value']);
|
||||
if ('-' === $scalar[0]) {
|
||||
return -\octdec($value);
|
||||
} else {
|
||||
return \octdec($value);
|
||||
}
|
||||
return \octdec($value);
|
||||
// Optimize for returning strings.
|
||||
// no break
|
||||
case \in_array($scalar[0], ['+', '-', '.'], \true) || \is_numeric($scalar[0]):
|
||||
if (\RectorPrefix20220128\Symfony\Component\Yaml\Parser::preg_match('{^[+-]?[0-9][0-9_]*$}', $scalar)) {
|
||||
$scalar = \str_replace('_', '', $scalar);
|
||||
@ -576,14 +572,14 @@ class Inline
|
||||
switch (\true) {
|
||||
case \ctype_digit($scalar):
|
||||
if (\preg_match('/^0[0-7]+$/', $scalar)) {
|
||||
trigger_deprecation('symfony/yaml', '5.1', 'Support for parsing numbers prefixed with 0 as octal numbers. They will be parsed as strings as of 6.0.');
|
||||
trigger_deprecation('symfony/yaml', '5.1', 'Support for parsing numbers prefixed with 0 as octal numbers. They will be parsed as strings as of 6.0. Use "%s" to represent the octal number.', '0o' . \substr($scalar, 1));
|
||||
return \octdec($scalar);
|
||||
}
|
||||
$cast = (int) $scalar;
|
||||
return $scalar === (string) $cast ? $cast : $scalar;
|
||||
case '-' === $scalar[0] && \ctype_digit(\substr($scalar, 1)):
|
||||
if (\preg_match('/^-0[0-7]+$/', $scalar)) {
|
||||
trigger_deprecation('symfony/yaml', '5.1', 'Support for parsing numbers prefixed with 0 as octal numbers. They will be parsed as strings as of 6.0.');
|
||||
trigger_deprecation('symfony/yaml', '5.1', 'Support for parsing numbers prefixed with 0 as octal numbers. They will be parsed as strings as of 6.0. Use "%s" to represent the octal number.', '-0o' . \substr($scalar, 2));
|
||||
return -\octdec(\substr($scalar, 1));
|
||||
}
|
||||
$cast = (int) $scalar;
|
||||
|
2
vendor/symfony/yaml/LICENSE
vendored
2
vendor/symfony/yaml/LICENSE
vendored
@ -1,4 +1,4 @@
|
||||
Copyright (c) 2004-2021 Fabien Potencier
|
||||
Copyright (c) 2004-2022 Fabien Potencier
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
of this software and associated documentation files (the "Software"), to deal
|
||||
|
2
vendor/symfony/yaml/Parser.php
vendored
2
vendor/symfony/yaml/Parser.php
vendored
@ -87,6 +87,8 @@ class Parser
|
||||
if (null !== $mbEncoding) {
|
||||
\mb_internal_encoding($mbEncoding);
|
||||
}
|
||||
$this->refsBeingParsed = [];
|
||||
$this->offset = 0;
|
||||
$this->lines = [];
|
||||
$this->currentLine = '';
|
||||
$this->numberOfParsedLines = 0;
|
||||
|
Loading…
x
Reference in New Issue
Block a user