mirror of
https://github.com/rectorphp/rector.git
synced 2024-06-08 20:22:24 +00:00
Updated Rector to commit b84fe9524aa20e200f743f13f6925d93225c6280
b84fe9524a
[Php56] Reduce origNode check on UndefinedVariableResolver (#4033)
This commit is contained in:
parent
17e8e0f374
commit
3342a558a3
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 ComposerAutoloaderInitaa7e2bb479e471e9f78c2d7a46b45331::getLoader();
|
||||
return ComposerAutoloaderInit0ea88f9b1da4440ccfa80f19914a6ed3::getLoader();
|
||||
|
|
1
vendor/composer/autoload_classmap.php
vendored
1
vendor/composer/autoload_classmap.php
vendored
|
@ -748,6 +748,7 @@ return array(
|
|||
'RectorPrefix202305\\Symfony\\Component\\Console\\Descriptor\\DescriptorInterface' => $vendorDir . '/symfony/console/Descriptor/DescriptorInterface.php',
|
||||
'RectorPrefix202305\\Symfony\\Component\\Console\\Descriptor\\JsonDescriptor' => $vendorDir . '/symfony/console/Descriptor/JsonDescriptor.php',
|
||||
'RectorPrefix202305\\Symfony\\Component\\Console\\Descriptor\\MarkdownDescriptor' => $vendorDir . '/symfony/console/Descriptor/MarkdownDescriptor.php',
|
||||
'RectorPrefix202305\\Symfony\\Component\\Console\\Descriptor\\ReStructuredTextDescriptor' => $vendorDir . '/symfony/console/Descriptor/ReStructuredTextDescriptor.php',
|
||||
'RectorPrefix202305\\Symfony\\Component\\Console\\Descriptor\\TextDescriptor' => $vendorDir . '/symfony/console/Descriptor/TextDescriptor.php',
|
||||
'RectorPrefix202305\\Symfony\\Component\\Console\\Descriptor\\XmlDescriptor' => $vendorDir . '/symfony/console/Descriptor/XmlDescriptor.php',
|
||||
'RectorPrefix202305\\Symfony\\Component\\Console\\Exception\\CommandNotFoundException' => $vendorDir . '/symfony/console/Exception/CommandNotFoundException.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 ComposerAutoloaderInitaa7e2bb479e471e9f78c2d7a46b45331
|
||||
class ComposerAutoloaderInit0ea88f9b1da4440ccfa80f19914a6ed3
|
||||
{
|
||||
private static $loader;
|
||||
|
||||
|
@ -22,17 +22,17 @@ class ComposerAutoloaderInitaa7e2bb479e471e9f78c2d7a46b45331
|
|||
return self::$loader;
|
||||
}
|
||||
|
||||
spl_autoload_register(array('ComposerAutoloaderInitaa7e2bb479e471e9f78c2d7a46b45331', 'loadClassLoader'), true, true);
|
||||
spl_autoload_register(array('ComposerAutoloaderInit0ea88f9b1da4440ccfa80f19914a6ed3', 'loadClassLoader'), true, true);
|
||||
self::$loader = $loader = new \Composer\Autoload\ClassLoader(\dirname(__DIR__));
|
||||
spl_autoload_unregister(array('ComposerAutoloaderInitaa7e2bb479e471e9f78c2d7a46b45331', 'loadClassLoader'));
|
||||
spl_autoload_unregister(array('ComposerAutoloaderInit0ea88f9b1da4440ccfa80f19914a6ed3', 'loadClassLoader'));
|
||||
|
||||
require __DIR__ . '/autoload_static.php';
|
||||
call_user_func(\Composer\Autoload\ComposerStaticInitaa7e2bb479e471e9f78c2d7a46b45331::getInitializer($loader));
|
||||
call_user_func(\Composer\Autoload\ComposerStaticInit0ea88f9b1da4440ccfa80f19914a6ed3::getInitializer($loader));
|
||||
|
||||
$loader->setClassMapAuthoritative(true);
|
||||
$loader->register(true);
|
||||
|
||||
$filesToLoad = \Composer\Autoload\ComposerStaticInitaa7e2bb479e471e9f78c2d7a46b45331::$files;
|
||||
$filesToLoad = \Composer\Autoload\ComposerStaticInit0ea88f9b1da4440ccfa80f19914a6ed3::$files;
|
||||
$requireFile = \Closure::bind(static function ($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 ComposerStaticInitaa7e2bb479e471e9f78c2d7a46b45331
|
||||
class ComposerStaticInit0ea88f9b1da4440ccfa80f19914a6ed3
|
||||
{
|
||||
public static $files = array (
|
||||
'ad155f8f1cf0d418fe49e248db8c661b' => __DIR__ . '/..' . '/react/promise/src/functions_include.php',
|
||||
|
@ -990,6 +990,7 @@ class ComposerStaticInitaa7e2bb479e471e9f78c2d7a46b45331
|
|||
'RectorPrefix202305\\Symfony\\Component\\Console\\Descriptor\\DescriptorInterface' => __DIR__ . '/..' . '/symfony/console/Descriptor/DescriptorInterface.php',
|
||||
'RectorPrefix202305\\Symfony\\Component\\Console\\Descriptor\\JsonDescriptor' => __DIR__ . '/..' . '/symfony/console/Descriptor/JsonDescriptor.php',
|
||||
'RectorPrefix202305\\Symfony\\Component\\Console\\Descriptor\\MarkdownDescriptor' => __DIR__ . '/..' . '/symfony/console/Descriptor/MarkdownDescriptor.php',
|
||||
'RectorPrefix202305\\Symfony\\Component\\Console\\Descriptor\\ReStructuredTextDescriptor' => __DIR__ . '/..' . '/symfony/console/Descriptor/ReStructuredTextDescriptor.php',
|
||||
'RectorPrefix202305\\Symfony\\Component\\Console\\Descriptor\\TextDescriptor' => __DIR__ . '/..' . '/symfony/console/Descriptor/TextDescriptor.php',
|
||||
'RectorPrefix202305\\Symfony\\Component\\Console\\Descriptor\\XmlDescriptor' => __DIR__ . '/..' . '/symfony/console/Descriptor/XmlDescriptor.php',
|
||||
'RectorPrefix202305\\Symfony\\Component\\Console\\Exception\\CommandNotFoundException' => __DIR__ . '/..' . '/symfony/console/Exception/CommandNotFoundException.php',
|
||||
|
@ -3067,9 +3068,9 @@ class ComposerStaticInitaa7e2bb479e471e9f78c2d7a46b45331
|
|||
public static function getInitializer(ClassLoader $loader)
|
||||
{
|
||||
return \Closure::bind(function () use ($loader) {
|
||||
$loader->prefixLengthsPsr4 = ComposerStaticInitaa7e2bb479e471e9f78c2d7a46b45331::$prefixLengthsPsr4;
|
||||
$loader->prefixDirsPsr4 = ComposerStaticInitaa7e2bb479e471e9f78c2d7a46b45331::$prefixDirsPsr4;
|
||||
$loader->classMap = ComposerStaticInitaa7e2bb479e471e9f78c2d7a46b45331::$classMap;
|
||||
$loader->prefixLengthsPsr4 = ComposerStaticInit0ea88f9b1da4440ccfa80f19914a6ed3::$prefixLengthsPsr4;
|
||||
$loader->prefixDirsPsr4 = ComposerStaticInit0ea88f9b1da4440ccfa80f19914a6ed3::$prefixDirsPsr4;
|
||||
$loader->classMap = ComposerStaticInit0ea88f9b1da4440ccfa80f19914a6ed3::$classMap;
|
||||
|
||||
}, null, ClassLoader::class);
|
||||
}
|
||||
|
|
108
vendor/composer/installed.json
vendored
108
vendor/composer/installed.json
vendored
|
@ -2194,39 +2194,37 @@
|
|||
},
|
||||
{
|
||||
"name": "symfony\/config",
|
||||
"version": "v6.2.7",
|
||||
"version_normalized": "6.2.7.0",
|
||||
"version": "v6.3.0",
|
||||
"version_normalized": "6.3.0.0",
|
||||
"source": {
|
||||
"type": "git",
|
||||
"url": "https:\/\/github.com\/symfony\/config.git",
|
||||
"reference": "249271da6f545d6579e0663374f8249a80be2893"
|
||||
"reference": "a5e00dec161b08c946a2c16eed02adbeedf827ae"
|
||||
},
|
||||
"dist": {
|
||||
"type": "zip",
|
||||
"url": "https:\/\/api.github.com\/repos\/symfony\/config\/zipball\/249271da6f545d6579e0663374f8249a80be2893",
|
||||
"reference": "249271da6f545d6579e0663374f8249a80be2893",
|
||||
"url": "https:\/\/api.github.com\/repos\/symfony\/config\/zipball\/a5e00dec161b08c946a2c16eed02adbeedf827ae",
|
||||
"reference": "a5e00dec161b08c946a2c16eed02adbeedf827ae",
|
||||
"shasum": ""
|
||||
},
|
||||
"require": {
|
||||
"php": ">=8.1",
|
||||
"symfony\/deprecation-contracts": "^2.1|^3",
|
||||
"symfony\/deprecation-contracts": "^2.5|^3",
|
||||
"symfony\/filesystem": "^5.4|^6.0",
|
||||
"symfony\/polyfill-ctype": "~1.8"
|
||||
},
|
||||
"conflict": {
|
||||
"symfony\/finder": "<5.4"
|
||||
"symfony\/finder": "<5.4",
|
||||
"symfony\/service-contracts": "<2.5"
|
||||
},
|
||||
"require-dev": {
|
||||
"symfony\/event-dispatcher": "^5.4|^6.0",
|
||||
"symfony\/finder": "^5.4|^6.0",
|
||||
"symfony\/messenger": "^5.4|^6.0",
|
||||
"symfony\/service-contracts": "^1.1|^2|^3",
|
||||
"symfony\/service-contracts": "^2.5|^3",
|
||||
"symfony\/yaml": "^5.4|^6.0"
|
||||
},
|
||||
"suggest": {
|
||||
"symfony\/yaml": "To use the yaml reference dumper"
|
||||
},
|
||||
"time": "2023-02-14T08:44:56+00:00",
|
||||
"time": "2023-04-25T10:46:17+00:00",
|
||||
"type": "library",
|
||||
"installation-source": "dist",
|
||||
"autoload": {
|
||||
|
@ -2254,7 +2252,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\/v6.2.7"
|
||||
"source": "https:\/\/github.com\/symfony\/config\/tree\/v6.3.0"
|
||||
},
|
||||
"funding": [
|
||||
{
|
||||
|
@ -2274,24 +2272,24 @@
|
|||
},
|
||||
{
|
||||
"name": "symfony\/console",
|
||||
"version": "v6.2.11",
|
||||
"version_normalized": "6.2.11.0",
|
||||
"version": "v6.3.0",
|
||||
"version_normalized": "6.3.0.0",
|
||||
"source": {
|
||||
"type": "git",
|
||||
"url": "https:\/\/github.com\/symfony\/console.git",
|
||||
"reference": "5aa03db8ef0a5457c316ec580e69562d97734c77"
|
||||
"reference": "8788808b07cf0bdd6e4b7fdd23d8ddb1470c83b7"
|
||||
},
|
||||
"dist": {
|
||||
"type": "zip",
|
||||
"url": "https:\/\/api.github.com\/repos\/symfony\/console\/zipball\/5aa03db8ef0a5457c316ec580e69562d97734c77",
|
||||
"reference": "5aa03db8ef0a5457c316ec580e69562d97734c77",
|
||||
"url": "https:\/\/api.github.com\/repos\/symfony\/console\/zipball\/8788808b07cf0bdd6e4b7fdd23d8ddb1470c83b7",
|
||||
"reference": "8788808b07cf0bdd6e4b7fdd23d8ddb1470c83b7",
|
||||
"shasum": ""
|
||||
},
|
||||
"require": {
|
||||
"php": ">=8.1",
|
||||
"symfony\/deprecation-contracts": "^2.1|^3",
|
||||
"symfony\/deprecation-contracts": "^2.5|^3",
|
||||
"symfony\/polyfill-mbstring": "~1.0",
|
||||
"symfony\/service-contracts": "^1.1|^2|^3",
|
||||
"symfony\/service-contracts": "^2.5|^3",
|
||||
"symfony\/string": "^5.4|^6.0"
|
||||
},
|
||||
"conflict": {
|
||||
|
@ -2313,13 +2311,7 @@
|
|||
"symfony\/process": "^5.4|^6.0",
|
||||
"symfony\/var-dumper": "^5.4|^6.0"
|
||||
},
|
||||
"suggest": {
|
||||
"psr\/log": "For using the console logger",
|
||||
"symfony\/event-dispatcher": "",
|
||||
"symfony\/lock": "",
|
||||
"symfony\/process": ""
|
||||
},
|
||||
"time": "2023-05-26T08:16:21+00:00",
|
||||
"time": "2023-05-29T12:49:39+00:00",
|
||||
"type": "library",
|
||||
"installation-source": "dist",
|
||||
"autoload": {
|
||||
|
@ -2353,7 +2345,7 @@
|
|||
"terminal"
|
||||
],
|
||||
"support": {
|
||||
"source": "https:\/\/github.com\/symfony\/console\/tree\/v6.2.11"
|
||||
"source": "https:\/\/github.com\/symfony\/console\/tree\/v6.3.0"
|
||||
},
|
||||
"funding": [
|
||||
{
|
||||
|
@ -2572,17 +2564,17 @@
|
|||
},
|
||||
{
|
||||
"name": "symfony\/filesystem",
|
||||
"version": "v6.2.10",
|
||||
"version_normalized": "6.2.10.0",
|
||||
"version": "v6.3.0",
|
||||
"version_normalized": "6.3.0.0",
|
||||
"source": {
|
||||
"type": "git",
|
||||
"url": "https:\/\/github.com\/symfony\/filesystem.git",
|
||||
"reference": "fd588debf7d1bc16a2c84b4b3b71145d9946b894"
|
||||
"reference": "97b698e1d77d356304def77a8d0cd73090b359ea"
|
||||
},
|
||||
"dist": {
|
||||
"type": "zip",
|
||||
"url": "https:\/\/api.github.com\/repos\/symfony\/filesystem\/zipball\/fd588debf7d1bc16a2c84b4b3b71145d9946b894",
|
||||
"reference": "fd588debf7d1bc16a2c84b4b3b71145d9946b894",
|
||||
"url": "https:\/\/api.github.com\/repos\/symfony\/filesystem\/zipball\/97b698e1d77d356304def77a8d0cd73090b359ea",
|
||||
"reference": "97b698e1d77d356304def77a8d0cd73090b359ea",
|
||||
"shasum": ""
|
||||
},
|
||||
"require": {
|
||||
|
@ -2590,7 +2582,7 @@
|
|||
"symfony\/polyfill-ctype": "~1.8",
|
||||
"symfony\/polyfill-mbstring": "~1.8"
|
||||
},
|
||||
"time": "2023-04-18T13:46:08+00:00",
|
||||
"time": "2023-05-30T17:12:32+00:00",
|
||||
"type": "library",
|
||||
"installation-source": "dist",
|
||||
"autoload": {
|
||||
|
@ -2618,7 +2610,7 @@
|
|||
"description": "Provides basic utilities for the filesystem",
|
||||
"homepage": "https:\/\/symfony.com",
|
||||
"support": {
|
||||
"source": "https:\/\/github.com\/symfony\/filesystem\/tree\/v6.2.10"
|
||||
"source": "https:\/\/github.com\/symfony\/filesystem\/tree\/v6.3.0"
|
||||
},
|
||||
"funding": [
|
||||
{
|
||||
|
@ -2638,17 +2630,17 @@
|
|||
},
|
||||
{
|
||||
"name": "symfony\/finder",
|
||||
"version": "v6.2.7",
|
||||
"version_normalized": "6.2.7.0",
|
||||
"version": "v6.3.0",
|
||||
"version_normalized": "6.3.0.0",
|
||||
"source": {
|
||||
"type": "git",
|
||||
"url": "https:\/\/github.com\/symfony\/finder.git",
|
||||
"reference": "20808dc6631aecafbe67c186af5dcb370be3a0eb"
|
||||
"reference": "d9b01ba073c44cef617c7907ce2419f8d00d75e2"
|
||||
},
|
||||
"dist": {
|
||||
"type": "zip",
|
||||
"url": "https:\/\/api.github.com\/repos\/symfony\/finder\/zipball\/20808dc6631aecafbe67c186af5dcb370be3a0eb",
|
||||
"reference": "20808dc6631aecafbe67c186af5dcb370be3a0eb",
|
||||
"url": "https:\/\/api.github.com\/repos\/symfony\/finder\/zipball\/d9b01ba073c44cef617c7907ce2419f8d00d75e2",
|
||||
"reference": "d9b01ba073c44cef617c7907ce2419f8d00d75e2",
|
||||
"shasum": ""
|
||||
},
|
||||
"require": {
|
||||
|
@ -2657,7 +2649,7 @@
|
|||
"require-dev": {
|
||||
"symfony\/filesystem": "^6.0"
|
||||
},
|
||||
"time": "2023-02-16T09:57:23+00:00",
|
||||
"time": "2023-04-02T01:25:41+00:00",
|
||||
"type": "library",
|
||||
"installation-source": "dist",
|
||||
"autoload": {
|
||||
|
@ -2685,7 +2677,7 @@
|
|||
"description": "Finds files and directories via an intuitive fluent interface",
|
||||
"homepage": "https:\/\/symfony.com",
|
||||
"support": {
|
||||
"source": "https:\/\/github.com\/symfony\/finder\/tree\/v6.2.7"
|
||||
"source": "https:\/\/github.com\/symfony\/finder\/tree\/v6.3.0"
|
||||
},
|
||||
"funding": [
|
||||
{
|
||||
|
@ -2878,23 +2870,23 @@
|
|||
},
|
||||
{
|
||||
"name": "symfony\/process",
|
||||
"version": "v6.2.11",
|
||||
"version_normalized": "6.2.11.0",
|
||||
"version": "v6.3.0",
|
||||
"version_normalized": "6.3.0.0",
|
||||
"source": {
|
||||
"type": "git",
|
||||
"url": "https:\/\/github.com\/symfony\/process.git",
|
||||
"reference": "97ae9721bead9d1a39b5650e2f4b7834b93b539c"
|
||||
"reference": "8741e3ed7fe2e91ec099e02446fb86667a0f1628"
|
||||
},
|
||||
"dist": {
|
||||
"type": "zip",
|
||||
"url": "https:\/\/api.github.com\/repos\/symfony\/process\/zipball\/97ae9721bead9d1a39b5650e2f4b7834b93b539c",
|
||||
"reference": "97ae9721bead9d1a39b5650e2f4b7834b93b539c",
|
||||
"url": "https:\/\/api.github.com\/repos\/symfony\/process\/zipball\/8741e3ed7fe2e91ec099e02446fb86667a0f1628",
|
||||
"reference": "8741e3ed7fe2e91ec099e02446fb86667a0f1628",
|
||||
"shasum": ""
|
||||
},
|
||||
"require": {
|
||||
"php": ">=8.1"
|
||||
},
|
||||
"time": "2023-05-19T07:42:48+00:00",
|
||||
"time": "2023-05-19T08:06:44+00:00",
|
||||
"type": "library",
|
||||
"installation-source": "dist",
|
||||
"autoload": {
|
||||
|
@ -2922,7 +2914,7 @@
|
|||
"description": "Executes commands in sub-processes",
|
||||
"homepage": "https:\/\/symfony.com",
|
||||
"support": {
|
||||
"source": "https:\/\/github.com\/symfony\/process\/tree\/v6.2.11"
|
||||
"source": "https:\/\/github.com\/symfony\/process\/tree\/v6.3.0"
|
||||
},
|
||||
"funding": [
|
||||
{
|
||||
|
@ -2942,17 +2934,17 @@
|
|||
},
|
||||
{
|
||||
"name": "symfony\/string",
|
||||
"version": "v6.2.8",
|
||||
"version_normalized": "6.2.8.0",
|
||||
"version": "v6.3.0",
|
||||
"version_normalized": "6.3.0.0",
|
||||
"source": {
|
||||
"type": "git",
|
||||
"url": "https:\/\/github.com\/symfony\/string.git",
|
||||
"reference": "193e83bbd6617d6b2151c37fff10fa7168ebddef"
|
||||
"reference": "f2e190ee75ff0f5eced645ec0be5c66fac81f51f"
|
||||
},
|
||||
"dist": {
|
||||
"type": "zip",
|
||||
"url": "https:\/\/api.github.com\/repos\/symfony\/string\/zipball\/193e83bbd6617d6b2151c37fff10fa7168ebddef",
|
||||
"reference": "193e83bbd6617d6b2151c37fff10fa7168ebddef",
|
||||
"url": "https:\/\/api.github.com\/repos\/symfony\/string\/zipball\/f2e190ee75ff0f5eced645ec0be5c66fac81f51f",
|
||||
"reference": "f2e190ee75ff0f5eced645ec0be5c66fac81f51f",
|
||||
"shasum": ""
|
||||
},
|
||||
"require": {
|
||||
|
@ -2963,16 +2955,16 @@
|
|||
"symfony\/polyfill-mbstring": "~1.0"
|
||||
},
|
||||
"conflict": {
|
||||
"symfony\/translation-contracts": "<2.0"
|
||||
"symfony\/translation-contracts": "<2.5"
|
||||
},
|
||||
"require-dev": {
|
||||
"symfony\/error-handler": "^5.4|^6.0",
|
||||
"symfony\/http-client": "^5.4|^6.0",
|
||||
"symfony\/intl": "^6.2",
|
||||
"symfony\/translation-contracts": "^2.0|^3.0",
|
||||
"symfony\/translation-contracts": "^2.5|^3.0",
|
||||
"symfony\/var-exporter": "^5.4|^6.0"
|
||||
},
|
||||
"time": "2023-03-20T16:06:02+00:00",
|
||||
"time": "2023-03-21T21:06:29+00:00",
|
||||
"type": "library",
|
||||
"installation-source": "dist",
|
||||
"autoload": {
|
||||
|
@ -3011,7 +3003,7 @@
|
|||
"utf8"
|
||||
],
|
||||
"support": {
|
||||
"source": "https:\/\/github.com\/symfony\/string\/tree\/v6.2.8"
|
||||
"source": "https:\/\/github.com\/symfony\/string\/tree\/v6.3.0"
|
||||
},
|
||||
"funding": [
|
||||
{
|
||||
|
|
2
vendor/composer/installed.php
vendored
2
vendor/composer/installed.php
vendored
File diff suppressed because one or more lines are too long
|
@ -363,9 +363,9 @@ public function NAME($value): static
|
|||
$comment .= ' * @default ' . (null === $default ? 'null' : \var_export($default, \true)) . "\n";
|
||||
}
|
||||
if ($node instanceof EnumNode) {
|
||||
$comment .= \sprintf(' * @param ParamConfigurator|%s $value', \implode('|', \array_map(function ($a) {
|
||||
return \var_export($a, \true);
|
||||
}, $node->getValues()))) . "\n";
|
||||
$comment .= \sprintf(' * @param ParamConfigurator|%s $value', \implode('|', \array_unique(\array_map(function ($a) {
|
||||
return !$a instanceof \UnitEnum ? \var_export($a, \true) : '\\' . \ltrim(\var_export($a, \true), '\\');
|
||||
}, $node->getValues())))) . "\n";
|
||||
} else {
|
||||
$parameterTypes = $this->getParameterTypes($node);
|
||||
$comment .= ' * @param ParamConfigurator|' . \implode('|', $parameterTypes) . ' $value' . "\n";
|
||||
|
|
5
vendor/symfony/config/CHANGELOG.md
vendored
5
vendor/symfony/config/CHANGELOG.md
vendored
|
@ -1,6 +1,11 @@
|
|||
CHANGELOG
|
||||
=========
|
||||
|
||||
6.3
|
||||
---
|
||||
|
||||
* Allow enum values in `EnumNode`
|
||||
|
||||
6.2
|
||||
---
|
||||
|
||||
|
|
|
@ -35,6 +35,8 @@ interface ConfigCacheInterface
|
|||
* @param string $content The content to write into the cache
|
||||
* @param ResourceInterface[]|null $metadata An array of ResourceInterface instances
|
||||
*
|
||||
* @return void
|
||||
*
|
||||
* @throws \RuntimeException When the cache file cannot be written
|
||||
*/
|
||||
public function write(string $content, array $metadata = null);
|
||||
|
|
21
vendor/symfony/config/Definition/ArrayNode.php
vendored
21
vendor/symfony/config/Definition/ArrayNode.php
vendored
|
@ -29,6 +29,9 @@ class ArrayNode extends BaseNode implements PrototypeNodeInterface
|
|||
protected $ignoreExtraKeys = \false;
|
||||
protected $removeExtraKeys = \true;
|
||||
protected $normalizeKeys = \true;
|
||||
/**
|
||||
* @return void
|
||||
*/
|
||||
public function setNormalizeKeys(bool $normalizeKeys)
|
||||
{
|
||||
$this->normalizeKeys = $normalizeKeys;
|
||||
|
@ -70,6 +73,8 @@ class ArrayNode extends BaseNode implements PrototypeNodeInterface
|
|||
* Sets the xml remappings that should be performed.
|
||||
*
|
||||
* @param array $remappings An array of the form [[string, string]]
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function setXmlRemappings(array $remappings)
|
||||
{
|
||||
|
@ -87,6 +92,8 @@ class ArrayNode extends BaseNode implements PrototypeNodeInterface
|
|||
/**
|
||||
* Sets whether to add default values for this array if it has not been
|
||||
* defined in any of the configuration files.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function setAddIfNotSet(bool $boolean)
|
||||
{
|
||||
|
@ -94,6 +101,8 @@ class ArrayNode extends BaseNode implements PrototypeNodeInterface
|
|||
}
|
||||
/**
|
||||
* Sets whether false is allowed as value indicating that the array should be unset.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function setAllowFalse(bool $allow)
|
||||
{
|
||||
|
@ -101,6 +110,8 @@ class ArrayNode extends BaseNode implements PrototypeNodeInterface
|
|||
}
|
||||
/**
|
||||
* Sets whether new keys can be defined in subsequent configurations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function setAllowNewKeys(bool $allow)
|
||||
{
|
||||
|
@ -108,6 +119,8 @@ class ArrayNode extends BaseNode implements PrototypeNodeInterface
|
|||
}
|
||||
/**
|
||||
* Sets if deep merging should occur.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function setPerformDeepMerging(bool $boolean)
|
||||
{
|
||||
|
@ -118,6 +131,8 @@ class ArrayNode extends BaseNode implements PrototypeNodeInterface
|
|||
*
|
||||
* @param bool $boolean To allow extra keys
|
||||
* @param bool $remove To remove extra keys
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function setIgnoreExtraKeys(bool $boolean, bool $remove = \true)
|
||||
{
|
||||
|
@ -131,6 +146,9 @@ class ArrayNode extends BaseNode implements PrototypeNodeInterface
|
|||
{
|
||||
return $this->ignoreExtraKeys;
|
||||
}
|
||||
/**
|
||||
* @return void
|
||||
*/
|
||||
public function setName(string $name)
|
||||
{
|
||||
$this->name = $name;
|
||||
|
@ -158,6 +176,8 @@ class ArrayNode extends BaseNode implements PrototypeNodeInterface
|
|||
/**
|
||||
* Adds a child node.
|
||||
*
|
||||
* @return void
|
||||
*
|
||||
* @throws \InvalidArgumentException when the child node has no name
|
||||
* @throws \InvalidArgumentException when the child node's name is not unique
|
||||
*/
|
||||
|
@ -214,6 +234,7 @@ class ArrayNode extends BaseNode implements PrototypeNodeInterface
|
|||
return $value;
|
||||
}
|
||||
/**
|
||||
* @return void
|
||||
* @param mixed $value
|
||||
*/
|
||||
protected function validateType($value)
|
||||
|
|
31
vendor/symfony/config/Definition/BaseNode.php
vendored
31
vendor/symfony/config/Definition/BaseNode.php
vendored
|
@ -96,6 +96,7 @@ abstract class BaseNode implements NodeInterface
|
|||
self::$placeholders = [];
|
||||
}
|
||||
/**
|
||||
* @return void
|
||||
* @param mixed $value
|
||||
*/
|
||||
public function setAttribute(string $key, $value)
|
||||
|
@ -118,16 +119,24 @@ abstract class BaseNode implements NodeInterface
|
|||
{
|
||||
return $this->attributes;
|
||||
}
|
||||
/**
|
||||
* @return void
|
||||
*/
|
||||
public function setAttributes(array $attributes)
|
||||
{
|
||||
$this->attributes = $attributes;
|
||||
}
|
||||
/**
|
||||
* @return void
|
||||
*/
|
||||
public function removeAttribute(string $key)
|
||||
{
|
||||
unset($this->attributes[$key]);
|
||||
}
|
||||
/**
|
||||
* Sets an info message.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function setInfo(string $info)
|
||||
{
|
||||
|
@ -142,6 +151,8 @@ abstract class BaseNode implements NodeInterface
|
|||
}
|
||||
/**
|
||||
* Sets the example configuration for this node.
|
||||
*
|
||||
* @return void
|
||||
* @param string|mixed[] $example
|
||||
*/
|
||||
public function setExample($example)
|
||||
|
@ -158,6 +169,8 @@ abstract class BaseNode implements NodeInterface
|
|||
}
|
||||
/**
|
||||
* Adds an equivalent value.
|
||||
*
|
||||
* @return void
|
||||
* @param mixed $originalValue
|
||||
* @param mixed $equivalentValue
|
||||
*/
|
||||
|
@ -167,6 +180,8 @@ abstract class BaseNode implements NodeInterface
|
|||
}
|
||||
/**
|
||||
* Set this node as required.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function setRequired(bool $boolean)
|
||||
{
|
||||
|
@ -175,12 +190,14 @@ abstract class BaseNode implements NodeInterface
|
|||
/**
|
||||
* Sets this node as deprecated.
|
||||
*
|
||||
* You can use %node% and %path% placeholders in your message to display,
|
||||
* respectively, the node name and its complete path.
|
||||
*
|
||||
* @param string $package The name of the composer package that is triggering the deprecation
|
||||
* @param string $version The version of the package that introduced the deprecation
|
||||
* @param string $message the deprecation message to use
|
||||
*
|
||||
* You can use %node% and %path% placeholders in your message to display,
|
||||
* respectively, the node name and its complete path
|
||||
* @return void
|
||||
*/
|
||||
public function setDeprecated(string $package, string $version, string $message = 'The child node "%node%" at path "%path%" is deprecated.')
|
||||
{
|
||||
|
@ -188,6 +205,8 @@ abstract class BaseNode implements NodeInterface
|
|||
}
|
||||
/**
|
||||
* Sets if this node can be overridden.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function setAllowOverwrite(bool $allow)
|
||||
{
|
||||
|
@ -197,6 +216,8 @@ abstract class BaseNode implements NodeInterface
|
|||
* Sets the closures used for normalization.
|
||||
*
|
||||
* @param \Closure[] $closures An array of Closures used for normalization
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function setNormalizationClosures(array $closures)
|
||||
{
|
||||
|
@ -206,6 +227,8 @@ abstract class BaseNode implements NodeInterface
|
|||
* Sets the list of types supported by normalization.
|
||||
*
|
||||
* see ExprBuilder::TYPE_* constants.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function setNormalizedTypes(array $types)
|
||||
{
|
||||
|
@ -224,6 +247,8 @@ abstract class BaseNode implements NodeInterface
|
|||
* Sets the closures used for final validation.
|
||||
*
|
||||
* @param \Closure[] $closures An array of Closures used for final validation
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function setFinalValidationClosures(array $closures)
|
||||
{
|
||||
|
@ -383,6 +408,8 @@ abstract class BaseNode implements NodeInterface
|
|||
/**
|
||||
* Validates the type of a Node.
|
||||
*
|
||||
* @return void
|
||||
*
|
||||
* @throws InvalidTypeException when the value is invalid
|
||||
* @param mixed $value
|
||||
*/
|
||||
|
|
|
@ -19,6 +19,7 @@ use RectorPrefix202305\Symfony\Component\Config\Definition\Exception\InvalidType
|
|||
class BooleanNode extends ScalarNode
|
||||
{
|
||||
/**
|
||||
* @return void
|
||||
* @param mixed $value
|
||||
*/
|
||||
protected function validateType($value)
|
||||
|
|
|
@ -40,6 +40,9 @@ class ArrayNodeDefinition extends NodeDefinition implements ParentNodeDefinition
|
|||
$this->nullEquivalent = [];
|
||||
$this->trueEquivalent = [];
|
||||
}
|
||||
/**
|
||||
* @return void
|
||||
*/
|
||||
public function setBuilder(NodeBuilder $builder)
|
||||
{
|
||||
$this->nodeBuilder = $builder;
|
||||
|
@ -344,6 +347,8 @@ class ArrayNodeDefinition extends NodeDefinition implements ParentNodeDefinition
|
|||
/**
|
||||
* Validate the configuration of a concrete node.
|
||||
*
|
||||
* @return void
|
||||
*
|
||||
* @throws InvalidDefinitionException
|
||||
*/
|
||||
protected function validateConcreteNode(ArrayNode $node)
|
||||
|
@ -368,6 +373,8 @@ class ArrayNodeDefinition extends NodeDefinition implements ParentNodeDefinition
|
|||
/**
|
||||
* Validate the configuration of a prototype node.
|
||||
*
|
||||
* @return void
|
||||
*
|
||||
* @throws InvalidDefinitionException
|
||||
*/
|
||||
protected function validatePrototypeNode(PrototypedArrayNode $node)
|
||||
|
|
|
@ -19,6 +19,8 @@ interface BuilderAwareInterface
|
|||
{
|
||||
/**
|
||||
* Sets a custom children builder.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function setBuilder(NodeBuilder $builder);
|
||||
}
|
||||
|
|
|
@ -27,7 +27,6 @@ class EnumNodeDefinition extends ScalarNodeDefinition
|
|||
*/
|
||||
public function values(array $values)
|
||||
{
|
||||
$values = \array_unique($values);
|
||||
if (!$values) {
|
||||
throw new \InvalidArgumentException('->values() must be called with at least one value.');
|
||||
}
|
||||
|
|
|
@ -44,6 +44,9 @@ class TreeBuilder implements NodeParentInterface
|
|||
}
|
||||
return $this->tree = $this->root->getNode(\true);
|
||||
}
|
||||
/**
|
||||
* @return void
|
||||
*/
|
||||
public function setPathSeparator(string $separator)
|
||||
{
|
||||
// unset last built as changing path separator changes all nodes
|
||||
|
|
|
@ -31,10 +31,16 @@ class XmlReferenceDumper
|
|||
* @var string|null
|
||||
*/
|
||||
private $reference;
|
||||
/**
|
||||
* @return string
|
||||
*/
|
||||
public function dump(ConfigurationInterface $configuration, string $namespace = null)
|
||||
{
|
||||
return $this->dumpNode($configuration->getConfigTreeBuilder()->buildTree(), $namespace);
|
||||
}
|
||||
/**
|
||||
* @return string
|
||||
*/
|
||||
public function dumpNode(NodeInterface $node, string $namespace = null)
|
||||
{
|
||||
$this->reference = '';
|
||||
|
@ -43,7 +49,7 @@ class XmlReferenceDumper
|
|||
$this->reference = null;
|
||||
return $ref;
|
||||
}
|
||||
private function writeNode(NodeInterface $node, int $depth = 0, bool $root = \false, string $namespace = null)
|
||||
private function writeNode(NodeInterface $node, int $depth = 0, bool $root = \false, string $namespace = null) : void
|
||||
{
|
||||
$rootName = $root ? 'config' : $node->getName();
|
||||
$rootNamespace = $namespace ?: ($root ? 'http://example.org/schema/dic/' . $node->getName() : null);
|
||||
|
@ -103,7 +109,7 @@ class XmlReferenceDumper
|
|||
$prototypeValue = 'true|false';
|
||||
break;
|
||||
case EnumNode::class:
|
||||
$prototypeValue = \implode('|', \array_map('json_encode', $prototype->getValues()));
|
||||
$prototypeValue = $prototype->getPermissibleValues('|');
|
||||
break;
|
||||
default:
|
||||
$prototypeValue = 'value';
|
||||
|
@ -140,7 +146,7 @@ class XmlReferenceDumper
|
|||
$comments[] = \sprintf('Deprecated (%s)', ($deprecation['package'] || $deprecation['version'] ? "Since {$deprecation['package']} {$deprecation['version']}: " : '') . $deprecation['message']);
|
||||
}
|
||||
if ($child instanceof EnumNode) {
|
||||
$comments[] = 'One of ' . \implode('; ', \array_map('json_encode', $child->getValues()));
|
||||
$comments[] = 'One of ' . $child->getPermissibleValues('; ');
|
||||
}
|
||||
if (\count($comments)) {
|
||||
$rootAttributeComments[$name] = \implode(";\n", $comments);
|
||||
|
@ -218,7 +224,7 @@ class XmlReferenceDumper
|
|||
/**
|
||||
* Outputs a single config reference line.
|
||||
*/
|
||||
private function writeLine(string $text, int $indent = 0)
|
||||
private function writeLine(string $text, int $indent = 0) : void
|
||||
{
|
||||
$indent = \strlen($text) + $indent;
|
||||
$format = '%' . $indent . 's';
|
||||
|
|
|
@ -30,10 +30,16 @@ class YamlReferenceDumper
|
|||
* @var string|null
|
||||
*/
|
||||
private $reference;
|
||||
/**
|
||||
* @return string
|
||||
*/
|
||||
public function dump(ConfigurationInterface $configuration)
|
||||
{
|
||||
return $this->dumpNode($configuration->getConfigTreeBuilder()->buildTree());
|
||||
}
|
||||
/**
|
||||
* @return string
|
||||
*/
|
||||
public function dumpAtPath(ConfigurationInterface $configuration, string $path)
|
||||
{
|
||||
$rootNode = $node = $configuration->getConfigTreeBuilder()->buildTree();
|
||||
|
@ -53,6 +59,9 @@ class YamlReferenceDumper
|
|||
}
|
||||
return $this->dumpNode($node);
|
||||
}
|
||||
/**
|
||||
* @return string
|
||||
*/
|
||||
public function dumpNode(NodeInterface $node)
|
||||
{
|
||||
$this->reference = '';
|
||||
|
@ -61,7 +70,7 @@ class YamlReferenceDumper
|
|||
$this->reference = null;
|
||||
return $ref;
|
||||
}
|
||||
private function writeNode(NodeInterface $node, NodeInterface $parentNode = null, int $depth = 0, bool $prototypedArray = \false)
|
||||
private function writeNode(NodeInterface $node, NodeInterface $parentNode = null, int $depth = 0, bool $prototypedArray = \false) : void
|
||||
{
|
||||
$comments = [];
|
||||
$default = '';
|
||||
|
@ -85,7 +94,7 @@ class YamlReferenceDumper
|
|||
}
|
||||
}
|
||||
} elseif ($node instanceof EnumNode) {
|
||||
$comments[] = 'One of ' . \implode('; ', \array_map('json_encode', $node->getValues()));
|
||||
$comments[] = 'One of ' . $node->getPermissibleValues('; ');
|
||||
$default = $node->hasDefaultValue() ? Inline::dump($node->getDefaultValue()) : '~';
|
||||
} elseif (VariableNode::class === \get_class($node) && \is_array($example)) {
|
||||
// If there is an array example, we are sure we dont need to print a default value
|
||||
|
@ -151,13 +160,13 @@ class YamlReferenceDumper
|
|||
/**
|
||||
* Outputs a single config reference line.
|
||||
*/
|
||||
private function writeLine(string $text, int $indent = 0)
|
||||
private function writeLine(string $text, int $indent = 0) : void
|
||||
{
|
||||
$indent = \strlen($text) + $indent;
|
||||
$format = '%' . $indent . 's';
|
||||
$this->reference .= \sprintf($format, $text) . "\n";
|
||||
}
|
||||
private function writeArray(array $array, int $depth)
|
||||
private function writeArray(array $array, int $depth) : void
|
||||
{
|
||||
$arrayIsList = function (array $array) : bool {
|
||||
if (\function_exists('array_is_list')) {
|
||||
|
|
40
vendor/symfony/config/Definition/EnumNode.php
vendored
40
vendor/symfony/config/Definition/EnumNode.php
vendored
|
@ -24,17 +24,53 @@ class EnumNode extends ScalarNode
|
|||
private $values;
|
||||
public function __construct(?string $name, NodeInterface $parent = null, array $values = [], string $pathSeparator = BaseNode::DEFAULT_PATH_SEPARATOR)
|
||||
{
|
||||
$values = \array_unique($values);
|
||||
if (!$values) {
|
||||
throw new \InvalidArgumentException('$values must contain at least one element.');
|
||||
}
|
||||
foreach ($values as $value) {
|
||||
if (null === $value || \is_scalar($value)) {
|
||||
continue;
|
||||
}
|
||||
if (!$value instanceof \UnitEnum) {
|
||||
throw new \InvalidArgumentException(\sprintf('"%s" only supports scalar, enum, or null values, "%s" given.', __CLASS__, \get_debug_type($value)));
|
||||
}
|
||||
if (\get_class($value) !== ($enumClass = $enumClass ?? \get_class($value))) {
|
||||
throw new \InvalidArgumentException(\sprintf('"%s" only supports one type of enum, "%s" and "%s" passed.', __CLASS__, $enumClass, \get_class($value)));
|
||||
}
|
||||
}
|
||||
parent::__construct($name, $parent, $pathSeparator);
|
||||
$this->values = $values;
|
||||
}
|
||||
/**
|
||||
* @return array
|
||||
*/
|
||||
public function getValues()
|
||||
{
|
||||
return $this->values;
|
||||
}
|
||||
/**
|
||||
* @internal
|
||||
*/
|
||||
public function getPermissibleValues(string $separator) : string
|
||||
{
|
||||
return \implode($separator, \array_unique(\array_map(static function ($value) : string {
|
||||
if (!$value instanceof \UnitEnum) {
|
||||
return \json_encode($value);
|
||||
}
|
||||
return \ltrim(\var_export($value, \true), '\\');
|
||||
}, $this->values)));
|
||||
}
|
||||
/**
|
||||
* @return void
|
||||
* @param mixed $value
|
||||
*/
|
||||
protected function validateType($value)
|
||||
{
|
||||
if ($value instanceof \UnitEnum) {
|
||||
return;
|
||||
}
|
||||
parent::validateType($value);
|
||||
}
|
||||
/**
|
||||
* @param mixed $value
|
||||
* @return mixed
|
||||
|
@ -43,7 +79,7 @@ class EnumNode extends ScalarNode
|
|||
{
|
||||
$value = parent::finalizeValue($value);
|
||||
if (!\in_array($value, $this->values, \true)) {
|
||||
$ex = new InvalidConfigurationException(\sprintf('The value %s is not allowed for path "%s". Permissible values: %s', \json_encode($value), $this->getPath(), \implode(', ', \array_map('json_encode', $this->values))));
|
||||
$ex = new InvalidConfigurationException(\sprintf('The value %s is not allowed for path "%s". Permissible values: %s', \json_encode($value), $this->getPath(), $this->getPermissibleValues(', ')));
|
||||
$ex->setPath($this->getPath());
|
||||
throw $ex;
|
||||
}
|
||||
|
|
|
@ -26,6 +26,9 @@ class InvalidConfigurationException extends Exception
|
|||
* @var bool
|
||||
*/
|
||||
private $containsHints = \false;
|
||||
/**
|
||||
* @return void
|
||||
*/
|
||||
public function setPath(string $path)
|
||||
{
|
||||
$this->path = $path;
|
||||
|
@ -36,6 +39,8 @@ class InvalidConfigurationException extends Exception
|
|||
}
|
||||
/**
|
||||
* Adds extra information that is suffixed to the original exception message.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function addHint(string $hint)
|
||||
{
|
||||
|
|
|
@ -19,6 +19,7 @@ use RectorPrefix202305\Symfony\Component\Config\Definition\Exception\InvalidType
|
|||
class FloatNode extends NumericNode
|
||||
{
|
||||
/**
|
||||
* @return void
|
||||
* @param mixed $value
|
||||
*/
|
||||
protected function validateType($value)
|
||||
|
|
|
@ -19,6 +19,7 @@ use RectorPrefix202305\Symfony\Component\Config\Definition\Exception\InvalidType
|
|||
class IntegerNode extends NumericNode
|
||||
{
|
||||
/**
|
||||
* @return void
|
||||
* @param mixed $value
|
||||
*/
|
||||
protected function validateType($value)
|
||||
|
|
|
@ -19,6 +19,8 @@ interface PrototypeNodeInterface extends NodeInterface
|
|||
{
|
||||
/**
|
||||
* Sets the name of the node.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function setName(string $name);
|
||||
}
|
||||
|
|
|
@ -34,6 +34,8 @@ class PrototypedArrayNode extends ArrayNode
|
|||
/**
|
||||
* Sets the minimum number of elements that a prototype based node must
|
||||
* contain. By default this is zero, meaning no elements.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function setMinNumberOfElements(int $number)
|
||||
{
|
||||
|
@ -62,6 +64,8 @@ class PrototypedArrayNode extends ArrayNode
|
|||
*
|
||||
* @param string $attribute The name of the attribute which value is to be used as a key
|
||||
* @param bool $remove Whether or not to remove the key
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function setKeyAttribute(string $attribute, bool $remove = \true)
|
||||
{
|
||||
|
@ -77,6 +81,8 @@ class PrototypedArrayNode extends ArrayNode
|
|||
}
|
||||
/**
|
||||
* Sets the default value of this node.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function setDefaultValue(array $value)
|
||||
{
|
||||
|
@ -90,6 +96,8 @@ class PrototypedArrayNode extends ArrayNode
|
|||
* Adds default children when none are set.
|
||||
*
|
||||
* @param int|string|array|null $children The number of children|The child name|The children names to be added
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function setAddChildrenIfNoneSet($children = ['defaults'])
|
||||
{
|
||||
|
@ -118,6 +126,8 @@ class PrototypedArrayNode extends ArrayNode
|
|||
}
|
||||
/**
|
||||
* Sets the node prototype.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function setPrototype(PrototypeNodeInterface $node)
|
||||
{
|
||||
|
@ -133,6 +143,8 @@ class PrototypedArrayNode extends ArrayNode
|
|||
/**
|
||||
* Disable adding concrete children for prototyped nodes.
|
||||
*
|
||||
* @return never
|
||||
*
|
||||
* @throws Exception
|
||||
*/
|
||||
public function addChild(NodeInterface $node)
|
||||
|
|
|
@ -26,6 +26,7 @@ use RectorPrefix202305\Symfony\Component\Config\Definition\Exception\InvalidType
|
|||
class ScalarNode extends VariableNode
|
||||
{
|
||||
/**
|
||||
* @return void
|
||||
* @param mixed $value
|
||||
*/
|
||||
protected function validateType($value)
|
||||
|
|
|
@ -25,6 +25,7 @@ class VariableNode extends BaseNode implements PrototypeNodeInterface
|
|||
protected $defaultValue;
|
||||
protected $allowEmptyValue = \true;
|
||||
/**
|
||||
* @return void
|
||||
* @param mixed $value
|
||||
*/
|
||||
public function setDefaultValue($value)
|
||||
|
@ -48,16 +49,22 @@ class VariableNode extends BaseNode implements PrototypeNodeInterface
|
|||
* Sets if this node is allowed to have an empty value.
|
||||
*
|
||||
* @param bool $boolean True if this entity will accept empty values
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function setAllowEmptyValue(bool $boolean)
|
||||
{
|
||||
$this->allowEmptyValue = $boolean;
|
||||
}
|
||||
/**
|
||||
* @return void
|
||||
*/
|
||||
public function setName(string $name)
|
||||
{
|
||||
$this->name = $name;
|
||||
}
|
||||
/**
|
||||
* @return void
|
||||
* @param mixed $value
|
||||
*/
|
||||
protected function validateType($value)
|
||||
|
|
|
@ -26,6 +26,9 @@ class FileLocatorFileNotFoundException extends \InvalidArgumentException
|
|||
parent::__construct($message, $code, $previous);
|
||||
$this->paths = $paths;
|
||||
}
|
||||
/**
|
||||
* @return array
|
||||
*/
|
||||
public function getPaths()
|
||||
{
|
||||
return $this->paths;
|
||||
|
|
|
@ -69,6 +69,7 @@ class LoaderLoadException extends \Exception
|
|||
parent::__construct($message, $code, $previous);
|
||||
}
|
||||
/**
|
||||
* @return string
|
||||
* @param mixed $var
|
||||
*/
|
||||
protected function varToString($var)
|
||||
|
|
3
vendor/symfony/config/FileLocator.php
vendored
3
vendor/symfony/config/FileLocator.php
vendored
|
@ -26,6 +26,9 @@ class FileLocator implements FileLocatorInterface
|
|||
{
|
||||
$this->paths = (array) $paths;
|
||||
}
|
||||
/**
|
||||
* @return string|array
|
||||
*/
|
||||
public function locate(string $name, string $currentPath = null, bool $first = \true)
|
||||
{
|
||||
if ('' === $name) {
|
||||
|
|
7
vendor/symfony/config/Loader/FileLoader.php
vendored
7
vendor/symfony/config/Loader/FileLoader.php
vendored
|
@ -36,6 +36,8 @@ abstract class FileLoader extends Loader
|
|||
}
|
||||
/**
|
||||
* Sets the current directory.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function setCurrentDir(string $dir)
|
||||
{
|
||||
|
@ -57,6 +59,8 @@ abstract class FileLoader extends Loader
|
|||
* @param string|null $sourceResource The original resource importing the new resource
|
||||
* @param string|mixed[] $exclude Glob patterns to exclude from the import
|
||||
*
|
||||
* @return mixed
|
||||
*
|
||||
* @throws LoaderLoadException
|
||||
* @throws FileLoaderImportCircularReferenceException
|
||||
* @throws FileLocatorFileNotFoundException
|
||||
|
@ -89,7 +93,7 @@ abstract class FileLoader extends Loader
|
|||
* @internal
|
||||
* @param mixed[]|\Symfony\Component\Config\Resource\GlobResource $resource
|
||||
*/
|
||||
protected function glob(string $pattern, bool $recursive, &$resource = null, bool $ignoreErrors = \false, bool $forExclusion = \false, array $excluded = [])
|
||||
protected function glob(string $pattern, bool $recursive, &$resource = null, bool $ignoreErrors = \false, bool $forExclusion = \false, array $excluded = []) : iterable
|
||||
{
|
||||
if (\strlen($pattern) === ($i = \strcspn($pattern, '*?{['))) {
|
||||
$prefix = $pattern;
|
||||
|
@ -118,6 +122,7 @@ abstract class FileLoader extends Loader
|
|||
}
|
||||
/**
|
||||
* @param mixed $resource
|
||||
* @return mixed
|
||||
*/
|
||||
private function doImport($resource, string $type = null, bool $ignoreErrors = \false, string $sourceResource = null)
|
||||
{
|
||||
|
|
3
vendor/symfony/config/Loader/Loader.php
vendored
3
vendor/symfony/config/Loader/Loader.php
vendored
|
@ -28,6 +28,9 @@ abstract class Loader implements LoaderInterface
|
|||
{
|
||||
return $this->resolver;
|
||||
}
|
||||
/**
|
||||
* @return void
|
||||
*/
|
||||
public function setResolver(LoaderResolverInterface $resolver)
|
||||
{
|
||||
$this->resolver = $resolver;
|
||||
|
|
|
@ -42,6 +42,8 @@ interface LoaderInterface
|
|||
public function getResolver();
|
||||
/**
|
||||
* Sets the loader resolver.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function setResolver(LoaderResolverInterface $resolver);
|
||||
}
|
||||
|
|
|
@ -46,6 +46,9 @@ class LoaderResolver implements LoaderResolverInterface
|
|||
}
|
||||
return \false;
|
||||
}
|
||||
/**
|
||||
* @return void
|
||||
*/
|
||||
public function addLoader(LoaderInterface $loader)
|
||||
{
|
||||
$this->loaders[] = $loader;
|
||||
|
|
|
@ -138,7 +138,7 @@ class ClassExistenceResource implements SelfCheckingResourceInterface
|
|||
*
|
||||
* @internal
|
||||
*/
|
||||
public static function throwOnRequiredClass(string $class, \Exception $previous = null)
|
||||
public static function throwOnRequiredClass(string $class, \Exception $previous = null) : void
|
||||
{
|
||||
// If the passed class is the resource being checked, we shouldn't throw.
|
||||
if (null === $previous && self::$autoloadedClass === $class) {
|
||||
|
@ -154,7 +154,7 @@ class ClassExistenceResource implements SelfCheckingResourceInterface
|
|||
throw $previous;
|
||||
}
|
||||
$message = \sprintf('Class "%s" not found.', $class);
|
||||
if (self::$autoloadedClass !== $class) {
|
||||
if ($class !== (self::$autoloadedClass ?? $class)) {
|
||||
$message = \substr_replace($message, \sprintf(' while loading "%s"', self::$autoloadedClass), -1, 0);
|
||||
}
|
||||
if (null !== $previous) {
|
||||
|
|
|
@ -45,7 +45,7 @@ class ComposerResource implements SelfCheckingResourceInterface
|
|||
self::refresh();
|
||||
return \array_values(self::$runtimeVendors) === \array_values($this->vendors);
|
||||
}
|
||||
private static function refresh()
|
||||
private static function refresh() : void
|
||||
{
|
||||
self::$runtimeVendors = [];
|
||||
foreach (\get_declared_classes() as $class) {
|
||||
|
|
|
@ -44,7 +44,7 @@ class DirectoryResource implements SelfCheckingResourceInterface
|
|||
}
|
||||
public function __toString() : string
|
||||
{
|
||||
return \md5(\serialize([$this->resource, $this->pattern]));
|
||||
return \hash('xxh128', \serialize([$this->resource, $this->pattern]));
|
||||
}
|
||||
public function getResource() : string
|
||||
{
|
||||
|
|
64
vendor/symfony/config/Resource/GlobResource.php
vendored
64
vendor/symfony/config/Resource/GlobResource.php
vendored
|
@ -105,26 +105,43 @@ class GlobResource implements \IteratorAggregate, SelfCheckingResourceInterface
|
|||
}
|
||||
public function getIterator() : \Traversable
|
||||
{
|
||||
if (!\file_exists($this->prefix) || !$this->recursive && '' === $this->pattern) {
|
||||
if (!$this->recursive && '' === $this->pattern || !\file_exists($this->prefix)) {
|
||||
return;
|
||||
}
|
||||
$prefix = \str_replace('\\', '/', $this->prefix);
|
||||
if (\is_file($prefix = \str_replace('\\', '/', $this->prefix))) {
|
||||
$prefix = \dirname($prefix);
|
||||
$pattern = \basename($prefix) . $this->pattern;
|
||||
} else {
|
||||
$pattern = $this->pattern;
|
||||
}
|
||||
if (\class_exists(Finder::class)) {
|
||||
$regex = Glob::toRegex($pattern);
|
||||
if ($this->recursive) {
|
||||
$regex = \substr_replace($regex, '(/|$)', -2, 1);
|
||||
}
|
||||
} else {
|
||||
$regex = null;
|
||||
}
|
||||
$prefixLen = \strlen($prefix);
|
||||
$paths = null;
|
||||
if ('' === $this->pattern && \is_file($prefix)) {
|
||||
$paths = [$this->prefix];
|
||||
} elseif (\strncmp($this->prefix, 'phar://', \strlen('phar://')) !== 0 && \strpos($this->pattern, '/**/') === \false) {
|
||||
if ($this->globBrace || \strpos($this->pattern, '{') === \false) {
|
||||
$paths = \glob($this->prefix . $this->pattern, \GLOB_NOSORT | $this->globBrace);
|
||||
if ('' === $this->pattern && \is_file($this->prefix)) {
|
||||
$paths = [$this->prefix => null];
|
||||
} elseif (\strncmp($this->prefix, 'phar://', \strlen('phar://')) !== 0 && (null !== $regex || \strpos($this->pattern, '/**/') === \false)) {
|
||||
if (\strpos($this->pattern, '/**/') === \false && ($this->globBrace || \strpos($this->pattern, '{') === \false)) {
|
||||
$paths = \array_fill_keys(\glob($this->prefix . $this->pattern, \GLOB_NOSORT | $this->globBrace), null);
|
||||
} elseif (\strpos($this->pattern, '\\') === \false || !\preg_match('/\\\\[,{}]/', $this->pattern)) {
|
||||
$paths = [];
|
||||
foreach ($this->expandGlob($this->pattern) as $p) {
|
||||
$paths[] = \glob($this->prefix . $p, \GLOB_NOSORT);
|
||||
if (\false !== ($i = \strpos($p, '/**/'))) {
|
||||
$p = \substr_replace($p, '/*', $i);
|
||||
}
|
||||
$paths += \array_fill_keys(\glob($this->prefix . $p, \GLOB_NOSORT), \false !== $i ? $regex : null);
|
||||
}
|
||||
$paths = \array_merge(...$paths);
|
||||
}
|
||||
}
|
||||
if (null !== $paths) {
|
||||
\natsort($paths);
|
||||
foreach ($paths as $path) {
|
||||
\uksort($paths, 'strnatcmp');
|
||||
foreach ($paths as $path => $regex) {
|
||||
if ($this->excludedPrefixes) {
|
||||
$normalizedPath = \str_replace('\\', '/', $path);
|
||||
do {
|
||||
|
@ -133,21 +150,21 @@ class GlobResource implements \IteratorAggregate, SelfCheckingResourceInterface
|
|||
}
|
||||
} while ($prefix !== $dirPath && $dirPath !== ($normalizedPath = \dirname($dirPath)));
|
||||
}
|
||||
if (\is_file($path)) {
|
||||
if ((null === $regex || \preg_match($regex, \substr(\str_replace('\\', '/', $path), $prefixLen))) && \is_file($path)) {
|
||||
(yield $path => new \SplFileInfo($path));
|
||||
}
|
||||
if (!\is_dir($path)) {
|
||||
continue;
|
||||
}
|
||||
if ($this->forExclusion) {
|
||||
if ($this->forExclusion && (null === $regex || \preg_match($regex, \substr(\str_replace('\\', '/', $path), $prefixLen)))) {
|
||||
(yield $path => new \SplFileInfo($path));
|
||||
continue;
|
||||
}
|
||||
if (!$this->recursive || isset($this->excludedPrefixes[\str_replace('\\', '/', $path)])) {
|
||||
if (!($this->recursive || null !== $regex) || isset($this->excludedPrefixes[\str_replace('\\', '/', $path)])) {
|
||||
continue;
|
||||
}
|
||||
$files = \iterator_to_array(new \RecursiveIteratorIterator(new \RecursiveCallbackFilterIterator(new \RecursiveDirectoryIterator($path, \FilesystemIterator::SKIP_DOTS | \FilesystemIterator::FOLLOW_SYMLINKS), function (\SplFileInfo $file, $path) {
|
||||
return !isset($this->excludedPrefixes[\str_replace('\\', '/', $path)]) && '.' !== $file->getBasename()[0];
|
||||
$files = \iterator_to_array(new \RecursiveIteratorIterator(new \RecursiveCallbackFilterIterator(new \RecursiveDirectoryIterator($path, \FilesystemIterator::SKIP_DOTS | \FilesystemIterator::FOLLOW_SYMLINKS), function (\SplFileInfo $file, $path) use($regex, $prefixLen) {
|
||||
return !isset($this->excludedPrefixes[$path = \str_replace('\\', '/', $path)]) && (null === $regex || \preg_match($regex, \substr($path, $prefixLen)) || $file->isDir()) && '.' !== $file->getBasename()[0];
|
||||
}), \RecursiveIteratorIterator::LEAVES_ONLY));
|
||||
\uksort($files, 'strnatcmp');
|
||||
foreach ($files as $path => $info) {
|
||||
|
@ -159,19 +176,8 @@ class GlobResource implements \IteratorAggregate, SelfCheckingResourceInterface
|
|||
return;
|
||||
}
|
||||
if (!\class_exists(Finder::class)) {
|
||||
throw new \LogicException(\sprintf('Extended glob pattern "%s" cannot be used as the Finder component is not installed.', $this->pattern));
|
||||
throw new \LogicException('Extended glob patterns cannot be used as the Finder component is not installed. Try running "composer require symfony/finder".');
|
||||
}
|
||||
if (\is_file($prefix = $this->prefix)) {
|
||||
$prefix = \dirname($prefix);
|
||||
$pattern = \basename($prefix) . $this->pattern;
|
||||
} else {
|
||||
$pattern = $this->pattern;
|
||||
}
|
||||
$regex = Glob::toRegex($pattern);
|
||||
if ($this->recursive) {
|
||||
$regex = \substr_replace($regex, '(/|$)', -2, 1);
|
||||
}
|
||||
$prefixLen = \strlen($prefix);
|
||||
yield from (new Finder())->followLinks()->filter(function (\SplFileInfo $info) use($regex, $prefixLen, $prefix) {
|
||||
$normalizedPath = \str_replace('\\', '/', $info->getPathname());
|
||||
if (!\preg_match($regex, \substr($normalizedPath, $prefixLen)) || !$info->isFile()) {
|
||||
|
@ -188,7 +194,7 @@ class GlobResource implements \IteratorAggregate, SelfCheckingResourceInterface
|
|||
}
|
||||
private function computeHash() : string
|
||||
{
|
||||
$hash = \hash_init('md5');
|
||||
$hash = \hash_init('xxh128');
|
||||
foreach ($this->getIterator() as $path => $info) {
|
||||
\hash_update($hash, $path . "\n");
|
||||
}
|
||||
|
|
|
@ -77,7 +77,7 @@ class ReflectionClassResource implements SelfCheckingResourceInterface
|
|||
}
|
||||
return ['files', 'className', 'hash'];
|
||||
}
|
||||
private function loadFiles(\ReflectionClass $class)
|
||||
private function loadFiles(\ReflectionClass $class) : void
|
||||
{
|
||||
foreach ($class->getInterfaces() as $v) {
|
||||
$this->loadFiles($v);
|
||||
|
@ -108,7 +108,7 @@ class ReflectionClassResource implements SelfCheckingResourceInterface
|
|||
// the class does not exist anymore
|
||||
return \false;
|
||||
}
|
||||
$hash = \hash_init('md5');
|
||||
$hash = \hash_init('xxh128');
|
||||
foreach ($this->generateSignature($this->classReflector) as $info) {
|
||||
\hash_update($hash, $info);
|
||||
}
|
||||
|
@ -148,9 +148,6 @@ class ReflectionClassResource implements SelfCheckingResourceInterface
|
|||
(yield \print_r(isset($defaults[$p->name]) && !\is_object($defaults[$p->name]) ? $defaults[$p->name] : null, \true));
|
||||
}
|
||||
}
|
||||
$defined = \Closure::bind(static function ($c) {
|
||||
return \defined($c);
|
||||
}, null, $class->name);
|
||||
foreach ($class->getMethods(\ReflectionMethod::IS_PUBLIC | \ReflectionMethod::IS_PROTECTED) as $m) {
|
||||
foreach (\method_exists($m, 'getAttributes') ? $m->getAttributes() : [] as $a) {
|
||||
$attributes[] = [$a->getName(), (string) $a];
|
||||
|
|
|
@ -95,6 +95,8 @@ class ResourceCheckerConfigCache implements ConfigCacheInterface
|
|||
* @param string $content The content to write in the cache
|
||||
* @param ResourceInterface[] $metadata An array of metadata
|
||||
*
|
||||
* @return void
|
||||
*
|
||||
* @throws \RuntimeException When cache file can't be written
|
||||
*/
|
||||
public function write(string $content, array $metadata = null)
|
||||
|
@ -127,6 +129,9 @@ class ResourceCheckerConfigCache implements ConfigCacheInterface
|
|||
{
|
||||
return $this->file . '.meta';
|
||||
}
|
||||
/**
|
||||
* @return mixed
|
||||
*/
|
||||
private function safelyUnserialize(string $file)
|
||||
{
|
||||
$meta = \false;
|
||||
|
@ -154,7 +159,7 @@ class ResourceCheckerConfigCache implements ConfigCacheInterface
|
|||
/**
|
||||
* @internal
|
||||
*/
|
||||
public static function handleUnserializeCallback(string $class)
|
||||
public static function handleUnserializeCallback(string $class) : void
|
||||
{
|
||||
\trigger_error('Class not found: ' . $class);
|
||||
}
|
||||
|
|
3
vendor/symfony/config/Util/XmlUtils.php
vendored
3
vendor/symfony/config/Util/XmlUtils.php
vendored
|
@ -212,6 +212,9 @@ class XmlUtils
|
|||
return $value;
|
||||
}
|
||||
}
|
||||
/**
|
||||
* @return array
|
||||
*/
|
||||
protected static function getXmlErrors(bool $internalErrors)
|
||||
{
|
||||
$errors = [];
|
||||
|
|
10
vendor/symfony/config/composer.json
vendored
10
vendor/symfony/config/composer.json
vendored
|
@ -17,7 +17,7 @@
|
|||
],
|
||||
"require": {
|
||||
"php": ">=8.1",
|
||||
"symfony\/deprecation-contracts": "^2.1|^3",
|
||||
"symfony\/deprecation-contracts": "^2.5|^3",
|
||||
"symfony\/filesystem": "^5.4|^6.0",
|
||||
"symfony\/polyfill-ctype": "~1.8"
|
||||
},
|
||||
|
@ -25,14 +25,12 @@
|
|||
"symfony\/event-dispatcher": "^5.4|^6.0",
|
||||
"symfony\/finder": "^5.4|^6.0",
|
||||
"symfony\/messenger": "^5.4|^6.0",
|
||||
"symfony\/service-contracts": "^1.1|^2|^3",
|
||||
"symfony\/service-contracts": "^2.5|^3",
|
||||
"symfony\/yaml": "^5.4|^6.0"
|
||||
},
|
||||
"conflict": {
|
||||
"symfony\/finder": "<5.4"
|
||||
},
|
||||
"suggest": {
|
||||
"symfony\/yaml": "To use the yaml reference dumper"
|
||||
"symfony\/finder": "<5.4",
|
||||
"symfony\/service-contracts": "<2.5"
|
||||
},
|
||||
"autoload": {
|
||||
"psr-4": {
|
||||
|
|
105
vendor/symfony/console/Application.php
vendored
105
vendor/symfony/console/Application.php
vendored
|
@ -152,10 +152,13 @@ class Application implements ResetInterface
|
|||
/**
|
||||
* @final
|
||||
*/
|
||||
public function setDispatcher(EventDispatcherInterface $dispatcher)
|
||||
public function setDispatcher(EventDispatcherInterface $dispatcher) : void
|
||||
{
|
||||
$this->dispatcher = $dispatcher;
|
||||
}
|
||||
/**
|
||||
* @return void
|
||||
*/
|
||||
public function setCommandLoader(CommandLoaderInterface $commandLoader)
|
||||
{
|
||||
$this->commandLoader = $commandLoader;
|
||||
|
@ -163,10 +166,13 @@ class Application implements ResetInterface
|
|||
public function getSignalRegistry() : SignalRegistry
|
||||
{
|
||||
if (!$this->signalRegistry) {
|
||||
throw new RuntimeException('Signals are not supported. Make sure that the `pcntl` extension is installed and that "pcntl_*" functions are not disabled by your php.ini\'s "disable_functions" directive.');
|
||||
throw new RuntimeException('Signals are not supported. Make sure that the "pcntl" extension is installed and that "pcntl_*" functions are not disabled by your php.ini\'s "disable_functions" directive.');
|
||||
}
|
||||
return $this->signalRegistry;
|
||||
}
|
||||
/**
|
||||
* @return void
|
||||
*/
|
||||
public function setSignalsToDispatchEvent(int ...$signalsToDispatchEvent)
|
||||
{
|
||||
$this->signalsToDispatchEvent = $signalsToDispatchEvent;
|
||||
|
@ -321,9 +327,15 @@ class Application implements ResetInterface
|
|||
$this->runningCommand = null;
|
||||
return $exitCode;
|
||||
}
|
||||
/**
|
||||
* @return void
|
||||
*/
|
||||
public function reset()
|
||||
{
|
||||
}
|
||||
/**
|
||||
* @return void
|
||||
*/
|
||||
public function setHelperSet(HelperSet $helperSet)
|
||||
{
|
||||
$this->helperSet = $helperSet;
|
||||
|
@ -335,6 +347,9 @@ class Application implements ResetInterface
|
|||
{
|
||||
return $this->helperSet = $this->helperSet ?? $this->getDefaultHelperSet();
|
||||
}
|
||||
/**
|
||||
* @return void
|
||||
*/
|
||||
public function setDefinition(InputDefinition $definition)
|
||||
{
|
||||
$this->definition = $definition;
|
||||
|
@ -391,6 +406,8 @@ class Application implements ResetInterface
|
|||
}
|
||||
/**
|
||||
* Sets whether to catch exceptions or not during commands execution.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function setCatchExceptions(bool $boolean)
|
||||
{
|
||||
|
@ -405,6 +422,8 @@ class Application implements ResetInterface
|
|||
}
|
||||
/**
|
||||
* Sets whether to automatically exit after a command execution or not.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function setAutoExit(bool $boolean)
|
||||
{
|
||||
|
@ -419,7 +438,9 @@ class Application implements ResetInterface
|
|||
}
|
||||
/**
|
||||
* Sets the application name.
|
||||
**/
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function setName(string $name)
|
||||
{
|
||||
$this->name = $name;
|
||||
|
@ -433,6 +454,8 @@ class Application implements ResetInterface
|
|||
}
|
||||
/**
|
||||
* Sets the application version.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function setVersion(string $version)
|
||||
{
|
||||
|
@ -466,6 +489,8 @@ class Application implements ResetInterface
|
|||
* If a Command is not enabled it will not be added.
|
||||
*
|
||||
* @param Command[] $commands An array of commands
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function addCommands(array $commands)
|
||||
{
|
||||
|
@ -795,6 +820,8 @@ class Application implements ResetInterface
|
|||
}
|
||||
/**
|
||||
* Configures the input and output instances based on the user arguments and options.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
protected function configureIO(InputInterface $input, OutputInterface $output)
|
||||
{
|
||||
|
@ -862,37 +889,55 @@ class Application implements ResetInterface
|
|||
$helper->setInput($input);
|
||||
}
|
||||
}
|
||||
if ($this->signalsToDispatchEvent) {
|
||||
$commandSignals = $command instanceof SignalableCommandInterface ? $command->getSubscribedSignals() : [];
|
||||
if ($commandSignals || null !== $this->dispatcher) {
|
||||
if (!$this->signalRegistry) {
|
||||
throw new 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 (Terminal::hasSttyAvailable()) {
|
||||
$sttyMode = \shell_exec('stty -g');
|
||||
foreach ([\SIGINT, \SIGTERM] as $signal) {
|
||||
$this->signalRegistry->register($signal, static function () use($sttyMode) {
|
||||
\shell_exec('stty ' . $sttyMode);
|
||||
});
|
||||
}
|
||||
}
|
||||
$commandSignals = $command instanceof SignalableCommandInterface ? $command->getSubscribedSignals() : [];
|
||||
if ($commandSignals || $this->dispatcher && $this->signalsToDispatchEvent) {
|
||||
if (!$this->signalRegistry) {
|
||||
throw new 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 (null !== $this->dispatcher) {
|
||||
foreach ($this->signalsToDispatchEvent as $signal) {
|
||||
$event = new ConsoleSignalEvent($command, $input, $output, $signal);
|
||||
$this->signalRegistry->register($signal, function ($signal, $hasNext) use($event) {
|
||||
$this->dispatcher->dispatch($event, ConsoleEvents::SIGNAL);
|
||||
// No more handlers, we try to simulate PHP default behavior
|
||||
if (!$hasNext) {
|
||||
if (!\in_array($signal, [\SIGUSR1, \SIGUSR2], \true)) {
|
||||
exit(0);
|
||||
}
|
||||
}
|
||||
if (Terminal::hasSttyAvailable()) {
|
||||
$sttyMode = \shell_exec('stty -g');
|
||||
foreach ([\SIGINT, \SIGTERM] as $signal) {
|
||||
$this->signalRegistry->register($signal, static function () use($sttyMode) {
|
||||
return \shell_exec('stty ' . $sttyMode);
|
||||
});
|
||||
}
|
||||
}
|
||||
if ($this->dispatcher) {
|
||||
// We register application signals, so that we can dispatch the event
|
||||
foreach ($this->signalsToDispatchEvent as $signal) {
|
||||
$event = new ConsoleSignalEvent($command, $input, $output, $signal);
|
||||
$this->signalRegistry->register($signal, function ($signal) use($event, $command, $commandSignals) {
|
||||
$this->dispatcher->dispatch($event, ConsoleEvents::SIGNAL);
|
||||
$exitCode = $event->getExitCode();
|
||||
// If the command is signalable, we call the handleSignal() method
|
||||
if (\in_array($signal, $commandSignals, \true)) {
|
||||
$exitCode = $command->handleSignal($signal, $exitCode);
|
||||
// BC layer for Symfony <= 5
|
||||
if (null === $exitCode) {
|
||||
\RectorPrefix202305\trigger_deprecation('symfony/console', '6.3', 'Not returning an exit code from "%s::handleSignal()" is deprecated, return "false" to keep the command running or "0" to exit successfully.', \get_debug_type($command));
|
||||
$exitCode = 0;
|
||||
}
|
||||
}
|
||||
if (\false !== $exitCode) {
|
||||
exit($exitCode);
|
||||
}
|
||||
});
|
||||
}
|
||||
// then we register command signals, but not if already handled after the dispatcher
|
||||
$commandSignals = \array_diff($commandSignals, $this->signalsToDispatchEvent);
|
||||
}
|
||||
foreach ($commandSignals as $signal) {
|
||||
$this->signalRegistry->register($signal, [$command, 'handleSignal']);
|
||||
$this->signalRegistry->register($signal, function (int $signal) use($command) : void {
|
||||
$exitCode = $command->handleSignal($signal);
|
||||
// BC layer for Symfony <= 5
|
||||
if (null === $exitCode) {
|
||||
\RectorPrefix202305\trigger_deprecation('symfony/console', '6.3', 'Not returning an exit code from "%s::handleSignal()" is deprecated, return "false" to keep the command running or "0" to exit successfully.', \get_debug_type($command));
|
||||
$exitCode = 0;
|
||||
}
|
||||
if (\false !== $exitCode) {
|
||||
exit($exitCode);
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
if (null === $this->dispatcher) {
|
||||
|
@ -1089,7 +1134,7 @@ class Application implements ResetInterface
|
|||
}
|
||||
return $namespaces;
|
||||
}
|
||||
private function init()
|
||||
private function init() : void
|
||||
{
|
||||
if ($this->initialized) {
|
||||
return;
|
||||
|
|
7
vendor/symfony/console/CHANGELOG.md
vendored
7
vendor/symfony/console/CHANGELOG.md
vendored
|
@ -1,6 +1,13 @@
|
|||
CHANGELOG
|
||||
=========
|
||||
|
||||
6.3
|
||||
---
|
||||
|
||||
* Add support for choosing exit code while handling signal, or to not exit at all
|
||||
* Add `ProgressBar::setPlaceholderFormatter` to set a placeholder attached to a instance, instead of being global.
|
||||
* Add `ReStructuredTextDescriptor`
|
||||
|
||||
6.2
|
||||
---
|
||||
|
||||
|
|
18
vendor/symfony/console/Command/Command.php
vendored
18
vendor/symfony/console/Command/Command.php
vendored
|
@ -158,11 +158,16 @@ class Command
|
|||
* Ignores validation errors.
|
||||
*
|
||||
* This is mainly useful for the help command.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function ignoreValidationErrors()
|
||||
{
|
||||
$this->ignoreValidationErrors = \true;
|
||||
}
|
||||
/**
|
||||
* @return void
|
||||
*/
|
||||
public function setApplication(Application $application = null)
|
||||
{
|
||||
if (1 > \func_num_args()) {
|
||||
|
@ -176,6 +181,9 @@ class Command
|
|||
}
|
||||
$this->fullDefinition = null;
|
||||
}
|
||||
/**
|
||||
* @return void
|
||||
*/
|
||||
public function setHelperSet(HelperSet $helperSet)
|
||||
{
|
||||
$this->helperSet = $helperSet;
|
||||
|
@ -208,6 +216,8 @@ class Command
|
|||
}
|
||||
/**
|
||||
* Configures the current command.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
protected function configure()
|
||||
{
|
||||
|
@ -236,6 +246,8 @@ class Command
|
|||
* This method is executed before the InputDefinition is validated.
|
||||
* This means that this is the only place where the command can
|
||||
* interactively ask for values of missing required arguments.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
protected function interact(InputInterface $input, OutputInterface $output)
|
||||
{
|
||||
|
@ -249,6 +261,8 @@ class Command
|
|||
*
|
||||
* @see InputInterface::bind()
|
||||
* @see InputInterface::validate()
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
protected function initialize(InputInterface $input, OutputInterface $output)
|
||||
{
|
||||
|
@ -371,7 +385,7 @@ class Command
|
|||
*
|
||||
* @internal
|
||||
*/
|
||||
public function mergeApplicationDefinition(bool $mergeArgs = \true)
|
||||
public function mergeApplicationDefinition(bool $mergeArgs = \true) : void
|
||||
{
|
||||
if (null === $this->application) {
|
||||
return;
|
||||
|
@ -652,7 +666,7 @@ class Command
|
|||
*
|
||||
* @throws InvalidArgumentException When the name is invalid
|
||||
*/
|
||||
private function validateName(string $name)
|
||||
private function validateName(string $name) : void
|
||||
{
|
||||
if (!\preg_match('/^[^\\:]++(\\:[^\\:]++)*$/', $name)) {
|
||||
throw new InvalidArgumentException(\sprintf('Command name "%s" is invalid.', $name));
|
||||
|
|
|
@ -53,7 +53,7 @@ final class CompleteCommand extends Command
|
|||
{
|
||||
$this->addOption('shell', 's', InputOption::VALUE_REQUIRED, 'The shell type ("' . \implode('", "', \array_keys($this->completionOutputs)) . '")')->addOption('input', 'i', InputOption::VALUE_REQUIRED | InputOption::VALUE_IS_ARRAY, 'An array of input tokens (e.g. COMP_WORDS or argv)')->addOption('current', 'c', InputOption::VALUE_REQUIRED, 'The index of the "input" array that the cursor is in (e.g. COMP_CWORD)')->addOption('api-version', 'a', InputOption::VALUE_REQUIRED, 'The API version of the completion script')->addOption('symfony', 'S', InputOption::VALUE_REQUIRED, 'deprecated');
|
||||
}
|
||||
protected function initialize(InputInterface $input, OutputInterface $output)
|
||||
protected function initialize(InputInterface $input, OutputInterface $output) : void
|
||||
{
|
||||
$this->isDebug = \filter_var(\getenv('SYMFONY_COMPLETION_DEBUG'), \FILTER_VALIDATE_BOOL);
|
||||
}
|
||||
|
|
|
@ -36,7 +36,7 @@ final class DumpCompletionCommand extends Command
|
|||
* @var mixed[]
|
||||
*/
|
||||
private $supportedShells;
|
||||
protected function configure()
|
||||
protected function configure() : void
|
||||
{
|
||||
$fullCommand = $_SERVER['PHP_SELF'];
|
||||
$commandName = \basename($fullCommand);
|
||||
|
|
|
@ -27,6 +27,9 @@ class HelpCommand extends Command
|
|||
* @var \Symfony\Component\Console\Command\Command
|
||||
*/
|
||||
private $command;
|
||||
/**
|
||||
* @return void
|
||||
*/
|
||||
protected function configure()
|
||||
{
|
||||
$this->ignoreValidationErrors();
|
||||
|
@ -47,6 +50,9 @@ To display the list of available commands, please use the <info>list</info> comm
|
|||
EOF
|
||||
);
|
||||
}
|
||||
/**
|
||||
* @return void
|
||||
*/
|
||||
public function setCommand(Command $command)
|
||||
{
|
||||
$this->command = $command;
|
||||
|
|
|
@ -23,6 +23,9 @@ use RectorPrefix202305\Symfony\Component\Console\Output\OutputInterface;
|
|||
*/
|
||||
class ListCommand extends Command
|
||||
{
|
||||
/**
|
||||
* @return void
|
||||
*/
|
||||
protected function configure()
|
||||
{
|
||||
$this->setName('list')->setDefinition([new InputArgument('namespace', InputArgument::OPTIONAL, 'The namespace name', null, function () {
|
||||
|
|
|
@ -32,7 +32,7 @@ trait LockableTrait
|
|||
private function lock(string $name = null, bool $blocking = \false) : bool
|
||||
{
|
||||
if (!\class_exists(SemaphoreStore::class)) {
|
||||
throw new LogicException('To enable the locking feature you must install the symfony/lock component.');
|
||||
throw new LogicException('To enable the locking feature you must install the symfony/lock component. Try running "composer require symfony/lock".');
|
||||
}
|
||||
if (null !== $this->lock) {
|
||||
throw new LogicException('A lock is already in place.');
|
||||
|
@ -52,7 +52,7 @@ trait LockableTrait
|
|||
/**
|
||||
* Releases the command lock if there is one.
|
||||
*/
|
||||
private function release()
|
||||
private function release() : void
|
||||
{
|
||||
if ($this->lock) {
|
||||
$this->lock->release();
|
||||
|
|
|
@ -23,6 +23,9 @@ interface SignalableCommandInterface
|
|||
public function getSubscribedSignals() : array;
|
||||
/**
|
||||
* The method will be called when the application is signaled.
|
||||
*
|
||||
* @param int|false $previousExitCode
|
||||
* @return int|false The exit code to return or false to continue the normal execution
|
||||
*/
|
||||
public function handleSignal(int $signal) : void;
|
||||
public function handleSignal(int $signal);
|
||||
}
|
||||
|
|
|
@ -31,7 +31,7 @@ final class CompletionInput extends ArgvInput
|
|||
private $tokens;
|
||||
private $currentIndex;
|
||||
private $completionType;
|
||||
private $completionName = null;
|
||||
private $completionName;
|
||||
private $completionValue = '';
|
||||
/**
|
||||
* Converts a terminal string into tokens.
|
||||
|
|
|
@ -27,6 +27,9 @@ use RectorPrefix202305\Symfony\Component\DependencyInjection\TypedReference;
|
|||
*/
|
||||
class AddConsoleCommandPass implements CompilerPassInterface
|
||||
{
|
||||
/**
|
||||
* @return void
|
||||
*/
|
||||
public function process(ContainerBuilder $container)
|
||||
{
|
||||
$commandServices = $container->findTaggedServiceIds('console.command', \true);
|
||||
|
|
|
@ -78,7 +78,7 @@ class ApplicationDescription
|
|||
}
|
||||
return $this->commands[$name] ?? $this->aliases[$name];
|
||||
}
|
||||
private function inspectApplication()
|
||||
private function inspectApplication() : void
|
||||
{
|
||||
$this->commands = [];
|
||||
$this->namespaces = [];
|
||||
|
|
19
vendor/symfony/console/Descriptor/Descriptor.php
vendored
19
vendor/symfony/console/Descriptor/Descriptor.php
vendored
|
@ -25,10 +25,10 @@ use RectorPrefix202305\Symfony\Component\Console\Output\OutputInterface;
|
|||
abstract class Descriptor implements DescriptorInterface
|
||||
{
|
||||
/**
|
||||
* @var OutputInterface
|
||||
* @var \Symfony\Component\Console\Output\OutputInterface
|
||||
*/
|
||||
protected $output;
|
||||
public function describe(OutputInterface $output, object $object, array $options = [])
|
||||
public function describe(OutputInterface $output, object $object, array $options = []) : void
|
||||
{
|
||||
$this->output = $output;
|
||||
switch (\true) {
|
||||
|
@ -51,31 +51,28 @@ abstract class Descriptor implements DescriptorInterface
|
|||
throw new InvalidArgumentException(\sprintf('Object of type "%s" is not describable.', \get_debug_type($object)));
|
||||
}
|
||||
}
|
||||
/**
|
||||
* Writes content to output.
|
||||
*/
|
||||
protected function write(string $content, bool $decorated = \false)
|
||||
protected function write(string $content, bool $decorated = \false) : void
|
||||
{
|
||||
$this->output->write($content, \false, $decorated ? OutputInterface::OUTPUT_NORMAL : OutputInterface::OUTPUT_RAW);
|
||||
}
|
||||
/**
|
||||
* Describes an InputArgument instance.
|
||||
*/
|
||||
protected abstract function describeInputArgument(InputArgument $argument, array $options = []);
|
||||
protected abstract function describeInputArgument(InputArgument $argument, array $options = []) : void;
|
||||
/**
|
||||
* Describes an InputOption instance.
|
||||
*/
|
||||
protected abstract function describeInputOption(InputOption $option, array $options = []);
|
||||
protected abstract function describeInputOption(InputOption $option, array $options = []) : void;
|
||||
/**
|
||||
* Describes an InputDefinition instance.
|
||||
*/
|
||||
protected abstract function describeInputDefinition(InputDefinition $definition, array $options = []);
|
||||
protected abstract function describeInputDefinition(InputDefinition $definition, array $options = []) : void;
|
||||
/**
|
||||
* Describes a Command instance.
|
||||
*/
|
||||
protected abstract function describeCommand(Command $command, array $options = []);
|
||||
protected abstract function describeCommand(Command $command, array $options = []) : void;
|
||||
/**
|
||||
* Describes an Application instance.
|
||||
*/
|
||||
protected abstract function describeApplication(Application $application, array $options = []);
|
||||
protected abstract function describeApplication(Application $application, array $options = []) : void;
|
||||
}
|
||||
|
|
|
@ -18,5 +18,8 @@ use RectorPrefix202305\Symfony\Component\Console\Output\OutputInterface;
|
|||
*/
|
||||
interface DescriptorInterface
|
||||
{
|
||||
/**
|
||||
* @return void
|
||||
*/
|
||||
public function describe(OutputInterface $output, object $object, array $options = []);
|
||||
}
|
||||
|
|
|
@ -24,26 +24,26 @@ use RectorPrefix202305\Symfony\Component\Console\Input\InputOption;
|
|||
*/
|
||||
class JsonDescriptor extends Descriptor
|
||||
{
|
||||
protected function describeInputArgument(InputArgument $argument, array $options = [])
|
||||
protected function describeInputArgument(InputArgument $argument, array $options = []) : void
|
||||
{
|
||||
$this->writeData($this->getInputArgumentData($argument), $options);
|
||||
}
|
||||
protected function describeInputOption(InputOption $option, array $options = [])
|
||||
protected function describeInputOption(InputOption $option, array $options = []) : void
|
||||
{
|
||||
$this->writeData($this->getInputOptionData($option), $options);
|
||||
if ($option->isNegatable()) {
|
||||
$this->writeData($this->getInputOptionData($option, \true), $options);
|
||||
}
|
||||
}
|
||||
protected function describeInputDefinition(InputDefinition $definition, array $options = [])
|
||||
protected function describeInputDefinition(InputDefinition $definition, array $options = []) : void
|
||||
{
|
||||
$this->writeData($this->getInputDefinitionData($definition), $options);
|
||||
}
|
||||
protected function describeCommand(Command $command, array $options = [])
|
||||
protected function describeCommand(Command $command, array $options = []) : void
|
||||
{
|
||||
$this->writeData($this->getCommandData($command, $options['short'] ?? \false), $options);
|
||||
}
|
||||
protected function describeApplication(Application $application, array $options = [])
|
||||
protected function describeApplication(Application $application, array $options = []) : void
|
||||
{
|
||||
$describedNamespace = $options['namespace'] ?? null;
|
||||
$description = new ApplicationDescription($application, $describedNamespace, \true);
|
||||
|
@ -69,7 +69,7 @@ class JsonDescriptor extends Descriptor
|
|||
/**
|
||||
* Writes data as json.
|
||||
*/
|
||||
private function writeData(array $data, array $options)
|
||||
private function writeData(array $data, array $options) : void
|
||||
{
|
||||
$flags = $options['json_encoding'] ?? 0;
|
||||
$this->write(\json_encode($data, $flags));
|
||||
|
|
|
@ -26,22 +26,22 @@ use RectorPrefix202305\Symfony\Component\Console\Output\OutputInterface;
|
|||
*/
|
||||
class MarkdownDescriptor extends Descriptor
|
||||
{
|
||||
public function describe(OutputInterface $output, object $object, array $options = [])
|
||||
public function describe(OutputInterface $output, object $object, array $options = []) : void
|
||||
{
|
||||
$decorated = $output->isDecorated();
|
||||
$output->setDecorated(\false);
|
||||
parent::describe($output, $object, $options);
|
||||
$output->setDecorated($decorated);
|
||||
}
|
||||
protected function write(string $content, bool $decorated = \true)
|
||||
protected function write(string $content, bool $decorated = \true) : void
|
||||
{
|
||||
parent::write($content, $decorated);
|
||||
}
|
||||
protected function describeInputArgument(InputArgument $argument, array $options = [])
|
||||
protected function describeInputArgument(InputArgument $argument, array $options = []) : void
|
||||
{
|
||||
$this->write('#### `' . ($argument->getName() ?: '<none>') . "`\n\n" . ($argument->getDescription() ? \preg_replace('/\\s*[\\r\\n]\\s*/', "\n", $argument->getDescription()) . "\n\n" : '') . '* Is required: ' . ($argument->isRequired() ? 'yes' : 'no') . "\n" . '* Is array: ' . ($argument->isArray() ? 'yes' : 'no') . "\n" . '* Default: `' . \str_replace("\n", '', \var_export($argument->getDefault(), \true)) . '`');
|
||||
}
|
||||
protected function describeInputOption(InputOption $option, array $options = [])
|
||||
protected function describeInputOption(InputOption $option, array $options = []) : void
|
||||
{
|
||||
$name = '--' . $option->getName();
|
||||
if ($option->isNegatable()) {
|
||||
|
@ -52,15 +52,13 @@ class MarkdownDescriptor extends Descriptor
|
|||
}
|
||||
$this->write('#### `' . $name . '`' . "\n\n" . ($option->getDescription() ? \preg_replace('/\\s*[\\r\\n]\\s*/', "\n", $option->getDescription()) . "\n\n" : '') . '* Accept value: ' . ($option->acceptValue() ? 'yes' : 'no') . "\n" . '* Is value required: ' . ($option->isValueRequired() ? 'yes' : 'no') . "\n" . '* Is multiple: ' . ($option->isArray() ? 'yes' : 'no') . "\n" . '* Is negatable: ' . ($option->isNegatable() ? 'yes' : 'no') . "\n" . '* Default: `' . \str_replace("\n", '', \var_export($option->getDefault(), \true)) . '`');
|
||||
}
|
||||
protected function describeInputDefinition(InputDefinition $definition, array $options = [])
|
||||
protected function describeInputDefinition(InputDefinition $definition, array $options = []) : void
|
||||
{
|
||||
if ($showArguments = \count($definition->getArguments()) > 0) {
|
||||
$this->write('### Arguments');
|
||||
foreach ($definition->getArguments() as $argument) {
|
||||
$this->write("\n\n");
|
||||
if (null !== ($describeInputArgument = $this->describeInputArgument($argument))) {
|
||||
$this->write($describeInputArgument);
|
||||
}
|
||||
$this->describeInputArgument($argument);
|
||||
}
|
||||
}
|
||||
if (\count($definition->getOptions()) > 0) {
|
||||
|
@ -70,13 +68,11 @@ class MarkdownDescriptor extends Descriptor
|
|||
$this->write('### Options');
|
||||
foreach ($definition->getOptions() as $option) {
|
||||
$this->write("\n\n");
|
||||
if (null !== ($describeInputOption = $this->describeInputOption($option))) {
|
||||
$this->write($describeInputOption);
|
||||
}
|
||||
$this->describeInputOption($option);
|
||||
}
|
||||
}
|
||||
}
|
||||
protected function describeCommand(Command $command, array $options = [])
|
||||
protected function describeCommand(Command $command, array $options = []) : void
|
||||
{
|
||||
if ($options['short'] ?? \false) {
|
||||
$this->write('`' . $command->getName() . "`\n" . \str_repeat('-', Helper::width($command->getName()) + 2) . "\n\n" . ($command->getDescription() ? $command->getDescription() . "\n\n" : '') . '### Usage' . "\n\n" . \array_reduce($command->getAliases(), function ($carry, $usage) {
|
||||
|
@ -98,7 +94,7 @@ class MarkdownDescriptor extends Descriptor
|
|||
$this->describeInputDefinition($definition);
|
||||
}
|
||||
}
|
||||
protected function describeApplication(Application $application, array $options = [])
|
||||
protected function describeApplication(Application $application, array $options = []) : void
|
||||
{
|
||||
$describedNamespace = $options['namespace'] ?? null;
|
||||
$description = new ApplicationDescription($application, $describedNamespace);
|
||||
|
@ -116,9 +112,7 @@ class MarkdownDescriptor extends Descriptor
|
|||
}
|
||||
foreach ($description->getCommands() as $command) {
|
||||
$this->write("\n\n");
|
||||
if (null !== ($describeCommand = $this->describeCommand($command, $options))) {
|
||||
$this->write($describeCommand);
|
||||
}
|
||||
$this->describeCommand($command, $options);
|
||||
}
|
||||
}
|
||||
private function getApplicationTitle(Application $application) : string
|
||||
|
|
234
vendor/symfony/console/Descriptor/ReStructuredTextDescriptor.php
vendored
Normal file
234
vendor/symfony/console/Descriptor/ReStructuredTextDescriptor.php
vendored
Normal file
|
@ -0,0 +1,234 @@
|
|||
<?php
|
||||
|
||||
/*
|
||||
* This file is part of the Symfony package.
|
||||
*
|
||||
* (c) Fabien Potencier <fabien@symfony.com>
|
||||
*
|
||||
* For the full copyright and license information, please view the LICENSE
|
||||
* file that was distributed with this source code.
|
||||
*/
|
||||
namespace RectorPrefix202305\Symfony\Component\Console\Descriptor;
|
||||
|
||||
use RectorPrefix202305\Symfony\Component\Console\Application;
|
||||
use RectorPrefix202305\Symfony\Component\Console\Command\Command;
|
||||
use RectorPrefix202305\Symfony\Component\Console\Helper\Helper;
|
||||
use RectorPrefix202305\Symfony\Component\Console\Input\InputArgument;
|
||||
use RectorPrefix202305\Symfony\Component\Console\Input\InputDefinition;
|
||||
use RectorPrefix202305\Symfony\Component\Console\Input\InputOption;
|
||||
use RectorPrefix202305\Symfony\Component\Console\Output\OutputInterface;
|
||||
use RectorPrefix202305\Symfony\Component\String\UnicodeString;
|
||||
class ReStructuredTextDescriptor extends Descriptor
|
||||
{
|
||||
// <h1>
|
||||
/**
|
||||
* @var string
|
||||
*/
|
||||
private $partChar = '=';
|
||||
// <h2>
|
||||
/**
|
||||
* @var string
|
||||
*/
|
||||
private $chapterChar = '-';
|
||||
// <h3>
|
||||
/**
|
||||
* @var string
|
||||
*/
|
||||
private $sectionChar = '~';
|
||||
// <h4>
|
||||
/**
|
||||
* @var string
|
||||
*/
|
||||
private $subsectionChar = '.';
|
||||
// <h5>
|
||||
/**
|
||||
* @var string
|
||||
*/
|
||||
private $subsubsectionChar = '^';
|
||||
// <h6>
|
||||
/**
|
||||
* @var string
|
||||
*/
|
||||
private $paragraphsChar = '"';
|
||||
/**
|
||||
* @var mixed[]
|
||||
*/
|
||||
private $visibleNamespaces = [];
|
||||
public function describe(OutputInterface $output, object $object, array $options = []) : void
|
||||
{
|
||||
$decorated = $output->isDecorated();
|
||||
$output->setDecorated(\false);
|
||||
parent::describe($output, $object, $options);
|
||||
$output->setDecorated($decorated);
|
||||
}
|
||||
/**
|
||||
* Override parent method to set $decorated = true.
|
||||
*/
|
||||
protected function write(string $content, bool $decorated = \true) : void
|
||||
{
|
||||
parent::write($content, $decorated);
|
||||
}
|
||||
protected function describeInputArgument(InputArgument $argument, array $options = []) : void
|
||||
{
|
||||
$this->write($argument->getName() ?: '<none>' . "\n" . \str_repeat($this->paragraphsChar, Helper::width($argument->getName())) . "\n\n" . ($argument->getDescription() ? \preg_replace('/\\s*[\\r\\n]\\s*/', "\n", $argument->getDescription()) . "\n\n" : '') . '- **Is required**: ' . ($argument->isRequired() ? 'yes' : 'no') . "\n" . '- **Is array**: ' . ($argument->isArray() ? 'yes' : 'no') . "\n" . '- **Default**: ``' . \str_replace("\n", '', \var_export($argument->getDefault(), \true)) . '``');
|
||||
}
|
||||
protected function describeInputOption(InputOption $option, array $options = []) : void
|
||||
{
|
||||
$name = '\\-\\-' . $option->getName();
|
||||
if ($option->isNegatable()) {
|
||||
$name .= '|\\-\\-no-' . $option->getName();
|
||||
}
|
||||
if ($option->getShortcut()) {
|
||||
$name .= '|-' . \str_replace('|', '|-', $option->getShortcut());
|
||||
}
|
||||
$optionDescription = $option->getDescription() ? \preg_replace('/\\s*[\\r\\n]\\s*/', "\n\n", $option->getDescription()) . "\n\n" : '';
|
||||
$optionDescription = (new UnicodeString($optionDescription))->ascii();
|
||||
$this->write($name . "\n" . \str_repeat($this->paragraphsChar, Helper::width($name)) . "\n\n" . $optionDescription . '- **Accept value**: ' . ($option->acceptValue() ? 'yes' : 'no') . "\n" . '- **Is value required**: ' . ($option->isValueRequired() ? 'yes' : 'no') . "\n" . '- **Is multiple**: ' . ($option->isArray() ? 'yes' : 'no') . "\n" . '- **Is negatable**: ' . ($option->isNegatable() ? 'yes' : 'no') . "\n" . '- **Default**: ``' . \str_replace("\n", '', \var_export($option->getDefault(), \true)) . '``' . "\n");
|
||||
}
|
||||
protected function describeInputDefinition(InputDefinition $definition, array $options = []) : void
|
||||
{
|
||||
if ($showArguments = (bool) $definition->getArguments()) {
|
||||
$this->write("Arguments\n" . \str_repeat($this->subsubsectionChar, 9)) . "\n\n";
|
||||
foreach ($definition->getArguments() as $argument) {
|
||||
$this->write("\n\n");
|
||||
$this->describeInputArgument($argument);
|
||||
}
|
||||
}
|
||||
if ($nonDefaultOptions = $this->getNonDefaultOptions($definition)) {
|
||||
if ($showArguments) {
|
||||
$this->write("\n\n");
|
||||
}
|
||||
$this->write("Options\n" . \str_repeat($this->subsubsectionChar, 7) . "\n\n");
|
||||
foreach ($nonDefaultOptions as $option) {
|
||||
$this->describeInputOption($option);
|
||||
$this->write("\n");
|
||||
}
|
||||
}
|
||||
}
|
||||
protected function describeCommand(Command $command, array $options = []) : void
|
||||
{
|
||||
if ($options['short'] ?? \false) {
|
||||
$this->write('``' . $command->getName() . "``\n" . \str_repeat($this->subsectionChar, Helper::width($command->getName())) . "\n\n" . ($command->getDescription() ? $command->getDescription() . "\n\n" : '') . "Usage\n" . \str_repeat($this->paragraphsChar, 5) . "\n\n" . \array_reduce($command->getAliases(), static function ($carry, $usage) {
|
||||
return $carry . '- ``' . $usage . '``' . "\n";
|
||||
}));
|
||||
return;
|
||||
}
|
||||
$command->mergeApplicationDefinition(\false);
|
||||
foreach ($command->getAliases() as $alias) {
|
||||
$this->write('.. _' . $alias . ":\n\n");
|
||||
}
|
||||
$this->write($command->getName() . "\n" . \str_repeat($this->subsectionChar, Helper::width($command->getName())) . "\n\n" . ($command->getDescription() ? $command->getDescription() . "\n\n" : '') . "Usage\n" . \str_repeat($this->subsubsectionChar, 5) . "\n\n" . \array_reduce(\array_merge([$command->getSynopsis()], $command->getAliases(), $command->getUsages()), static function ($carry, $usage) {
|
||||
return $carry . '- ``' . $usage . '``' . "\n";
|
||||
}));
|
||||
if ($help = $command->getProcessedHelp()) {
|
||||
$this->write("\n");
|
||||
$this->write($help);
|
||||
}
|
||||
$definition = $command->getDefinition();
|
||||
if ($definition->getOptions() || $definition->getArguments()) {
|
||||
$this->write("\n\n");
|
||||
$this->describeInputDefinition($definition);
|
||||
}
|
||||
}
|
||||
protected function describeApplication(Application $application, array $options = []) : void
|
||||
{
|
||||
$description = new ApplicationDescription($application, $options['namespace'] ?? null);
|
||||
$title = $this->getApplicationTitle($application);
|
||||
$this->write($title . "\n" . \str_repeat($this->partChar, Helper::width($title)));
|
||||
$this->createTableOfContents($description, $application);
|
||||
$this->describeCommands($application, $options);
|
||||
}
|
||||
private function getApplicationTitle(Application $application) : string
|
||||
{
|
||||
if ('UNKNOWN' === $application->getName()) {
|
||||
return 'Console Tool';
|
||||
}
|
||||
if ('UNKNOWN' !== $application->getVersion()) {
|
||||
return \sprintf('%s %s', $application->getName(), $application->getVersion());
|
||||
}
|
||||
return $application->getName();
|
||||
}
|
||||
private function describeCommands($application, array $options) : void
|
||||
{
|
||||
$title = 'Commands';
|
||||
$this->write("\n\n{$title}\n" . \str_repeat($this->chapterChar, Helper::width($title)) . "\n\n");
|
||||
foreach ($this->visibleNamespaces as $namespace) {
|
||||
if ('_global' === $namespace) {
|
||||
$commands = $application->all('');
|
||||
$this->write('Global' . "\n" . \str_repeat($this->sectionChar, Helper::width('Global')) . "\n\n");
|
||||
} else {
|
||||
$commands = $application->all($namespace);
|
||||
$this->write($namespace . "\n" . \str_repeat($this->sectionChar, Helper::width($namespace)) . "\n\n");
|
||||
}
|
||||
foreach ($this->removeAliasesAndHiddenCommands($commands) as $command) {
|
||||
$this->describeCommand($command, $options);
|
||||
$this->write("\n\n");
|
||||
}
|
||||
}
|
||||
}
|
||||
private function createTableOfContents(ApplicationDescription $description, Application $application) : void
|
||||
{
|
||||
$this->setVisibleNamespaces($description);
|
||||
$chapterTitle = 'Table of Contents';
|
||||
$this->write("\n\n{$chapterTitle}\n" . \str_repeat($this->chapterChar, Helper::width($chapterTitle)) . "\n\n");
|
||||
foreach ($this->visibleNamespaces as $namespace) {
|
||||
if ('_global' === $namespace) {
|
||||
$commands = $application->all('');
|
||||
} else {
|
||||
$commands = $application->all($namespace);
|
||||
$this->write("\n\n");
|
||||
$this->write($namespace . "\n" . \str_repeat($this->sectionChar, Helper::width($namespace)) . "\n\n");
|
||||
}
|
||||
$commands = $this->removeAliasesAndHiddenCommands($commands);
|
||||
$this->write("\n\n");
|
||||
$this->write(\implode("\n", \array_map(static function ($commandName) {
|
||||
return \sprintf('- `%s`_', $commandName);
|
||||
}, \array_keys($commands))));
|
||||
}
|
||||
}
|
||||
private function getNonDefaultOptions(InputDefinition $definition) : array
|
||||
{
|
||||
$globalOptions = ['help', 'quiet', 'verbose', 'version', 'ansi', 'no-interaction'];
|
||||
$nonDefaultOptions = [];
|
||||
foreach ($definition->getOptions() as $option) {
|
||||
// Skip global options.
|
||||
if (!\in_array($option->getName(), $globalOptions)) {
|
||||
$nonDefaultOptions[] = $option;
|
||||
}
|
||||
}
|
||||
return $nonDefaultOptions;
|
||||
}
|
||||
private function setVisibleNamespaces(ApplicationDescription $description) : void
|
||||
{
|
||||
$commands = $description->getCommands();
|
||||
foreach ($description->getNamespaces() as $namespace) {
|
||||
try {
|
||||
$namespaceCommands = $namespace['commands'];
|
||||
foreach ($namespaceCommands as $key => $commandName) {
|
||||
if (!\array_key_exists($commandName, $commands)) {
|
||||
// If the array key does not exist, then this is an alias.
|
||||
unset($namespaceCommands[$key]);
|
||||
} elseif ($commands[$commandName]->isHidden()) {
|
||||
unset($namespaceCommands[$key]);
|
||||
}
|
||||
}
|
||||
if (!$namespaceCommands) {
|
||||
// If the namespace contained only aliases or hidden commands, skip the namespace.
|
||||
continue;
|
||||
}
|
||||
} catch (\Exception $exception) {
|
||||
}
|
||||
$this->visibleNamespaces[] = $namespace['id'];
|
||||
}
|
||||
}
|
||||
private function removeAliasesAndHiddenCommands(array $commands) : array
|
||||
{
|
||||
foreach ($commands as $key => $command) {
|
||||
if ($command->isHidden() || \in_array($key, $command->getAliases(), \true)) {
|
||||
unset($commands[$key]);
|
||||
}
|
||||
}
|
||||
unset($commands['completion']);
|
||||
return $commands;
|
||||
}
|
||||
}
|
|
@ -26,7 +26,7 @@ use RectorPrefix202305\Symfony\Component\Console\Input\InputOption;
|
|||
*/
|
||||
class TextDescriptor extends Descriptor
|
||||
{
|
||||
protected function describeInputArgument(InputArgument $argument, array $options = [])
|
||||
protected function describeInputArgument(InputArgument $argument, array $options = []) : void
|
||||
{
|
||||
if (null !== $argument->getDefault() && (!\is_array($argument->getDefault()) || \count($argument->getDefault()))) {
|
||||
$default = \sprintf('<comment> [default: %s]</comment>', $this->formatDefaultValue($argument->getDefault()));
|
||||
|
@ -44,7 +44,7 @@ class TextDescriptor extends Descriptor
|
|||
$default
|
||||
), $options);
|
||||
}
|
||||
protected function describeInputOption(InputOption $option, array $options = [])
|
||||
protected function describeInputOption(InputOption $option, array $options = []) : void
|
||||
{
|
||||
if ($option->acceptValue() && null !== $option->getDefault() && (!\is_array($option->getDefault()) || \count($option->getDefault()))) {
|
||||
$default = \sprintf('<comment> [default: %s]</comment>', $this->formatDefaultValue($option->getDefault()));
|
||||
|
@ -71,7 +71,7 @@ class TextDescriptor extends Descriptor
|
|||
$option->isArray() ? '<comment> (multiple values allowed)</comment>' : ''
|
||||
), $options);
|
||||
}
|
||||
protected function describeInputDefinition(InputDefinition $definition, array $options = [])
|
||||
protected function describeInputDefinition(InputDefinition $definition, array $options = []) : void
|
||||
{
|
||||
$totalWidth = $this->calculateTotalWidthForOptions($definition->getOptions());
|
||||
foreach ($definition->getArguments() as $argument) {
|
||||
|
@ -105,7 +105,7 @@ class TextDescriptor extends Descriptor
|
|||
}
|
||||
}
|
||||
}
|
||||
protected function describeCommand(Command $command, array $options = [])
|
||||
protected function describeCommand(Command $command, array $options = []) : void
|
||||
{
|
||||
$command->mergeApplicationDefinition(\false);
|
||||
if ($description = $command->getDescription()) {
|
||||
|
@ -135,7 +135,7 @@ class TextDescriptor extends Descriptor
|
|||
$this->writeText("\n");
|
||||
}
|
||||
}
|
||||
protected function describeApplication(Application $application, array $options = [])
|
||||
protected function describeApplication(Application $application, array $options = []) : void
|
||||
{
|
||||
$describedNamespace = $options['namespace'] ?? null;
|
||||
$description = new ApplicationDescription($application, $describedNamespace);
|
||||
|
@ -194,7 +194,7 @@ class TextDescriptor extends Descriptor
|
|||
$this->writeText("\n");
|
||||
}
|
||||
}
|
||||
private function writeText(string $content, array $options = [])
|
||||
private function writeText(string $content, array $options = []) : void
|
||||
{
|
||||
$this->write(isset($options['raw_text']) && $options['raw_text'] ? \strip_tags($content) : $content, isset($options['raw_output']) ? !$options['raw_output'] : \true);
|
||||
}
|
||||
|
|
|
@ -95,30 +95,30 @@ class XmlDescriptor extends Descriptor
|
|||
}
|
||||
return $dom;
|
||||
}
|
||||
protected function describeInputArgument(InputArgument $argument, array $options = [])
|
||||
protected function describeInputArgument(InputArgument $argument, array $options = []) : void
|
||||
{
|
||||
$this->writeDocument($this->getInputArgumentDocument($argument));
|
||||
}
|
||||
protected function describeInputOption(InputOption $option, array $options = [])
|
||||
protected function describeInputOption(InputOption $option, array $options = []) : void
|
||||
{
|
||||
$this->writeDocument($this->getInputOptionDocument($option));
|
||||
}
|
||||
protected function describeInputDefinition(InputDefinition $definition, array $options = [])
|
||||
protected function describeInputDefinition(InputDefinition $definition, array $options = []) : void
|
||||
{
|
||||
$this->writeDocument($this->getInputDefinitionDocument($definition));
|
||||
}
|
||||
protected function describeCommand(Command $command, array $options = [])
|
||||
protected function describeCommand(Command $command, array $options = []) : void
|
||||
{
|
||||
$this->writeDocument($this->getCommandDocument($command, $options['short'] ?? \false));
|
||||
}
|
||||
protected function describeApplication(Application $application, array $options = [])
|
||||
protected function describeApplication(Application $application, array $options = []) : void
|
||||
{
|
||||
$this->writeDocument($this->getApplicationDocument($application, $options['namespace'] ?? null, $options['short'] ?? \false));
|
||||
}
|
||||
/**
|
||||
* Appends document children to parent node.
|
||||
*/
|
||||
private function appendDocument(\DOMNode $parentNode, \DOMNode $importedParent)
|
||||
private function appendDocument(\DOMNode $parentNode, \DOMNode $importedParent) : void
|
||||
{
|
||||
foreach ($importedParent->childNodes as $childNode) {
|
||||
$parentNode->appendChild($parentNode->ownerDocument->importNode($childNode, \true));
|
||||
|
@ -127,7 +127,7 @@ class XmlDescriptor extends Descriptor
|
|||
/**
|
||||
* Writes DOM document.
|
||||
*/
|
||||
private function writeDocument(\DOMDocument $dom)
|
||||
private function writeDocument(\DOMDocument $dom) : void
|
||||
{
|
||||
$dom->formatOutput = \true;
|
||||
$this->write($dom->saveXML());
|
||||
|
|
|
@ -78,6 +78,9 @@ class OutputFormatter implements WrappableOutputFormatterInterface
|
|||
}
|
||||
$this->styleStack = new OutputFormatterStyleStack();
|
||||
}
|
||||
/**
|
||||
* @return void
|
||||
*/
|
||||
public function setDecorated(bool $decorated)
|
||||
{
|
||||
$this->decorated = $decorated;
|
||||
|
@ -86,6 +89,9 @@ class OutputFormatter implements WrappableOutputFormatterInterface
|
|||
{
|
||||
return $this->decorated;
|
||||
}
|
||||
/**
|
||||
* @return void
|
||||
*/
|
||||
public function setStyle(string $name, OutputFormatterStyleInterface $style)
|
||||
{
|
||||
$this->styles[\strtolower($name)] = $style;
|
||||
|
@ -105,6 +111,9 @@ class OutputFormatter implements WrappableOutputFormatterInterface
|
|||
{
|
||||
return $this->formatAndWrap($message, 0);
|
||||
}
|
||||
/**
|
||||
* @return string
|
||||
*/
|
||||
public function formatAndWrap(?string $message, int $width)
|
||||
{
|
||||
if (null === $message) {
|
||||
|
|
|
@ -19,6 +19,8 @@ interface OutputFormatterInterface
|
|||
{
|
||||
/**
|
||||
* Sets the decorated flag.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function setDecorated(bool $decorated);
|
||||
/**
|
||||
|
@ -27,6 +29,8 @@ interface OutputFormatterInterface
|
|||
public function isDecorated() : bool;
|
||||
/**
|
||||
* Sets a new style.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function setStyle(string $name, OutputFormatterStyleInterface $style);
|
||||
/**
|
||||
|
|
|
@ -52,6 +52,9 @@ class OutputFormatterStyle implements OutputFormatterStyleInterface
|
|||
{
|
||||
$this->color = new Color($this->foreground = $foreground ?: '', $this->background = $background ?: '', $this->options = $options);
|
||||
}
|
||||
/**
|
||||
* @return void
|
||||
*/
|
||||
public function setForeground(string $color = null)
|
||||
{
|
||||
if (1 > \func_num_args()) {
|
||||
|
@ -59,6 +62,9 @@ class OutputFormatterStyle implements OutputFormatterStyleInterface
|
|||
}
|
||||
$this->color = new Color($this->foreground = $color ?: '', $this->background, $this->options);
|
||||
}
|
||||
/**
|
||||
* @return void
|
||||
*/
|
||||
public function setBackground(string $color = null)
|
||||
{
|
||||
if (1 > \func_num_args()) {
|
||||
|
@ -70,11 +76,17 @@ class OutputFormatterStyle implements OutputFormatterStyleInterface
|
|||
{
|
||||
$this->href = $url;
|
||||
}
|
||||
/**
|
||||
* @return void
|
||||
*/
|
||||
public function setOption(string $option)
|
||||
{
|
||||
$this->options[] = $option;
|
||||
$this->color = new Color($this->foreground, $this->background, $this->options);
|
||||
}
|
||||
/**
|
||||
* @return void
|
||||
*/
|
||||
public function unsetOption(string $option)
|
||||
{
|
||||
$pos = \array_search($option, $this->options);
|
||||
|
@ -83,6 +95,9 @@ class OutputFormatterStyle implements OutputFormatterStyleInterface
|
|||
}
|
||||
$this->color = new Color($this->foreground, $this->background, $this->options);
|
||||
}
|
||||
/**
|
||||
* @return void
|
||||
*/
|
||||
public function setOptions(array $options)
|
||||
{
|
||||
$this->color = new Color($this->foreground, $this->background, $this->options = $options);
|
||||
|
|
|
@ -19,22 +19,32 @@ interface OutputFormatterStyleInterface
|
|||
{
|
||||
/**
|
||||
* Sets style foreground color.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function setForeground(?string $color);
|
||||
/**
|
||||
* Sets style background color.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function setBackground(?string $color);
|
||||
/**
|
||||
* Sets some specific style option.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function setOption(string $option);
|
||||
/**
|
||||
* Unsets some specific style option.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function unsetOption(string $option);
|
||||
/**
|
||||
* Sets multiple style options at once.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function setOptions(array $options);
|
||||
/**
|
||||
|
|
|
@ -32,6 +32,8 @@ class OutputFormatterStyleStack implements ResetInterface
|
|||
}
|
||||
/**
|
||||
* Resets stack (ie. empty internal arrays).
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function reset()
|
||||
{
|
||||
|
@ -39,6 +41,8 @@ class OutputFormatterStyleStack implements ResetInterface
|
|||
}
|
||||
/**
|
||||
* Pushes a style in the stack.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function push(OutputFormatterStyleInterface $style)
|
||||
{
|
||||
|
|
|
@ -13,6 +13,7 @@ namespace RectorPrefix202305\Symfony\Component\Console\Helper;
|
|||
use RectorPrefix202305\Symfony\Component\Console\Descriptor\DescriptorInterface;
|
||||
use RectorPrefix202305\Symfony\Component\Console\Descriptor\JsonDescriptor;
|
||||
use RectorPrefix202305\Symfony\Component\Console\Descriptor\MarkdownDescriptor;
|
||||
use RectorPrefix202305\Symfony\Component\Console\Descriptor\ReStructuredTextDescriptor;
|
||||
use RectorPrefix202305\Symfony\Component\Console\Descriptor\TextDescriptor;
|
||||
use RectorPrefix202305\Symfony\Component\Console\Descriptor\XmlDescriptor;
|
||||
use RectorPrefix202305\Symfony\Component\Console\Exception\InvalidArgumentException;
|
||||
|
@ -30,7 +31,7 @@ class DescriptorHelper extends Helper
|
|||
private $descriptors = [];
|
||||
public function __construct()
|
||||
{
|
||||
$this->register('txt', new TextDescriptor())->register('xml', new XmlDescriptor())->register('json', new JsonDescriptor())->register('md', new MarkdownDescriptor());
|
||||
$this->register('txt', new TextDescriptor())->register('xml', new XmlDescriptor())->register('json', new JsonDescriptor())->register('md', new MarkdownDescriptor())->register('rst', new ReStructuredTextDescriptor());
|
||||
}
|
||||
/**
|
||||
* Describes an object if supported.
|
||||
|
@ -39,6 +40,8 @@ class DescriptorHelper extends Helper
|
|||
* * format: string, the output format name
|
||||
* * raw_text: boolean, sets output type as raw
|
||||
*
|
||||
* @return void
|
||||
*
|
||||
* @throws InvalidArgumentException when the given format is not supported
|
||||
*/
|
||||
public function describe(OutputInterface $output, ?object $object, array $options = [])
|
||||
|
|
12
vendor/symfony/console/Helper/Helper.php
vendored
12
vendor/symfony/console/Helper/Helper.php
vendored
|
@ -19,7 +19,10 @@ use RectorPrefix202305\Symfony\Component\String\UnicodeString;
|
|||
*/
|
||||
abstract class Helper implements HelperInterface
|
||||
{
|
||||
protected $helperSet = null;
|
||||
protected $helperSet;
|
||||
/**
|
||||
* @return void
|
||||
*/
|
||||
public function setHelperSet(HelperSet $helperSet = null)
|
||||
{
|
||||
if (1 > \func_num_args()) {
|
||||
|
@ -73,6 +76,7 @@ abstract class Helper implements HelperInterface
|
|||
return \mb_substr($string, $from, $length, $encoding);
|
||||
}
|
||||
/**
|
||||
* @return string
|
||||
* @param int|float $secs
|
||||
*/
|
||||
public static function formatTime($secs)
|
||||
|
@ -89,6 +93,9 @@ abstract class Helper implements HelperInterface
|
|||
}
|
||||
}
|
||||
}
|
||||
/**
|
||||
* @return string
|
||||
*/
|
||||
public static function formatMemory(int $memory)
|
||||
{
|
||||
if ($memory >= 1024 * 1024 * 1024) {
|
||||
|
@ -102,6 +109,9 @@ abstract class Helper implements HelperInterface
|
|||
}
|
||||
return \sprintf('%d B', $memory);
|
||||
}
|
||||
/**
|
||||
* @return string
|
||||
*/
|
||||
public static function removeDecoration(OutputFormatterInterface $formatter, ?string $string)
|
||||
{
|
||||
$isDecorated = $formatter->isDecorated();
|
||||
|
|
|
@ -19,6 +19,8 @@ interface HelperInterface
|
|||
{
|
||||
/**
|
||||
* Sets the helper set associated with this helper.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function setHelperSet(?HelperSet $helperSet);
|
||||
/**
|
||||
|
|
3
vendor/symfony/console/Helper/HelperSet.php
vendored
3
vendor/symfony/console/Helper/HelperSet.php
vendored
|
@ -31,6 +31,9 @@ class HelperSet implements \IteratorAggregate
|
|||
$this->set($helper, \is_int($alias) ? null : $alias);
|
||||
}
|
||||
}
|
||||
/**
|
||||
* @return void
|
||||
*/
|
||||
public function set(HelperInterface $helper, string $alias = null)
|
||||
{
|
||||
$this->helpers[$helper->getName()] = $helper;
|
||||
|
|
|
@ -20,6 +20,9 @@ use RectorPrefix202305\Symfony\Component\Console\Input\InputInterface;
|
|||
abstract class InputAwareHelper extends Helper implements InputAwareInterface
|
||||
{
|
||||
protected $input;
|
||||
/**
|
||||
* @return void
|
||||
*/
|
||||
public function setInput(InputInterface $input)
|
||||
{
|
||||
$this->input = $input;
|
||||
|
|
56
vendor/symfony/console/Helper/ProgressBar.php
vendored
56
vendor/symfony/console/Helper/ProgressBar.php
vendored
|
@ -124,6 +124,10 @@ final class ProgressBar
|
|||
* @var \Symfony\Component\Console\Cursor
|
||||
*/
|
||||
private $cursor;
|
||||
/**
|
||||
* @var mixed[]
|
||||
*/
|
||||
private $placeholders = [];
|
||||
/**
|
||||
* @var mixed[]
|
||||
*/
|
||||
|
@ -157,12 +161,12 @@ final class ProgressBar
|
|||
$this->cursor = new Cursor($output);
|
||||
}
|
||||
/**
|
||||
* Sets a placeholder formatter for a given name.
|
||||
* Sets a placeholder formatter for a given name, globally for all instances of ProgressBar.
|
||||
*
|
||||
* This method also allow you to override an existing placeholder.
|
||||
*
|
||||
* @param string $name The placeholder name (including the delimiter char like %)
|
||||
* @param callable $callable A PHP callable
|
||||
* @param string $name The placeholder name (including the delimiter char like %)
|
||||
* @param callable(ProgressBar):string $callable A PHP callable
|
||||
*/
|
||||
public static function setPlaceholderFormatterDefinition(string $name, callable $callable) : void
|
||||
{
|
||||
|
@ -179,6 +183,24 @@ final class ProgressBar
|
|||
self::$formatters = self::$formatters ?? self::initPlaceholderFormatters();
|
||||
return self::$formatters[$name] ?? null;
|
||||
}
|
||||
/**
|
||||
* Sets a placeholder formatter for a given name, for this instance only.
|
||||
*
|
||||
* @param callable(ProgressBar):string $callable A PHP callable
|
||||
*/
|
||||
public function setPlaceholderFormatter(string $name, callable $callable) : void
|
||||
{
|
||||
$this->placeholders[$name] = $callable;
|
||||
}
|
||||
/**
|
||||
* Gets the placeholder formatter for a given name.
|
||||
*
|
||||
* @param string $name The placeholder name (including the delimiter char like %)
|
||||
*/
|
||||
public function getPlaceholderFormatter(string $name) : ?callable
|
||||
{
|
||||
return $this->placeholders[$name] ?? $this::getPlaceholderFormatterDefinition($name);
|
||||
}
|
||||
/**
|
||||
* Sets a format for a given name.
|
||||
*
|
||||
|
@ -212,11 +234,11 @@ final class ProgressBar
|
|||
* @param string $message The text to associate with the placeholder
|
||||
* @param string $name The name of the placeholder
|
||||
*/
|
||||
public function setMessage(string $message, string $name = 'message')
|
||||
public function setMessage(string $message, string $name = 'message') : void
|
||||
{
|
||||
$this->messages[$name] = $message;
|
||||
}
|
||||
public function getMessage(string $name = 'message')
|
||||
public function getMessage(string $name = 'message') : string
|
||||
{
|
||||
return $this->messages[$name];
|
||||
}
|
||||
|
@ -258,7 +280,7 @@ final class ProgressBar
|
|||
}
|
||||
return \round((\time() - $this->startTime) / ($this->step - $this->startingStep) * ($this->max - $this->step));
|
||||
}
|
||||
public function setBarWidth(int $size)
|
||||
public function setBarWidth(int $size) : void
|
||||
{
|
||||
$this->barWidth = \max(1, $size);
|
||||
}
|
||||
|
@ -266,7 +288,7 @@ final class ProgressBar
|
|||
{
|
||||
return $this->barWidth;
|
||||
}
|
||||
public function setBarCharacter(string $char)
|
||||
public function setBarCharacter(string $char) : void
|
||||
{
|
||||
$this->barChar = $char;
|
||||
}
|
||||
|
@ -274,7 +296,7 @@ final class ProgressBar
|
|||
{
|
||||
return $this->barChar ?? ($this->max ? '=' : $this->emptyBarChar);
|
||||
}
|
||||
public function setEmptyBarCharacter(string $char)
|
||||
public function setEmptyBarCharacter(string $char) : void
|
||||
{
|
||||
$this->emptyBarChar = $char;
|
||||
}
|
||||
|
@ -282,7 +304,7 @@ final class ProgressBar
|
|||
{
|
||||
return $this->emptyBarChar;
|
||||
}
|
||||
public function setProgressCharacter(string $char)
|
||||
public function setProgressCharacter(string $char) : void
|
||||
{
|
||||
$this->progressChar = $char;
|
||||
}
|
||||
|
@ -290,7 +312,7 @@ final class ProgressBar
|
|||
{
|
||||
return $this->progressChar;
|
||||
}
|
||||
public function setFormat(string $format)
|
||||
public function setFormat(string $format) : void
|
||||
{
|
||||
$this->format = null;
|
||||
$this->internalFormat = $format;
|
||||
|
@ -300,7 +322,7 @@ final class ProgressBar
|
|||
*
|
||||
* @param int|null $freq The frequency in steps
|
||||
*/
|
||||
public function setRedrawFrequency(?int $freq)
|
||||
public function setRedrawFrequency(?int $freq) : void
|
||||
{
|
||||
$this->redrawFreq = null !== $freq ? \max(1, $freq) : null;
|
||||
}
|
||||
|
@ -348,18 +370,18 @@ final class ProgressBar
|
|||
*
|
||||
* @param int $step Number of steps to advance
|
||||
*/
|
||||
public function advance(int $step = 1)
|
||||
public function advance(int $step = 1) : void
|
||||
{
|
||||
$this->setProgress($this->step + $step);
|
||||
}
|
||||
/**
|
||||
* Sets whether to overwrite the progressbar, false for new line.
|
||||
*/
|
||||
public function setOverwrite(bool $overwrite)
|
||||
public function setOverwrite(bool $overwrite) : void
|
||||
{
|
||||
$this->overwrite = $overwrite;
|
||||
}
|
||||
public function setProgress(int $step)
|
||||
public function setProgress(int $step) : void
|
||||
{
|
||||
if ($this->max && $step > $this->max) {
|
||||
$this->max = $step;
|
||||
|
@ -386,7 +408,7 @@ final class ProgressBar
|
|||
$this->display();
|
||||
}
|
||||
}
|
||||
public function setMaxSteps(int $max)
|
||||
public function setMaxSteps(int $max) : void
|
||||
{
|
||||
$this->format = null;
|
||||
$this->max = \max(0, $max);
|
||||
|
@ -436,7 +458,7 @@ final class ProgressBar
|
|||
}
|
||||
$this->overwrite('');
|
||||
}
|
||||
private function setRealFormat(string $format)
|
||||
private function setRealFormat(string $format) : void
|
||||
{
|
||||
// try to use the _nomax variant if available
|
||||
if (!$this->max && null !== self::getFormatDefinition($format . '_nomax')) {
|
||||
|
@ -541,7 +563,7 @@ final class ProgressBar
|
|||
\assert(null !== $this->format);
|
||||
$regex = "{%([a-z\\-_]+)(?:\\:([^%]+))?%}i";
|
||||
$callback = function ($matches) {
|
||||
if ($formatter = $this::getPlaceholderFormatterDefinition($matches[1])) {
|
||||
if ($formatter = $this->getPlaceholderFormatter($matches[1])) {
|
||||
$text = $formatter($this, $this->output);
|
||||
} elseif (isset($this->messages[$matches[1]])) {
|
||||
$text = $this->messages[$matches[1]];
|
||||
|
|
|
@ -79,6 +79,8 @@ class ProgressIndicator
|
|||
}
|
||||
/**
|
||||
* Sets the current indicator message.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function setMessage(?string $message)
|
||||
{
|
||||
|
@ -87,6 +89,8 @@ class ProgressIndicator
|
|||
}
|
||||
/**
|
||||
* Starts the indicator output.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function start(string $message)
|
||||
{
|
||||
|
@ -102,6 +106,8 @@ class ProgressIndicator
|
|||
}
|
||||
/**
|
||||
* Advances the indicator.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function advance()
|
||||
{
|
||||
|
@ -121,6 +127,8 @@ class ProgressIndicator
|
|||
}
|
||||
/**
|
||||
* Finish the indicator with message.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function finish(string $message)
|
||||
{
|
||||
|
@ -143,6 +151,8 @@ class ProgressIndicator
|
|||
* Sets a placeholder formatter for a given name.
|
||||
*
|
||||
* This method also allow you to override an existing placeholder.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public static function setPlaceholderFormatterDefinition(string $name, callable $callable)
|
||||
{
|
||||
|
@ -157,7 +167,7 @@ class ProgressIndicator
|
|||
self::$formatters = self::$formatters ?? self::initPlaceholderFormatters();
|
||||
return self::$formatters[$name] ?? null;
|
||||
}
|
||||
private function display()
|
||||
private function display() : void
|
||||
{
|
||||
if (OutputInterface::VERBOSITY_QUIET === $this->output->getVerbosity()) {
|
||||
return;
|
||||
|
@ -184,7 +194,7 @@ class ProgressIndicator
|
|||
/**
|
||||
* Overwrites a previous message to the output.
|
||||
*/
|
||||
private function overwrite(string $message)
|
||||
private function overwrite(string $message) : void
|
||||
{
|
||||
if ($this->output->isDecorated()) {
|
||||
$this->output->write("\r\x1b[2K");
|
||||
|
|
|
@ -83,6 +83,8 @@ class QuestionHelper extends Helper
|
|||
}
|
||||
/**
|
||||
* Prevents usage of stty.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public static function disableStty()
|
||||
{
|
||||
|
@ -152,7 +154,7 @@ class QuestionHelper extends Helper
|
|||
return $default;
|
||||
}
|
||||
if ($validator = $question->getValidator()) {
|
||||
return \call_user_func($question->getValidator(), $default);
|
||||
return \call_user_func($validator, $default);
|
||||
} elseif ($question instanceof ChoiceQuestion) {
|
||||
$choices = $question->getChoices();
|
||||
if (!$question->isMultiselect()) {
|
||||
|
@ -168,6 +170,8 @@ class QuestionHelper extends Helper
|
|||
}
|
||||
/**
|
||||
* Outputs the question prompt.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
protected function writePrompt(OutputInterface $output, Question $question)
|
||||
{
|
||||
|
@ -193,6 +197,8 @@ class QuestionHelper extends Helper
|
|||
}
|
||||
/**
|
||||
* Outputs an error message.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
protected function writeError(OutputInterface $output, \Exception $error)
|
||||
{
|
||||
|
|
|
@ -23,6 +23,9 @@ use RectorPrefix202305\Symfony\Component\Console\Style\SymfonyStyle;
|
|||
*/
|
||||
class SymfonyQuestionHelper extends QuestionHelper
|
||||
{
|
||||
/**
|
||||
* @return void
|
||||
*/
|
||||
protected function writePrompt(OutputInterface $output, Question $question)
|
||||
{
|
||||
$text = OutputFormatter::escapeTrailingBackslash($question->getQuestion());
|
||||
|
@ -60,6 +63,9 @@ class SymfonyQuestionHelper extends QuestionHelper
|
|||
}
|
||||
$output->write($prompt);
|
||||
}
|
||||
/**
|
||||
* @return void
|
||||
*/
|
||||
protected function writeError(OutputInterface $output, \Exception $error)
|
||||
{
|
||||
if ($output instanceof SymfonyStyle) {
|
||||
|
|
16
vendor/symfony/console/Helper/Table.php
vendored
16
vendor/symfony/console/Helper/Table.php
vendored
|
@ -100,6 +100,8 @@ class Table
|
|||
}
|
||||
/**
|
||||
* Sets a style definition.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public static function setStyleDefinition(string $name, TableStyle $style)
|
||||
{
|
||||
|
@ -309,6 +311,8 @@ class Table
|
|||
* | 9971-5-0210-0 | A Tale of Two Cities | Charles Dickens |
|
||||
* | 960-425-059-0 | The Lord of the Rings | J. R. R. Tolkien |
|
||||
* +---------------+-----------------------+------------------+
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function render()
|
||||
{
|
||||
|
@ -420,7 +424,7 @@ class Table
|
|||
*
|
||||
* +-----+-----------+-------+
|
||||
*/
|
||||
private function renderRowSeparator(int $type = self::SEPARATOR_MID, string $title = null, string $titleFormat = null)
|
||||
private function renderRowSeparator(int $type = self::SEPARATOR_MID, string $title = null, string $titleFormat = null) : void
|
||||
{
|
||||
if (!($count = $this->numberOfColumns)) {
|
||||
return;
|
||||
|
@ -476,7 +480,7 @@ class Table
|
|||
*
|
||||
* | 9971-5-0210-0 | A Tale of Two Cities | Charles Dickens |
|
||||
*/
|
||||
private function renderRow(array $row, string $cellFormat, string $firstCellFormat = null)
|
||||
private function renderRow(array $row, string $cellFormat, string $firstCellFormat = null) : void
|
||||
{
|
||||
$rowContent = $this->renderColumnSeparator(self::BORDER_OUTSIDE);
|
||||
$columns = $this->getRowColumns($row);
|
||||
|
@ -539,7 +543,7 @@ class Table
|
|||
/**
|
||||
* Calculate number of columns for this table.
|
||||
*/
|
||||
private function calculateNumberOfColumns(array $rows)
|
||||
private function calculateNumberOfColumns(array $rows) : void
|
||||
{
|
||||
$columns = [0];
|
||||
foreach ($rows as $row) {
|
||||
|
@ -663,7 +667,7 @@ class Table
|
|||
/**
|
||||
* fill cells for a row that contains colspan > 1.
|
||||
*/
|
||||
private function fillCells(iterable $row)
|
||||
private function fillCells(iterable $row) : iterable
|
||||
{
|
||||
$newRow = [];
|
||||
foreach ($row as $column => $cell) {
|
||||
|
@ -716,7 +720,7 @@ class Table
|
|||
/**
|
||||
* Calculates columns widths.
|
||||
*/
|
||||
private function calculateColumnsWidth(iterable $groups)
|
||||
private function calculateColumnsWidth(iterable $groups) : void
|
||||
{
|
||||
for ($column = 0; $column < $this->numberOfColumns; ++$column) {
|
||||
$lengths = [];
|
||||
|
@ -761,7 +765,7 @@ class Table
|
|||
/**
|
||||
* Called after rendering to cleanup cache data.
|
||||
*/
|
||||
private function cleanup()
|
||||
private function cleanup() : void
|
||||
{
|
||||
$this->effectiveColumnWidths = [];
|
||||
unset($this->numberOfColumns);
|
||||
|
|
18
vendor/symfony/console/Input/ArgvInput.php
vendored
18
vendor/symfony/console/Input/ArgvInput.php
vendored
|
@ -54,10 +54,16 @@ class ArgvInput extends Input
|
|||
$this->tokens = $argv;
|
||||
parent::__construct($definition);
|
||||
}
|
||||
/**
|
||||
* @return void
|
||||
*/
|
||||
protected function setTokens(array $tokens)
|
||||
{
|
||||
$this->tokens = $tokens;
|
||||
}
|
||||
/**
|
||||
* @return void
|
||||
*/
|
||||
protected function parse()
|
||||
{
|
||||
$parseOptions = \true;
|
||||
|
@ -84,7 +90,7 @@ class ArgvInput extends Input
|
|||
/**
|
||||
* Parses a short option.
|
||||
*/
|
||||
private function parseShortOption(string $token)
|
||||
private function parseShortOption(string $token) : void
|
||||
{
|
||||
$name = \substr($token, 1);
|
||||
if (\strlen($name) > 1) {
|
||||
|
@ -103,7 +109,7 @@ class ArgvInput extends Input
|
|||
*
|
||||
* @throws RuntimeException When option given doesn't exist
|
||||
*/
|
||||
private function parseShortOptionSet(string $name)
|
||||
private function parseShortOptionSet(string $name) : void
|
||||
{
|
||||
$len = \strlen($name);
|
||||
for ($i = 0; $i < $len; ++$i) {
|
||||
|
@ -123,7 +129,7 @@ class ArgvInput extends Input
|
|||
/**
|
||||
* Parses a long option.
|
||||
*/
|
||||
private function parseLongOption(string $token)
|
||||
private function parseLongOption(string $token) : void
|
||||
{
|
||||
$name = \substr($token, 2);
|
||||
if (\false !== ($pos = \strpos($name, '='))) {
|
||||
|
@ -140,7 +146,7 @@ class ArgvInput extends Input
|
|||
*
|
||||
* @throws RuntimeException When too many arguments are given
|
||||
*/
|
||||
private function parseArgument(string $token)
|
||||
private function parseArgument(string $token) : void
|
||||
{
|
||||
$c = \count($this->arguments);
|
||||
// if input is expecting another argument, add it
|
||||
|
@ -180,7 +186,7 @@ class ArgvInput extends Input
|
|||
* @throws RuntimeException When option given doesn't exist
|
||||
* @param mixed $value
|
||||
*/
|
||||
private function addShortOption(string $shortcut, $value)
|
||||
private function addShortOption(string $shortcut, $value) : void
|
||||
{
|
||||
if (!$this->definition->hasShortcut($shortcut)) {
|
||||
throw new RuntimeException(\sprintf('The "-%s" option does not exist.', $shortcut));
|
||||
|
@ -193,7 +199,7 @@ class ArgvInput extends Input
|
|||
* @throws RuntimeException When option given doesn't exist
|
||||
* @param mixed $value
|
||||
*/
|
||||
private function addLongOption(string $name, $value)
|
||||
private function addLongOption(string $name, $value) : void
|
||||
{
|
||||
if (!$this->definition->hasOption($name)) {
|
||||
if (!$this->definition->hasNegation($name)) {
|
||||
|
|
9
vendor/symfony/console/Input/ArrayInput.php
vendored
9
vendor/symfony/console/Input/ArrayInput.php
vendored
|
@ -105,6 +105,9 @@ class ArrayInput extends Input
|
|||
}
|
||||
return \implode(' ', $params);
|
||||
}
|
||||
/**
|
||||
* @return void
|
||||
*/
|
||||
protected function parse()
|
||||
{
|
||||
foreach ($this->parameters as $key => $value) {
|
||||
|
@ -126,7 +129,7 @@ class ArrayInput extends Input
|
|||
* @throws InvalidOptionException When option given doesn't exist
|
||||
* @param mixed $value
|
||||
*/
|
||||
private function addShortOption(string $shortcut, $value)
|
||||
private function addShortOption(string $shortcut, $value) : void
|
||||
{
|
||||
if (!$this->definition->hasShortcut($shortcut)) {
|
||||
throw new InvalidOptionException(\sprintf('The "-%s" option does not exist.', $shortcut));
|
||||
|
@ -140,7 +143,7 @@ class ArrayInput extends Input
|
|||
* @throws InvalidOptionException When a required value is missing
|
||||
* @param mixed $value
|
||||
*/
|
||||
private function addLongOption(string $name, $value)
|
||||
private function addLongOption(string $name, $value) : void
|
||||
{
|
||||
if (!$this->definition->hasOption($name)) {
|
||||
if (!$this->definition->hasNegation($name)) {
|
||||
|
@ -168,7 +171,7 @@ class ArrayInput extends Input
|
|||
* @param string|int $name
|
||||
* @param mixed $value
|
||||
*/
|
||||
private function addArgument($name, $value)
|
||||
private function addArgument($name, $value) : void
|
||||
{
|
||||
if (!$this->definition->hasArgument($name)) {
|
||||
throw new InvalidArgumentException(\sprintf('The "%s" argument does not exist.', $name));
|
||||
|
|
23
vendor/symfony/console/Input/Input.php
vendored
23
vendor/symfony/console/Input/Input.php
vendored
|
@ -39,6 +39,9 @@ abstract class Input implements InputInterface, StreamableInputInterface
|
|||
$this->validate();
|
||||
}
|
||||
}
|
||||
/**
|
||||
* @return void
|
||||
*/
|
||||
public function bind(InputDefinition $definition)
|
||||
{
|
||||
$this->arguments = [];
|
||||
|
@ -48,13 +51,18 @@ abstract class Input implements InputInterface, StreamableInputInterface
|
|||
}
|
||||
/**
|
||||
* Processes command line arguments.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
protected abstract function parse();
|
||||
/**
|
||||
* @return void
|
||||
*/
|
||||
public function validate()
|
||||
{
|
||||
$definition = $this->definition;
|
||||
$givenArguments = $this->arguments;
|
||||
$missingArguments = \array_filter(\array_keys($definition->getArguments()), function ($argument) use($definition, $givenArguments) {
|
||||
$missingArguments = \array_filter(\array_keys($definition->getArguments()), function ($argument) use($givenArguments, $definition) {
|
||||
return !\array_key_exists($argument, $givenArguments) && $definition->getArgument($argument)->isRequired();
|
||||
});
|
||||
if (\count($missingArguments) > 0) {
|
||||
|
@ -65,6 +73,9 @@ abstract class Input implements InputInterface, StreamableInputInterface
|
|||
{
|
||||
return $this->interactive;
|
||||
}
|
||||
/**
|
||||
* @return void
|
||||
*/
|
||||
public function setInteractive(bool $interactive)
|
||||
{
|
||||
$this->interactive = $interactive;
|
||||
|
@ -84,6 +95,7 @@ abstract class Input implements InputInterface, StreamableInputInterface
|
|||
return $this->arguments[$name] ?? $this->definition->getArgument($name)->getDefault();
|
||||
}
|
||||
/**
|
||||
* @return void
|
||||
* @param mixed $value
|
||||
*/
|
||||
public function setArgument(string $name, $value)
|
||||
|
@ -118,6 +130,7 @@ abstract class Input implements InputInterface, StreamableInputInterface
|
|||
return \array_key_exists($name, $this->options) ? $this->options[$name] : $this->definition->getOption($name)->getDefault();
|
||||
}
|
||||
/**
|
||||
* @return void
|
||||
* @param mixed $value
|
||||
*/
|
||||
public function setOption(string $name, $value)
|
||||
|
@ -141,10 +154,18 @@ abstract class Input implements InputInterface, StreamableInputInterface
|
|||
{
|
||||
return \preg_match('{^[\\w-]+$}', $token) ? $token : \escapeshellarg($token);
|
||||
}
|
||||
/**
|
||||
* @param resource $stream
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function setStream($stream)
|
||||
{
|
||||
$this->stream = $stream;
|
||||
}
|
||||
/**
|
||||
* @return resource
|
||||
*/
|
||||
public function getStream()
|
||||
{
|
||||
return $this->stream;
|
||||
|
|
|
@ -96,6 +96,8 @@ class InputArgument
|
|||
/**
|
||||
* Sets the default value.
|
||||
*
|
||||
* @return void
|
||||
*
|
||||
* @throws LogicException When incorrect default value is given
|
||||
* @param string|bool|int|float|mixed[] $default
|
||||
*/
|
||||
|
|
|
@ -20,6 +20,8 @@ interface InputAwareInterface
|
|||
{
|
||||
/**
|
||||
* Sets the Console Input.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function setInput(InputInterface $input);
|
||||
}
|
||||
|
|
14
vendor/symfony/console/Input/InputDefinition.php
vendored
14
vendor/symfony/console/Input/InputDefinition.php
vendored
|
@ -63,6 +63,8 @@ class InputDefinition
|
|||
}
|
||||
/**
|
||||
* Sets the definition of the input.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function setDefinition(array $definition)
|
||||
{
|
||||
|
@ -82,6 +84,8 @@ class InputDefinition
|
|||
* Sets the InputArgument objects.
|
||||
*
|
||||
* @param InputArgument[] $arguments An array of InputArgument objects
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function setArguments(array $arguments = [])
|
||||
{
|
||||
|
@ -95,6 +99,8 @@ class InputDefinition
|
|||
* Adds an array of InputArgument objects.
|
||||
*
|
||||
* @param InputArgument[] $arguments An array of InputArgument objects
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function addArguments(?array $arguments = [])
|
||||
{
|
||||
|
@ -105,6 +111,8 @@ class InputDefinition
|
|||
}
|
||||
}
|
||||
/**
|
||||
* @return void
|
||||
*
|
||||
* @throws LogicException When incorrect argument is given
|
||||
*/
|
||||
public function addArgument(InputArgument $argument)
|
||||
|
@ -189,6 +197,8 @@ class InputDefinition
|
|||
* Sets the InputOption objects.
|
||||
*
|
||||
* @param InputOption[] $options An array of InputOption objects
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function setOptions(array $options = [])
|
||||
{
|
||||
|
@ -201,6 +211,8 @@ class InputDefinition
|
|||
* Adds an array of InputOption objects.
|
||||
*
|
||||
* @param InputOption[] $options An array of InputOption objects
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function addOptions(array $options = [])
|
||||
{
|
||||
|
@ -209,6 +221,8 @@ class InputDefinition
|
|||
}
|
||||
}
|
||||
/**
|
||||
* @return void
|
||||
*
|
||||
* @throws LogicException When option given already exist
|
||||
*/
|
||||
public function addOption(InputOption $option)
|
||||
|
|
10
vendor/symfony/console/Input/InputInterface.php
vendored
10
vendor/symfony/console/Input/InputInterface.php
vendored
|
@ -56,12 +56,16 @@ interface InputInterface
|
|||
/**
|
||||
* Binds the current Input instance with the given arguments and options.
|
||||
*
|
||||
* @return void
|
||||
*
|
||||
* @throws RuntimeException
|
||||
*/
|
||||
public function bind(InputDefinition $definition);
|
||||
/**
|
||||
* Validates the input.
|
||||
*
|
||||
* @return void
|
||||
*
|
||||
* @throws RuntimeException When not enough arguments are given
|
||||
*/
|
||||
public function validate();
|
||||
|
@ -82,6 +86,8 @@ interface InputInterface
|
|||
/**
|
||||
* Sets an argument value by name.
|
||||
*
|
||||
* @return void
|
||||
*
|
||||
* @throws InvalidArgumentException When argument given doesn't exist
|
||||
* @param mixed $value
|
||||
*/
|
||||
|
@ -107,6 +113,8 @@ interface InputInterface
|
|||
/**
|
||||
* Sets an option value by name.
|
||||
*
|
||||
* @return void
|
||||
*
|
||||
* @throws InvalidArgumentException When option given doesn't exist
|
||||
* @param mixed $value
|
||||
*/
|
||||
|
@ -121,6 +129,8 @@ interface InputInterface
|
|||
public function isInteractive() : bool;
|
||||
/**
|
||||
* Sets the input interactivity.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function setInteractive(bool $interactive);
|
||||
}
|
||||
|
|
1
vendor/symfony/console/Input/InputOption.php
vendored
1
vendor/symfony/console/Input/InputOption.php
vendored
|
@ -173,6 +173,7 @@ class InputOption
|
|||
return self::VALUE_NEGATABLE === (self::VALUE_NEGATABLE & $this->mode);
|
||||
}
|
||||
/**
|
||||
* @return void
|
||||
* @param string|bool|int|float|mixed[] $default
|
||||
*/
|
||||
public function setDefault($default = null)
|
||||
|
|
|
@ -24,6 +24,8 @@ interface StreamableInputInterface extends InputInterface
|
|||
* This is mainly useful for testing purpose.
|
||||
*
|
||||
* @param resource $stream The input stream
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function setStream($stream);
|
||||
/**
|
||||
|
|
16
vendor/symfony/console/Output/AnsiColorMode.php
vendored
16
vendor/symfony/console/Output/AnsiColorMode.php
vendored
|
@ -54,21 +54,7 @@ class AnsiColorMode
|
|||
}
|
||||
private function degradeHexColorToAnsi4(int $r, int $g, int $b) : int
|
||||
{
|
||||
if (0 === \round($this->getSaturation($r, $g, $b) / 50)) {
|
||||
return 0;
|
||||
}
|
||||
return (int) (\round($b / 255) << 2 | \round($g / 255) << 1 | \round($r / 255));
|
||||
}
|
||||
private function getSaturation(int $r, int $g, int $b) : int
|
||||
{
|
||||
$r = $r / 255;
|
||||
$g = $g / 255;
|
||||
$b = $b / 255;
|
||||
$v = \max($r, $g, $b);
|
||||
if (0 === ($diff = $v - \min($r, $g, $b))) {
|
||||
return 0;
|
||||
}
|
||||
return (int) ((int) $diff * 100 / $v);
|
||||
return \round($b / 255) << 2 | \round($g / 255) << 1 | \round($r / 255);
|
||||
}
|
||||
/**
|
||||
* Inspired from https://github.com/ajalt/colormath/blob/e464e0da1b014976736cf97250063248fc77b8e7/colormath/src/commonMain/kotlin/com/github/ajalt/colormath/model/Ansi256.kt code (MIT license).
|
||||
|
|
|
@ -28,6 +28,9 @@ class BufferedOutput extends Output
|
|||
$this->buffer = '';
|
||||
return $content;
|
||||
}
|
||||
/**
|
||||
* @return void
|
||||
*/
|
||||
protected function doWrite(string $message, bool $newline)
|
||||
{
|
||||
$this->buffer .= $message;
|
||||
|
|
12
vendor/symfony/console/Output/ConsoleOutput.php
vendored
12
vendor/symfony/console/Output/ConsoleOutput.php
vendored
|
@ -61,16 +61,25 @@ class ConsoleOutput extends StreamOutput implements ConsoleOutputInterface
|
|||
{
|
||||
return new ConsoleSectionOutput($this->getStream(), $this->consoleSectionOutputs, $this->getVerbosity(), $this->isDecorated(), $this->getFormatter());
|
||||
}
|
||||
/**
|
||||
* @return void
|
||||
*/
|
||||
public function setDecorated(bool $decorated)
|
||||
{
|
||||
parent::setDecorated($decorated);
|
||||
$this->stderr->setDecorated($decorated);
|
||||
}
|
||||
/**
|
||||
* @return void
|
||||
*/
|
||||
public function setFormatter(OutputFormatterInterface $formatter)
|
||||
{
|
||||
parent::setFormatter($formatter);
|
||||
$this->stderr->setFormatter($formatter);
|
||||
}
|
||||
/**
|
||||
* @return void
|
||||
*/
|
||||
public function setVerbosity(int $level)
|
||||
{
|
||||
parent::setVerbosity($level);
|
||||
|
@ -80,6 +89,9 @@ class ConsoleOutput extends StreamOutput implements ConsoleOutputInterface
|
|||
{
|
||||
return $this->stderr;
|
||||
}
|
||||
/**
|
||||
* @return void
|
||||
*/
|
||||
public function setErrorOutput(OutputInterface $error)
|
||||
{
|
||||
$this->stderr = $error;
|
||||
|
|
|
@ -22,6 +22,9 @@ interface ConsoleOutputInterface extends OutputInterface
|
|||
* Gets the OutputInterface for errors.
|
||||
*/
|
||||
public function getErrorOutput() : OutputInterface;
|
||||
/**
|
||||
* @return void
|
||||
*/
|
||||
public function setErrorOutput(OutputInterface $error);
|
||||
public function section() : ConsoleSectionOutput;
|
||||
}
|
||||
|
|
|
@ -68,6 +68,8 @@ class ConsoleSectionOutput extends StreamOutput
|
|||
* Clears previous output for this section.
|
||||
*
|
||||
* @param int $lines Number of lines to clear. If null, then the entire output of this section is cleared
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function clear(int $lines = null)
|
||||
{
|
||||
|
@ -85,6 +87,8 @@ class ConsoleSectionOutput extends StreamOutput
|
|||
}
|
||||
/**
|
||||
* Overwrites the previous output with a new message.
|
||||
*
|
||||
* @return void
|
||||
* @param string|mixed[] $message
|
||||
*/
|
||||
public function overwrite($message)
|
||||
|
@ -145,11 +149,14 @@ class ConsoleSectionOutput extends StreamOutput
|
|||
/**
|
||||
* @internal
|
||||
*/
|
||||
public function addNewLineOfInputSubmit()
|
||||
public function addNewLineOfInputSubmit() : void
|
||||
{
|
||||
$this->content[] = \PHP_EOL;
|
||||
++$this->lines;
|
||||
}
|
||||
/**
|
||||
* @return void
|
||||
*/
|
||||
protected function doWrite(string $message, bool $newline)
|
||||
{
|
||||
if (!$this->isDecorated()) {
|
||||
|
|
11
vendor/symfony/console/Output/NullOutput.php
vendored
11
vendor/symfony/console/Output/NullOutput.php
vendored
|
@ -26,6 +26,9 @@ class NullOutput implements OutputInterface
|
|||
* @var \Symfony\Component\Console\Formatter\NullOutputFormatter
|
||||
*/
|
||||
private $formatter;
|
||||
/**
|
||||
* @return void
|
||||
*/
|
||||
public function setFormatter(OutputFormatterInterface $formatter)
|
||||
{
|
||||
// do nothing
|
||||
|
@ -35,6 +38,9 @@ class NullOutput implements OutputInterface
|
|||
// to comply with the interface we must return a OutputFormatterInterface
|
||||
return $this->formatter = $this->formatter ?? new NullOutputFormatter();
|
||||
}
|
||||
/**
|
||||
* @return void
|
||||
*/
|
||||
public function setDecorated(bool $decorated)
|
||||
{
|
||||
// do nothing
|
||||
|
@ -43,6 +49,9 @@ class NullOutput implements OutputInterface
|
|||
{
|
||||
return \false;
|
||||
}
|
||||
/**
|
||||
* @return void
|
||||
*/
|
||||
public function setVerbosity(int $level)
|
||||
{
|
||||
// do nothing
|
||||
|
@ -68,6 +77,7 @@ class NullOutput implements OutputInterface
|
|||
return \false;
|
||||
}
|
||||
/**
|
||||
* @return void
|
||||
* @param string|mixed[] $messages
|
||||
*/
|
||||
public function writeln($messages, int $options = self::OUTPUT_NORMAL)
|
||||
|
@ -75,6 +85,7 @@ class NullOutput implements OutputInterface
|
|||
// do nothing
|
||||
}
|
||||
/**
|
||||
* @return void
|
||||
* @param string|mixed[] $messages
|
||||
*/
|
||||
public function write($messages, bool $newline = \false, int $options = self::OUTPUT_NORMAL)
|
||||
|
|
13
vendor/symfony/console/Output/Output.php
vendored
13
vendor/symfony/console/Output/Output.php
vendored
|
@ -46,6 +46,9 @@ abstract class Output implements OutputInterface
|
|||
$this->formatter = $formatter ?? new OutputFormatter();
|
||||
$this->formatter->setDecorated($decorated);
|
||||
}
|
||||
/**
|
||||
* @return void
|
||||
*/
|
||||
public function setFormatter(OutputFormatterInterface $formatter)
|
||||
{
|
||||
$this->formatter = $formatter;
|
||||
|
@ -54,6 +57,9 @@ abstract class Output implements OutputInterface
|
|||
{
|
||||
return $this->formatter;
|
||||
}
|
||||
/**
|
||||
* @return void
|
||||
*/
|
||||
public function setDecorated(bool $decorated)
|
||||
{
|
||||
$this->formatter->setDecorated($decorated);
|
||||
|
@ -62,6 +68,9 @@ abstract class Output implements OutputInterface
|
|||
{
|
||||
return $this->formatter->isDecorated();
|
||||
}
|
||||
/**
|
||||
* @return void
|
||||
*/
|
||||
public function setVerbosity(int $level)
|
||||
{
|
||||
$this->verbosity = $level;
|
||||
|
@ -87,6 +96,7 @@ abstract class Output implements OutputInterface
|
|||
return self::VERBOSITY_DEBUG <= $this->verbosity;
|
||||
}
|
||||
/**
|
||||
* @return void
|
||||
* @param string|mixed[] $messages
|
||||
*/
|
||||
public function writeln($messages, int $options = self::OUTPUT_NORMAL)
|
||||
|
@ -94,6 +104,7 @@ abstract class Output implements OutputInterface
|
|||
$this->write($messages, \true, $options);
|
||||
}
|
||||
/**
|
||||
* @return void
|
||||
* @param string|mixed[] $messages
|
||||
*/
|
||||
public function write($messages, bool $newline = \false, int $options = self::OUTPUT_NORMAL)
|
||||
|
@ -124,6 +135,8 @@ abstract class Output implements OutputInterface
|
|||
}
|
||||
/**
|
||||
* Writes a message to the output.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
protected abstract function doWrite(string $message, bool $newline);
|
||||
}
|
||||
|
|
|
@ -32,6 +32,8 @@ interface OutputInterface
|
|||
* @param bool $newline Whether to add a newline
|
||||
* @param int $options A bitmask of options (one of the OUTPUT or VERBOSITY constants),
|
||||
* 0 is considered the same as self::OUTPUT_NORMAL | self::VERBOSITY_NORMAL
|
||||
*
|
||||
* @return void
|
||||
* @param string|mixed[] $messages
|
||||
*/
|
||||
public function write($messages, bool $newline = \false, int $options = 0);
|
||||
|
@ -40,11 +42,15 @@ interface OutputInterface
|
|||
*
|
||||
* @param int $options A bitmask of options (one of the OUTPUT or VERBOSITY constants),
|
||||
* 0 is considered the same as self::OUTPUT_NORMAL | self::VERBOSITY_NORMAL
|
||||
*
|
||||
* @return void
|
||||
* @param string|mixed[] $messages
|
||||
*/
|
||||
public function writeln($messages, int $options = 0);
|
||||
/**
|
||||
* Sets the verbosity of the output.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function setVerbosity(int $level);
|
||||
/**
|
||||
|
@ -69,12 +75,17 @@ interface OutputInterface
|
|||
public function isDebug() : bool;
|
||||
/**
|
||||
* Sets the decorated flag.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function setDecorated(bool $decorated);
|
||||
/**
|
||||
* Gets the decorated flag.
|
||||
*/
|
||||
public function isDecorated() : bool;
|
||||
/**
|
||||
* @return void
|
||||
*/
|
||||
public function setFormatter(OutputFormatterInterface $formatter);
|
||||
/**
|
||||
* Returns current output formatter instance.
|
||||
|
|
|
@ -54,6 +54,9 @@ class StreamOutput extends Output
|
|||
{
|
||||
return $this->stream;
|
||||
}
|
||||
/**
|
||||
* @return void
|
||||
*/
|
||||
protected function doWrite(string $message, bool $newline)
|
||||
{
|
||||
if ($newline) {
|
||||
|
|
|
@ -44,6 +44,9 @@ class TrimmedBufferOutput extends Output
|
|||
$this->buffer = '';
|
||||
return $content;
|
||||
}
|
||||
/**
|
||||
* @return void
|
||||
*/
|
||||
protected function doWrite(string $message, bool $newline)
|
||||
{
|
||||
$this->buffer .= $message;
|
||||
|
|
7
vendor/symfony/console/Question/Question.php
vendored
7
vendor/symfony/console/Question/Question.php
vendored
|
@ -162,8 +162,8 @@ class Question
|
|||
return $values;
|
||||
};
|
||||
} elseif ($values instanceof \Traversable) {
|
||||
$valueCache = null;
|
||||
$callback = static function () use($values, &$valueCache) {
|
||||
$callback = static function () use($values) {
|
||||
static $valueCache;
|
||||
return $valueCache = $valueCache ?? \iterator_to_array($values, \false);
|
||||
};
|
||||
} else {
|
||||
|
@ -263,6 +263,9 @@ class Question
|
|||
{
|
||||
return $this->normalizer;
|
||||
}
|
||||
/**
|
||||
* @return bool
|
||||
*/
|
||||
protected function isAssoc(array $array)
|
||||
{
|
||||
return (bool) \count(\array_filter(\array_keys($array), 'is_string'));
|
||||
|
|
16
vendor/symfony/console/README.md
vendored
16
vendor/symfony/console/README.md
vendored
|
@ -4,6 +4,18 @@ Console Component
|
|||
The Console component eases the creation of beautiful and testable command line
|
||||
interfaces.
|
||||
|
||||
Sponsor
|
||||
-------
|
||||
|
||||
The Console component for Symfony 6.3 is [backed][1] by [Les-Tilleuls.coop][2].
|
||||
|
||||
Les-Tilleuls.coop is a team of 70+ Symfony experts who can help you design, develop and
|
||||
fix your projects. They provide a wide range of professional services including development,
|
||||
consulting, coaching, training and audits. They also are highly skilled in JS, Go and DevOps.
|
||||
They are a worker cooperative!
|
||||
|
||||
Help Symfony by [sponsoring][3] its development!
|
||||
|
||||
Resources
|
||||
---------
|
||||
|
||||
|
@ -18,3 +30,7 @@ Credits
|
|||
|
||||
`Resources/bin/hiddeninput.exe` is a third party binary provided within this
|
||||
component. Find sources and license at https://github.com/Seldaek/hidden-input.
|
||||
|
||||
[1]: https://symfony.com/backers
|
||||
[2]: https://les-tilleuls.coop
|
||||
[3]: https://symfony.com/sponsor
|
||||
|
|
10
vendor/symfony/console/Resources/completion.bash
vendored
10
vendor/symfony/console/Resources/completion.bash
vendored
|
@ -6,6 +6,16 @@
|
|||
# https://symfony.com/doc/current/contributing/code/license.html
|
||||
|
||||
_sf_{{ COMMAND_NAME }}() {
|
||||
|
||||
# Use the default completion for shell redirect operators.
|
||||
for w in '>' '>>' '&>' '<'; do
|
||||
if [[ $w = "${COMP_WORDS[COMP_CWORD-1]}" ]]; then
|
||||
compopt -o filenames
|
||||
COMPREPLY=($(compgen -f -- "${COMP_WORDS[COMP_CWORD]}"))
|
||||
return 0
|
||||
fi
|
||||
done
|
||||
|
||||
# Use newline as only separator to allow space in completion values
|
||||
IFS=$'\n'
|
||||
local sf_cmd="${COMP_WORDS[0]}"
|
||||
|
|
17
vendor/symfony/console/Style/OutputStyle.php
vendored
17
vendor/symfony/console/Style/OutputStyle.php
vendored
|
@ -29,6 +29,9 @@ abstract class OutputStyle implements OutputInterface, StyleInterface
|
|||
{
|
||||
$this->output = $output;
|
||||
}
|
||||
/**
|
||||
* @return void
|
||||
*/
|
||||
public function newLine(int $count = 1)
|
||||
{
|
||||
$this->output->write(\str_repeat(\PHP_EOL, $count));
|
||||
|
@ -38,6 +41,7 @@ abstract class OutputStyle implements OutputInterface, StyleInterface
|
|||
return new ProgressBar($this->output, $max);
|
||||
}
|
||||
/**
|
||||
* @return void
|
||||
* @param string|mixed[] $messages
|
||||
*/
|
||||
public function write($messages, bool $newline = \false, int $type = self::OUTPUT_NORMAL)
|
||||
|
@ -45,12 +49,16 @@ abstract class OutputStyle implements OutputInterface, StyleInterface
|
|||
$this->output->write($messages, $newline, $type);
|
||||
}
|
||||
/**
|
||||
* @return void
|
||||
* @param string|mixed[] $messages
|
||||
*/
|
||||
public function writeln($messages, int $type = self::OUTPUT_NORMAL)
|
||||
{
|
||||
$this->output->writeln($messages, $type);
|
||||
}
|
||||
/**
|
||||
* @return void
|
||||
*/
|
||||
public function setVerbosity(int $level)
|
||||
{
|
||||
$this->output->setVerbosity($level);
|
||||
|
@ -59,6 +67,9 @@ abstract class OutputStyle implements OutputInterface, StyleInterface
|
|||
{
|
||||
return $this->output->getVerbosity();
|
||||
}
|
||||
/**
|
||||
* @return void
|
||||
*/
|
||||
public function setDecorated(bool $decorated)
|
||||
{
|
||||
$this->output->setDecorated($decorated);
|
||||
|
@ -67,6 +78,9 @@ abstract class OutputStyle implements OutputInterface, StyleInterface
|
|||
{
|
||||
return $this->output->isDecorated();
|
||||
}
|
||||
/**
|
||||
* @return void
|
||||
*/
|
||||
public function setFormatter(OutputFormatterInterface $formatter)
|
||||
{
|
||||
$this->output->setFormatter($formatter);
|
||||
|
@ -91,6 +105,9 @@ abstract class OutputStyle implements OutputInterface, StyleInterface
|
|||
{
|
||||
return $this->output->isDebug();
|
||||
}
|
||||
/**
|
||||
* @return OutputInterface
|
||||
*/
|
||||
protected function getErrorOutput()
|
||||
{
|
||||
if (!$this->output instanceof ConsoleOutputInterface) {
|
||||
|
|
28
vendor/symfony/console/Style/StyleInterface.php
vendored
28
vendor/symfony/console/Style/StyleInterface.php
vendored
|
@ -19,48 +19,68 @@ interface StyleInterface
|
|||
{
|
||||
/**
|
||||
* Formats a command title.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function title(string $message);
|
||||
/**
|
||||
* Formats a section title.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function section(string $message);
|
||||
/**
|
||||
* Formats a list.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function listing(array $elements);
|
||||
/**
|
||||
* Formats informational text.
|
||||
*
|
||||
* @return void
|
||||
* @param string|mixed[] $message
|
||||
*/
|
||||
public function text($message);
|
||||
/**
|
||||
* Formats a success result bar.
|
||||
*
|
||||
* @return void
|
||||
* @param string|mixed[] $message
|
||||
*/
|
||||
public function success($message);
|
||||
/**
|
||||
* Formats an error result bar.
|
||||
*
|
||||
* @return void
|
||||
* @param string|mixed[] $message
|
||||
*/
|
||||
public function error($message);
|
||||
/**
|
||||
* Formats an warning result bar.
|
||||
*
|
||||
* @return void
|
||||
* @param string|mixed[] $message
|
||||
*/
|
||||
public function warning($message);
|
||||
/**
|
||||
* Formats a note admonition.
|
||||
*
|
||||
* @return void
|
||||
* @param string|mixed[] $message
|
||||
*/
|
||||
public function note($message);
|
||||
/**
|
||||
* Formats a caution admonition.
|
||||
*
|
||||
* @return void
|
||||
* @param string|mixed[] $message
|
||||
*/
|
||||
public function caution($message);
|
||||
/**
|
||||
* Formats a table.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function table(array $headers, array $rows);
|
||||
/**
|
||||
|
@ -85,18 +105,26 @@ interface StyleInterface
|
|||
public function choice(string $question, array $choices, $default = null);
|
||||
/**
|
||||
* Add newline(s).
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function newLine(int $count = 1);
|
||||
/**
|
||||
* Starts the progress output.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function progressStart(int $max = 0);
|
||||
/**
|
||||
* Advances the progress output X steps.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function progressAdvance(int $step = 1);
|
||||
/**
|
||||
* Finishes the progress output.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function progressFinish();
|
||||
}
|
||||
|
|
44
vendor/symfony/console/Style/SymfonyStyle.php
vendored
44
vendor/symfony/console/Style/SymfonyStyle.php
vendored
|
@ -72,6 +72,8 @@ class SymfonyStyle extends OutputStyle
|
|||
}
|
||||
/**
|
||||
* Formats a message as a block of text.
|
||||
*
|
||||
* @return void
|
||||
* @param string|mixed[] $messages
|
||||
*/
|
||||
public function block($messages, string $type = null, string $style = null, string $prefix = ' ', bool $padding = \false, bool $escape = \true)
|
||||
|
@ -81,18 +83,27 @@ class SymfonyStyle extends OutputStyle
|
|||
$this->writeln($this->createBlock($messages, $type, $style, $prefix, $padding, $escape));
|
||||
$this->newLine();
|
||||
}
|
||||
/**
|
||||
* @return void
|
||||
*/
|
||||
public function title(string $message)
|
||||
{
|
||||
$this->autoPrependBlock();
|
||||
$this->writeln([\sprintf('<comment>%s</>', OutputFormatter::escapeTrailingBackslash($message)), \sprintf('<comment>%s</>', \str_repeat('=', Helper::width(Helper::removeDecoration($this->getFormatter(), $message))))]);
|
||||
$this->newLine();
|
||||
}
|
||||
/**
|
||||
* @return void
|
||||
*/
|
||||
public function section(string $message)
|
||||
{
|
||||
$this->autoPrependBlock();
|
||||
$this->writeln([\sprintf('<comment>%s</>', OutputFormatter::escapeTrailingBackslash($message)), \sprintf('<comment>%s</>', \str_repeat('-', Helper::width(Helper::removeDecoration($this->getFormatter(), $message))))]);
|
||||
$this->newLine();
|
||||
}
|
||||
/**
|
||||
* @return void
|
||||
*/
|
||||
public function listing(array $elements)
|
||||
{
|
||||
$this->autoPrependText();
|
||||
|
@ -103,6 +114,7 @@ class SymfonyStyle extends OutputStyle
|
|||
$this->newLine();
|
||||
}
|
||||
/**
|
||||
* @return void
|
||||
* @param string|mixed[] $message
|
||||
*/
|
||||
public function text($message)
|
||||
|
@ -115,6 +127,8 @@ class SymfonyStyle extends OutputStyle
|
|||
}
|
||||
/**
|
||||
* Formats a command comment.
|
||||
*
|
||||
* @return void
|
||||
* @param string|mixed[] $message
|
||||
*/
|
||||
public function comment($message)
|
||||
|
@ -122,6 +136,7 @@ class SymfonyStyle extends OutputStyle
|
|||
$this->block($message, null, null, '<fg=default;bg=default> // </>', \false, \false);
|
||||
}
|
||||
/**
|
||||
* @return void
|
||||
* @param string|mixed[] $message
|
||||
*/
|
||||
public function success($message)
|
||||
|
@ -129,6 +144,7 @@ class SymfonyStyle extends OutputStyle
|
|||
$this->block($message, 'OK', 'fg=black;bg=green', ' ', \true);
|
||||
}
|
||||
/**
|
||||
* @return void
|
||||
* @param string|mixed[] $message
|
||||
*/
|
||||
public function error($message)
|
||||
|
@ -136,6 +152,7 @@ class SymfonyStyle extends OutputStyle
|
|||
$this->block($message, 'ERROR', 'fg=white;bg=red', ' ', \true);
|
||||
}
|
||||
/**
|
||||
* @return void
|
||||
* @param string|mixed[] $message
|
||||
*/
|
||||
public function warning($message)
|
||||
|
@ -143,6 +160,7 @@ class SymfonyStyle extends OutputStyle
|
|||
$this->block($message, 'WARNING', 'fg=black;bg=yellow', ' ', \true);
|
||||
}
|
||||
/**
|
||||
* @return void
|
||||
* @param string|mixed[] $message
|
||||
*/
|
||||
public function note($message)
|
||||
|
@ -151,6 +169,8 @@ class SymfonyStyle extends OutputStyle
|
|||
}
|
||||
/**
|
||||
* Formats an info message.
|
||||
*
|
||||
* @return void
|
||||
* @param string|mixed[] $message
|
||||
*/
|
||||
public function info($message)
|
||||
|
@ -158,12 +178,16 @@ class SymfonyStyle extends OutputStyle
|
|||
$this->block($message, 'INFO', 'fg=green', ' ', \true);
|
||||
}
|
||||
/**
|
||||
* @return void
|
||||
* @param string|mixed[] $message
|
||||
*/
|
||||
public function caution($message)
|
||||
{
|
||||
$this->block($message, 'CAUTION', 'fg=white;bg=red', ' ! ', \true);
|
||||
}
|
||||
/**
|
||||
* @return void
|
||||
*/
|
||||
public function table(array $headers, array $rows)
|
||||
{
|
||||
$this->createTable()->setHeaders($headers)->setRows($rows)->render();
|
||||
|
@ -171,6 +195,8 @@ class SymfonyStyle extends OutputStyle
|
|||
}
|
||||
/**
|
||||
* Formats a horizontal table.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function horizontalTable(array $headers, array $rows)
|
||||
{
|
||||
|
@ -184,6 +210,8 @@ class SymfonyStyle extends OutputStyle
|
|||
* * 'A title'
|
||||
* * ['key' => 'value']
|
||||
* * new TableSeparator()
|
||||
*
|
||||
* @return void
|
||||
* @param string|mixed[]|\Symfony\Component\Console\Helper\TableSeparator ...$list
|
||||
*/
|
||||
public function definitionList(...$list)
|
||||
|
@ -246,15 +274,24 @@ class SymfonyStyle extends OutputStyle
|
|||
$questionChoice->setMultiselect($multiSelect);
|
||||
return $this->askQuestion($questionChoice);
|
||||
}
|
||||
/**
|
||||
* @return void
|
||||
*/
|
||||
public function progressStart(int $max = 0)
|
||||
{
|
||||
$this->progressBar = $this->createProgressBar($max);
|
||||
$this->progressBar->start();
|
||||
}
|
||||
/**
|
||||
* @return void
|
||||
*/
|
||||
public function progressAdvance(int $step = 1)
|
||||
{
|
||||
$this->getProgressBar()->advance($step);
|
||||
}
|
||||
/**
|
||||
* @return void
|
||||
*/
|
||||
public function progressFinish()
|
||||
{
|
||||
$this->getProgressBar()->finish();
|
||||
|
@ -303,6 +340,7 @@ class SymfonyStyle extends OutputStyle
|
|||
return $answer;
|
||||
}
|
||||
/**
|
||||
* @return void
|
||||
* @param string|mixed[] $messages
|
||||
*/
|
||||
public function writeln($messages, int $type = self::OUTPUT_NORMAL)
|
||||
|
@ -316,6 +354,7 @@ class SymfonyStyle extends OutputStyle
|
|||
}
|
||||
}
|
||||
/**
|
||||
* @return void
|
||||
* @param string|mixed[] $messages
|
||||
*/
|
||||
public function write($messages, bool $newline = \false, int $type = self::OUTPUT_NORMAL)
|
||||
|
@ -328,6 +367,9 @@ class SymfonyStyle extends OutputStyle
|
|||
$this->writeBuffer($message, $newline, $type);
|
||||
}
|
||||
}
|
||||
/**
|
||||
* @return void
|
||||
*/
|
||||
public function newLine(int $count = 1)
|
||||
{
|
||||
parent::newLine($count);
|
||||
|
@ -369,7 +411,7 @@ class SymfonyStyle extends OutputStyle
|
|||
{
|
||||
$fetched = $this->bufferedOutput->fetch();
|
||||
// Prepend new line if last char isn't EOL:
|
||||
if (\substr_compare($fetched, "\n", -\strlen("\n")) !== 0) {
|
||||
if ($fetched && \substr_compare($fetched, "\n", -\strlen("\n")) !== 0) {
|
||||
$this->newLine();
|
||||
}
|
||||
}
|
||||
|
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue
Block a user