Updated Rector to commit f387890dbeba0617f9a4f98f44ac1c8f08e6c1b0

f387890dbe [build] add enum to const list downgrade
This commit is contained in:
Tomas Votruba 2022-12-01 16:57:08 +00:00
parent fc7f082962
commit 09f8be2dde
234 changed files with 4258 additions and 1318 deletions

View File

@ -10,6 +10,7 @@ use PHPStan\PhpDocParser\Ast\Type\TypeNode;
use PHPStan\Type\Accessory\AccessoryLiteralStringType;
use PHPStan\Type\Accessory\AccessoryNumericStringType;
use PHPStan\Type\Accessory\HasMethodType;
use PHPStan\Type\ConditionalType;
use PHPStan\Type\Type;
use Rector\Core\Exception\NotImplementedYetException;
use Rector\PHPStanStaticTypeMapper\Contract\TypeMapperInterface;
@ -48,6 +49,9 @@ final class PHPStanStaticTypeMapper
if ($type instanceof AccessoryLiteralStringType) {
return new IdentifierTypeNode('string');
}
if ($type instanceof ConditionalType) {
return new IdentifierTypeNode('mixed');
}
throw new NotImplementedYetException(__METHOD__ . ' for ' . \get_class($type));
}
/**

View File

@ -17,12 +17,12 @@ final class VersionResolver
* @api
* @var string
*/
public const PACKAGE_VERSION = '22b612ef79a1437b891d94154285ad4a2a3e0576';
public const PACKAGE_VERSION = 'f387890dbeba0617f9a4f98f44ac1c8f08e6c1b0';
/**
* @api
* @var string
*/
public const RELEASE_DATE = '2022-12-01 15:33:10';
public const RELEASE_DATE = '2022-12-01 17:52:33';
/**
* @var int
*/

2
vendor/autoload.php vendored
View File

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

View File

@ -659,6 +659,7 @@ return array(
'RectorPrefix202212\\Symfony\\Component\\Config\\FileLocator' => $vendorDir . '/symfony/config/FileLocator.php',
'RectorPrefix202212\\Symfony\\Component\\Config\\FileLocatorInterface' => $vendorDir . '/symfony/config/FileLocatorInterface.php',
'RectorPrefix202212\\Symfony\\Component\\Config\\Loader\\DelegatingLoader' => $vendorDir . '/symfony/config/Loader/DelegatingLoader.php',
'RectorPrefix202212\\Symfony\\Component\\Config\\Loader\\DirectoryAwareLoaderInterface' => $vendorDir . '/symfony/config/Loader/DirectoryAwareLoaderInterface.php',
'RectorPrefix202212\\Symfony\\Component\\Config\\Loader\\FileLoader' => $vendorDir . '/symfony/config/Loader/FileLoader.php',
'RectorPrefix202212\\Symfony\\Component\\Config\\Loader\\GlobFileLoader' => $vendorDir . '/symfony/config/Loader/GlobFileLoader.php',
'RectorPrefix202212\\Symfony\\Component\\Config\\Loader\\Loader' => $vendorDir . '/symfony/config/Loader/Loader.php',
@ -702,6 +703,7 @@ return array(
'RectorPrefix202212\\Symfony\\Component\\Console\\Completion\\Output\\BashCompletionOutput' => $vendorDir . '/symfony/console/Completion/Output/BashCompletionOutput.php',
'RectorPrefix202212\\Symfony\\Component\\Console\\Completion\\Output\\CompletionOutputInterface' => $vendorDir . '/symfony/console/Completion/Output/CompletionOutputInterface.php',
'RectorPrefix202212\\Symfony\\Component\\Console\\Completion\\Output\\FishCompletionOutput' => $vendorDir . '/symfony/console/Completion/Output/FishCompletionOutput.php',
'RectorPrefix202212\\Symfony\\Component\\Console\\Completion\\Output\\ZshCompletionOutput' => $vendorDir . '/symfony/console/Completion/Output/ZshCompletionOutput.php',
'RectorPrefix202212\\Symfony\\Component\\Console\\Completion\\Suggestion' => $vendorDir . '/symfony/console/Completion/Suggestion.php',
'RectorPrefix202212\\Symfony\\Component\\Console\\ConsoleEvents' => $vendorDir . '/symfony/console/ConsoleEvents.php',
'RectorPrefix202212\\Symfony\\Component\\Console\\Cursor' => $vendorDir . '/symfony/console/Cursor.php',
@ -737,6 +739,7 @@ return array(
'RectorPrefix202212\\Symfony\\Component\\Console\\Helper\\HelperInterface' => $vendorDir . '/symfony/console/Helper/HelperInterface.php',
'RectorPrefix202212\\Symfony\\Component\\Console\\Helper\\HelperSet' => $vendorDir . '/symfony/console/Helper/HelperSet.php',
'RectorPrefix202212\\Symfony\\Component\\Console\\Helper\\InputAwareHelper' => $vendorDir . '/symfony/console/Helper/InputAwareHelper.php',
'RectorPrefix202212\\Symfony\\Component\\Console\\Helper\\OutputWrapper' => $vendorDir . '/symfony/console/Helper/OutputWrapper.php',
'RectorPrefix202212\\Symfony\\Component\\Console\\Helper\\ProcessHelper' => $vendorDir . '/symfony/console/Helper/ProcessHelper.php',
'RectorPrefix202212\\Symfony\\Component\\Console\\Helper\\ProgressBar' => $vendorDir . '/symfony/console/Helper/ProgressBar.php',
'RectorPrefix202212\\Symfony\\Component\\Console\\Helper\\ProgressIndicator' => $vendorDir . '/symfony/console/Helper/ProgressIndicator.php',
@ -759,6 +762,7 @@ return array(
'RectorPrefix202212\\Symfony\\Component\\Console\\Input\\StreamableInputInterface' => $vendorDir . '/symfony/console/Input/StreamableInputInterface.php',
'RectorPrefix202212\\Symfony\\Component\\Console\\Input\\StringInput' => $vendorDir . '/symfony/console/Input/StringInput.php',
'RectorPrefix202212\\Symfony\\Component\\Console\\Logger\\ConsoleLogger' => $vendorDir . '/symfony/console/Logger/ConsoleLogger.php',
'RectorPrefix202212\\Symfony\\Component\\Console\\Output\\AnsiColorMode' => $vendorDir . '/symfony/console/Output/AnsiColorMode.php',
'RectorPrefix202212\\Symfony\\Component\\Console\\Output\\BufferedOutput' => $vendorDir . '/symfony/console/Output/BufferedOutput.php',
'RectorPrefix202212\\Symfony\\Component\\Console\\Output\\ConsoleOutput' => $vendorDir . '/symfony/console/Output/ConsoleOutput.php',
'RectorPrefix202212\\Symfony\\Component\\Console\\Output\\ConsoleOutputInterface' => $vendorDir . '/symfony/console/Output/ConsoleOutputInterface.php',
@ -891,8 +895,10 @@ return array(
'RectorPrefix202212\\Symfony\\Component\\DependencyInjection\\Extension\\ExtensionTrait' => $vendorDir . '/symfony/dependency-injection/Extension/ExtensionTrait.php',
'RectorPrefix202212\\Symfony\\Component\\DependencyInjection\\Extension\\PrependExtensionInterface' => $vendorDir . '/symfony/dependency-injection/Extension/PrependExtensionInterface.php',
'RectorPrefix202212\\Symfony\\Component\\DependencyInjection\\LazyProxy\\Instantiator\\InstantiatorInterface' => $vendorDir . '/symfony/dependency-injection/LazyProxy/Instantiator/InstantiatorInterface.php',
'RectorPrefix202212\\Symfony\\Component\\DependencyInjection\\LazyProxy\\Instantiator\\LazyServiceInstantiator' => $vendorDir . '/symfony/dependency-injection/LazyProxy/Instantiator/LazyServiceInstantiator.php',
'RectorPrefix202212\\Symfony\\Component\\DependencyInjection\\LazyProxy\\Instantiator\\RealServiceInstantiator' => $vendorDir . '/symfony/dependency-injection/LazyProxy/Instantiator/RealServiceInstantiator.php',
'RectorPrefix202212\\Symfony\\Component\\DependencyInjection\\LazyProxy\\PhpDumper\\DumperInterface' => $vendorDir . '/symfony/dependency-injection/LazyProxy/PhpDumper/DumperInterface.php',
'RectorPrefix202212\\Symfony\\Component\\DependencyInjection\\LazyProxy\\PhpDumper\\LazyServiceDumper' => $vendorDir . '/symfony/dependency-injection/LazyProxy/PhpDumper/LazyServiceDumper.php',
'RectorPrefix202212\\Symfony\\Component\\DependencyInjection\\LazyProxy\\PhpDumper\\NullDumper' => $vendorDir . '/symfony/dependency-injection/LazyProxy/PhpDumper/NullDumper.php',
'RectorPrefix202212\\Symfony\\Component\\DependencyInjection\\LazyProxy\\ProxyHelper' => $vendorDir . '/symfony/dependency-injection/LazyProxy/ProxyHelper.php',
'RectorPrefix202212\\Symfony\\Component\\DependencyInjection\\Loader\\ClosureLoader' => $vendorDir . '/symfony/dependency-injection/Loader/ClosureLoader.php',
@ -994,6 +1000,24 @@ return array(
'RectorPrefix202212\\Symfony\\Component\\String\\Slugger\\AsciiSlugger' => $vendorDir . '/symfony/string/Slugger/AsciiSlugger.php',
'RectorPrefix202212\\Symfony\\Component\\String\\Slugger\\SluggerInterface' => $vendorDir . '/symfony/string/Slugger/SluggerInterface.php',
'RectorPrefix202212\\Symfony\\Component\\String\\UnicodeString' => $vendorDir . '/symfony/string/UnicodeString.php',
'RectorPrefix202212\\Symfony\\Component\\VarExporter\\Exception\\ClassNotFoundException' => $vendorDir . '/symfony/var-exporter/Exception/ClassNotFoundException.php',
'RectorPrefix202212\\Symfony\\Component\\VarExporter\\Exception\\ExceptionInterface' => $vendorDir . '/symfony/var-exporter/Exception/ExceptionInterface.php',
'RectorPrefix202212\\Symfony\\Component\\VarExporter\\Exception\\LogicException' => $vendorDir . '/symfony/var-exporter/Exception/LogicException.php',
'RectorPrefix202212\\Symfony\\Component\\VarExporter\\Exception\\NotInstantiableTypeException' => $vendorDir . '/symfony/var-exporter/Exception/NotInstantiableTypeException.php',
'RectorPrefix202212\\Symfony\\Component\\VarExporter\\Hydrator' => $vendorDir . '/symfony/var-exporter/Hydrator.php',
'RectorPrefix202212\\Symfony\\Component\\VarExporter\\Instantiator' => $vendorDir . '/symfony/var-exporter/Instantiator.php',
'RectorPrefix202212\\Symfony\\Component\\VarExporter\\Internal\\Exporter' => $vendorDir . '/symfony/var-exporter/Internal/Exporter.php',
'RectorPrefix202212\\Symfony\\Component\\VarExporter\\Internal\\Hydrator' => $vendorDir . '/symfony/var-exporter/Internal/Hydrator.php',
'RectorPrefix202212\\Symfony\\Component\\VarExporter\\Internal\\LazyObjectRegistry' => $vendorDir . '/symfony/var-exporter/Internal/LazyObjectRegistry.php',
'RectorPrefix202212\\Symfony\\Component\\VarExporter\\Internal\\LazyObjectState' => $vendorDir . '/symfony/var-exporter/Internal/LazyObjectState.php',
'RectorPrefix202212\\Symfony\\Component\\VarExporter\\Internal\\Reference' => $vendorDir . '/symfony/var-exporter/Internal/Reference.php',
'RectorPrefix202212\\Symfony\\Component\\VarExporter\\Internal\\Registry' => $vendorDir . '/symfony/var-exporter/Internal/Registry.php',
'RectorPrefix202212\\Symfony\\Component\\VarExporter\\Internal\\Values' => $vendorDir . '/symfony/var-exporter/Internal/Values.php',
'RectorPrefix202212\\Symfony\\Component\\VarExporter\\LazyGhostTrait' => $vendorDir . '/symfony/var-exporter/LazyGhostTrait.php',
'RectorPrefix202212\\Symfony\\Component\\VarExporter\\LazyObjectInterface' => $vendorDir . '/symfony/var-exporter/LazyObjectInterface.php',
'RectorPrefix202212\\Symfony\\Component\\VarExporter\\LazyProxyTrait' => $vendorDir . '/symfony/var-exporter/LazyProxyTrait.php',
'RectorPrefix202212\\Symfony\\Component\\VarExporter\\ProxyHelper' => $vendorDir . '/symfony/var-exporter/ProxyHelper.php',
'RectorPrefix202212\\Symfony\\Component\\VarExporter\\VarExporter' => $vendorDir . '/symfony/var-exporter/VarExporter.php',
'RectorPrefix202212\\Symfony\\Contracts\\Cache\\CacheInterface' => $vendorDir . '/symfony/contracts/Cache/CacheInterface.php',
'RectorPrefix202212\\Symfony\\Contracts\\Cache\\CacheTrait' => $vendorDir . '/symfony/contracts/Cache/CacheTrait.php',
'RectorPrefix202212\\Symfony\\Contracts\\Cache\\CallbackInterface' => $vendorDir . '/symfony/contracts/Cache/CallbackInterface.php',
@ -1738,6 +1762,7 @@ return array(
'Rector\\DowngradePhp80\\Rector\\ClassMethod\\DowngradeStaticTypeDeclarationRector' => $vendorDir . '/rector/rector-downgrade-php/rules/DowngradePhp80/Rector/ClassMethod/DowngradeStaticTypeDeclarationRector.php',
'Rector\\DowngradePhp80\\Rector\\ClassMethod\\DowngradeStringReturnTypeOnToStringRector' => $vendorDir . '/rector/rector-downgrade-php/rules/DowngradePhp80/Rector/ClassMethod/DowngradeStringReturnTypeOnToStringRector.php',
'Rector\\DowngradePhp80\\Rector\\ClassMethod\\DowngradeTrailingCommasInParamUseRector' => $vendorDir . '/rector/rector-downgrade-php/rules/DowngradePhp80/Rector/ClassMethod/DowngradeTrailingCommasInParamUseRector.php',
'Rector\\DowngradePhp80\\Rector\\ClassMethod\\RemoveReturnTypeDeclarationFromCloneRector' => $vendorDir . '/rector/rector-downgrade-php/rules/DowngradePhp80/Rector/ClassMethod/RemoveReturnTypeDeclarationFromCloneRector.php',
'Rector\\DowngradePhp80\\Rector\\Class_\\DowngradeAttributeToAnnotationRector' => $vendorDir . '/rector/rector-downgrade-php/rules/DowngradePhp80/Rector/Class_/DowngradeAttributeToAnnotationRector.php',
'Rector\\DowngradePhp80\\Rector\\Class_\\DowngradePropertyPromotionRector' => $vendorDir . '/rector/rector-downgrade-php/rules/DowngradePhp80/Rector/Class_/DowngradePropertyPromotionRector.php',
'Rector\\DowngradePhp80\\Rector\\Enum_\\DowngradeEnumToConstantListClassRector' => $vendorDir . '/rector/rector-downgrade-php/rules/DowngradePhp80/Rector/Enum_/DowngradeEnumToConstantListClassRector.php',

View File

@ -21,6 +21,7 @@ return array(
'RectorPrefix202212\\Symplify\\EasyParallel\\' => array($vendorDir . '/symplify/easy-parallel/src'),
'RectorPrefix202212\\Symplify\\AutowireArrayParameter\\' => array($vendorDir . '/symplify/autowire-array-parameter/src'),
'RectorPrefix202212\\Symfony\\Contracts\\' => array($vendorDir . '/symfony/contracts'),
'RectorPrefix202212\\Symfony\\Component\\VarExporter\\' => array($vendorDir . '/symfony/var-exporter'),
'RectorPrefix202212\\Symfony\\Component\\String\\' => array($vendorDir . '/symfony/string'),
'RectorPrefix202212\\Symfony\\Component\\Finder\\' => array($vendorDir . '/symfony/finder'),
'RectorPrefix202212\\Symfony\\Component\\Filesystem\\' => array($vendorDir . '/symfony/filesystem'),

View File

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

View File

@ -4,7 +4,7 @@
namespace Composer\Autoload;
class ComposerStaticInita806b829d393c0a5e11675def42b2d90
class ComposerStaticInit2013c4036af687539af844c049a07fba
{
public static $files = array (
'ad155f8f1cf0d418fe49e248db8c661b' => __DIR__ . '/..' . '/react/promise/src/functions_include.php',
@ -38,6 +38,7 @@ class ComposerStaticInita806b829d393c0a5e11675def42b2d90
'RectorPrefix202212\\Symplify\\EasyParallel\\' => 41,
'RectorPrefix202212\\Symplify\\AutowireArrayParameter\\' => 51,
'RectorPrefix202212\\Symfony\\Contracts\\' => 37,
'RectorPrefix202212\\Symfony\\Component\\VarExporter\\' => 49,
'RectorPrefix202212\\Symfony\\Component\\String\\' => 44,
'RectorPrefix202212\\Symfony\\Component\\Finder\\' => 44,
'RectorPrefix202212\\Symfony\\Component\\Filesystem\\' => 48,
@ -136,6 +137,10 @@ class ComposerStaticInita806b829d393c0a5e11675def42b2d90
array (
0 => __DIR__ . '/..' . '/symfony/contracts',
),
'RectorPrefix202212\\Symfony\\Component\\VarExporter\\' =>
array (
0 => __DIR__ . '/..' . '/symfony/var-exporter',
),
'RectorPrefix202212\\Symfony\\Component\\String\\' =>
array (
0 => __DIR__ . '/..' . '/symfony/string',
@ -904,6 +909,7 @@ class ComposerStaticInita806b829d393c0a5e11675def42b2d90
'RectorPrefix202212\\Symfony\\Component\\Config\\FileLocator' => __DIR__ . '/..' . '/symfony/config/FileLocator.php',
'RectorPrefix202212\\Symfony\\Component\\Config\\FileLocatorInterface' => __DIR__ . '/..' . '/symfony/config/FileLocatorInterface.php',
'RectorPrefix202212\\Symfony\\Component\\Config\\Loader\\DelegatingLoader' => __DIR__ . '/..' . '/symfony/config/Loader/DelegatingLoader.php',
'RectorPrefix202212\\Symfony\\Component\\Config\\Loader\\DirectoryAwareLoaderInterface' => __DIR__ . '/..' . '/symfony/config/Loader/DirectoryAwareLoaderInterface.php',
'RectorPrefix202212\\Symfony\\Component\\Config\\Loader\\FileLoader' => __DIR__ . '/..' . '/symfony/config/Loader/FileLoader.php',
'RectorPrefix202212\\Symfony\\Component\\Config\\Loader\\GlobFileLoader' => __DIR__ . '/..' . '/symfony/config/Loader/GlobFileLoader.php',
'RectorPrefix202212\\Symfony\\Component\\Config\\Loader\\Loader' => __DIR__ . '/..' . '/symfony/config/Loader/Loader.php',
@ -947,6 +953,7 @@ class ComposerStaticInita806b829d393c0a5e11675def42b2d90
'RectorPrefix202212\\Symfony\\Component\\Console\\Completion\\Output\\BashCompletionOutput' => __DIR__ . '/..' . '/symfony/console/Completion/Output/BashCompletionOutput.php',
'RectorPrefix202212\\Symfony\\Component\\Console\\Completion\\Output\\CompletionOutputInterface' => __DIR__ . '/..' . '/symfony/console/Completion/Output/CompletionOutputInterface.php',
'RectorPrefix202212\\Symfony\\Component\\Console\\Completion\\Output\\FishCompletionOutput' => __DIR__ . '/..' . '/symfony/console/Completion/Output/FishCompletionOutput.php',
'RectorPrefix202212\\Symfony\\Component\\Console\\Completion\\Output\\ZshCompletionOutput' => __DIR__ . '/..' . '/symfony/console/Completion/Output/ZshCompletionOutput.php',
'RectorPrefix202212\\Symfony\\Component\\Console\\Completion\\Suggestion' => __DIR__ . '/..' . '/symfony/console/Completion/Suggestion.php',
'RectorPrefix202212\\Symfony\\Component\\Console\\ConsoleEvents' => __DIR__ . '/..' . '/symfony/console/ConsoleEvents.php',
'RectorPrefix202212\\Symfony\\Component\\Console\\Cursor' => __DIR__ . '/..' . '/symfony/console/Cursor.php',
@ -982,6 +989,7 @@ class ComposerStaticInita806b829d393c0a5e11675def42b2d90
'RectorPrefix202212\\Symfony\\Component\\Console\\Helper\\HelperInterface' => __DIR__ . '/..' . '/symfony/console/Helper/HelperInterface.php',
'RectorPrefix202212\\Symfony\\Component\\Console\\Helper\\HelperSet' => __DIR__ . '/..' . '/symfony/console/Helper/HelperSet.php',
'RectorPrefix202212\\Symfony\\Component\\Console\\Helper\\InputAwareHelper' => __DIR__ . '/..' . '/symfony/console/Helper/InputAwareHelper.php',
'RectorPrefix202212\\Symfony\\Component\\Console\\Helper\\OutputWrapper' => __DIR__ . '/..' . '/symfony/console/Helper/OutputWrapper.php',
'RectorPrefix202212\\Symfony\\Component\\Console\\Helper\\ProcessHelper' => __DIR__ . '/..' . '/symfony/console/Helper/ProcessHelper.php',
'RectorPrefix202212\\Symfony\\Component\\Console\\Helper\\ProgressBar' => __DIR__ . '/..' . '/symfony/console/Helper/ProgressBar.php',
'RectorPrefix202212\\Symfony\\Component\\Console\\Helper\\ProgressIndicator' => __DIR__ . '/..' . '/symfony/console/Helper/ProgressIndicator.php',
@ -1004,6 +1012,7 @@ class ComposerStaticInita806b829d393c0a5e11675def42b2d90
'RectorPrefix202212\\Symfony\\Component\\Console\\Input\\StreamableInputInterface' => __DIR__ . '/..' . '/symfony/console/Input/StreamableInputInterface.php',
'RectorPrefix202212\\Symfony\\Component\\Console\\Input\\StringInput' => __DIR__ . '/..' . '/symfony/console/Input/StringInput.php',
'RectorPrefix202212\\Symfony\\Component\\Console\\Logger\\ConsoleLogger' => __DIR__ . '/..' . '/symfony/console/Logger/ConsoleLogger.php',
'RectorPrefix202212\\Symfony\\Component\\Console\\Output\\AnsiColorMode' => __DIR__ . '/..' . '/symfony/console/Output/AnsiColorMode.php',
'RectorPrefix202212\\Symfony\\Component\\Console\\Output\\BufferedOutput' => __DIR__ . '/..' . '/symfony/console/Output/BufferedOutput.php',
'RectorPrefix202212\\Symfony\\Component\\Console\\Output\\ConsoleOutput' => __DIR__ . '/..' . '/symfony/console/Output/ConsoleOutput.php',
'RectorPrefix202212\\Symfony\\Component\\Console\\Output\\ConsoleOutputInterface' => __DIR__ . '/..' . '/symfony/console/Output/ConsoleOutputInterface.php',
@ -1136,8 +1145,10 @@ class ComposerStaticInita806b829d393c0a5e11675def42b2d90
'RectorPrefix202212\\Symfony\\Component\\DependencyInjection\\Extension\\ExtensionTrait' => __DIR__ . '/..' . '/symfony/dependency-injection/Extension/ExtensionTrait.php',
'RectorPrefix202212\\Symfony\\Component\\DependencyInjection\\Extension\\PrependExtensionInterface' => __DIR__ . '/..' . '/symfony/dependency-injection/Extension/PrependExtensionInterface.php',
'RectorPrefix202212\\Symfony\\Component\\DependencyInjection\\LazyProxy\\Instantiator\\InstantiatorInterface' => __DIR__ . '/..' . '/symfony/dependency-injection/LazyProxy/Instantiator/InstantiatorInterface.php',
'RectorPrefix202212\\Symfony\\Component\\DependencyInjection\\LazyProxy\\Instantiator\\LazyServiceInstantiator' => __DIR__ . '/..' . '/symfony/dependency-injection/LazyProxy/Instantiator/LazyServiceInstantiator.php',
'RectorPrefix202212\\Symfony\\Component\\DependencyInjection\\LazyProxy\\Instantiator\\RealServiceInstantiator' => __DIR__ . '/..' . '/symfony/dependency-injection/LazyProxy/Instantiator/RealServiceInstantiator.php',
'RectorPrefix202212\\Symfony\\Component\\DependencyInjection\\LazyProxy\\PhpDumper\\DumperInterface' => __DIR__ . '/..' . '/symfony/dependency-injection/LazyProxy/PhpDumper/DumperInterface.php',
'RectorPrefix202212\\Symfony\\Component\\DependencyInjection\\LazyProxy\\PhpDumper\\LazyServiceDumper' => __DIR__ . '/..' . '/symfony/dependency-injection/LazyProxy/PhpDumper/LazyServiceDumper.php',
'RectorPrefix202212\\Symfony\\Component\\DependencyInjection\\LazyProxy\\PhpDumper\\NullDumper' => __DIR__ . '/..' . '/symfony/dependency-injection/LazyProxy/PhpDumper/NullDumper.php',
'RectorPrefix202212\\Symfony\\Component\\DependencyInjection\\LazyProxy\\ProxyHelper' => __DIR__ . '/..' . '/symfony/dependency-injection/LazyProxy/ProxyHelper.php',
'RectorPrefix202212\\Symfony\\Component\\DependencyInjection\\Loader\\ClosureLoader' => __DIR__ . '/..' . '/symfony/dependency-injection/Loader/ClosureLoader.php',
@ -1239,6 +1250,24 @@ class ComposerStaticInita806b829d393c0a5e11675def42b2d90
'RectorPrefix202212\\Symfony\\Component\\String\\Slugger\\AsciiSlugger' => __DIR__ . '/..' . '/symfony/string/Slugger/AsciiSlugger.php',
'RectorPrefix202212\\Symfony\\Component\\String\\Slugger\\SluggerInterface' => __DIR__ . '/..' . '/symfony/string/Slugger/SluggerInterface.php',
'RectorPrefix202212\\Symfony\\Component\\String\\UnicodeString' => __DIR__ . '/..' . '/symfony/string/UnicodeString.php',
'RectorPrefix202212\\Symfony\\Component\\VarExporter\\Exception\\ClassNotFoundException' => __DIR__ . '/..' . '/symfony/var-exporter/Exception/ClassNotFoundException.php',
'RectorPrefix202212\\Symfony\\Component\\VarExporter\\Exception\\ExceptionInterface' => __DIR__ . '/..' . '/symfony/var-exporter/Exception/ExceptionInterface.php',
'RectorPrefix202212\\Symfony\\Component\\VarExporter\\Exception\\LogicException' => __DIR__ . '/..' . '/symfony/var-exporter/Exception/LogicException.php',
'RectorPrefix202212\\Symfony\\Component\\VarExporter\\Exception\\NotInstantiableTypeException' => __DIR__ . '/..' . '/symfony/var-exporter/Exception/NotInstantiableTypeException.php',
'RectorPrefix202212\\Symfony\\Component\\VarExporter\\Hydrator' => __DIR__ . '/..' . '/symfony/var-exporter/Hydrator.php',
'RectorPrefix202212\\Symfony\\Component\\VarExporter\\Instantiator' => __DIR__ . '/..' . '/symfony/var-exporter/Instantiator.php',
'RectorPrefix202212\\Symfony\\Component\\VarExporter\\Internal\\Exporter' => __DIR__ . '/..' . '/symfony/var-exporter/Internal/Exporter.php',
'RectorPrefix202212\\Symfony\\Component\\VarExporter\\Internal\\Hydrator' => __DIR__ . '/..' . '/symfony/var-exporter/Internal/Hydrator.php',
'RectorPrefix202212\\Symfony\\Component\\VarExporter\\Internal\\LazyObjectRegistry' => __DIR__ . '/..' . '/symfony/var-exporter/Internal/LazyObjectRegistry.php',
'RectorPrefix202212\\Symfony\\Component\\VarExporter\\Internal\\LazyObjectState' => __DIR__ . '/..' . '/symfony/var-exporter/Internal/LazyObjectState.php',
'RectorPrefix202212\\Symfony\\Component\\VarExporter\\Internal\\Reference' => __DIR__ . '/..' . '/symfony/var-exporter/Internal/Reference.php',
'RectorPrefix202212\\Symfony\\Component\\VarExporter\\Internal\\Registry' => __DIR__ . '/..' . '/symfony/var-exporter/Internal/Registry.php',
'RectorPrefix202212\\Symfony\\Component\\VarExporter\\Internal\\Values' => __DIR__ . '/..' . '/symfony/var-exporter/Internal/Values.php',
'RectorPrefix202212\\Symfony\\Component\\VarExporter\\LazyGhostTrait' => __DIR__ . '/..' . '/symfony/var-exporter/LazyGhostTrait.php',
'RectorPrefix202212\\Symfony\\Component\\VarExporter\\LazyObjectInterface' => __DIR__ . '/..' . '/symfony/var-exporter/LazyObjectInterface.php',
'RectorPrefix202212\\Symfony\\Component\\VarExporter\\LazyProxyTrait' => __DIR__ . '/..' . '/symfony/var-exporter/LazyProxyTrait.php',
'RectorPrefix202212\\Symfony\\Component\\VarExporter\\ProxyHelper' => __DIR__ . '/..' . '/symfony/var-exporter/ProxyHelper.php',
'RectorPrefix202212\\Symfony\\Component\\VarExporter\\VarExporter' => __DIR__ . '/..' . '/symfony/var-exporter/VarExporter.php',
'RectorPrefix202212\\Symfony\\Contracts\\Cache\\CacheInterface' => __DIR__ . '/..' . '/symfony/contracts/Cache/CacheInterface.php',
'RectorPrefix202212\\Symfony\\Contracts\\Cache\\CacheTrait' => __DIR__ . '/..' . '/symfony/contracts/Cache/CacheTrait.php',
'RectorPrefix202212\\Symfony\\Contracts\\Cache\\CallbackInterface' => __DIR__ . '/..' . '/symfony/contracts/Cache/CallbackInterface.php',
@ -1983,6 +2012,7 @@ class ComposerStaticInita806b829d393c0a5e11675def42b2d90
'Rector\\DowngradePhp80\\Rector\\ClassMethod\\DowngradeStaticTypeDeclarationRector' => __DIR__ . '/..' . '/rector/rector-downgrade-php/rules/DowngradePhp80/Rector/ClassMethod/DowngradeStaticTypeDeclarationRector.php',
'Rector\\DowngradePhp80\\Rector\\ClassMethod\\DowngradeStringReturnTypeOnToStringRector' => __DIR__ . '/..' . '/rector/rector-downgrade-php/rules/DowngradePhp80/Rector/ClassMethod/DowngradeStringReturnTypeOnToStringRector.php',
'Rector\\DowngradePhp80\\Rector\\ClassMethod\\DowngradeTrailingCommasInParamUseRector' => __DIR__ . '/..' . '/rector/rector-downgrade-php/rules/DowngradePhp80/Rector/ClassMethod/DowngradeTrailingCommasInParamUseRector.php',
'Rector\\DowngradePhp80\\Rector\\ClassMethod\\RemoveReturnTypeDeclarationFromCloneRector' => __DIR__ . '/..' . '/rector/rector-downgrade-php/rules/DowngradePhp80/Rector/ClassMethod/RemoveReturnTypeDeclarationFromCloneRector.php',
'Rector\\DowngradePhp80\\Rector\\Class_\\DowngradeAttributeToAnnotationRector' => __DIR__ . '/..' . '/rector/rector-downgrade-php/rules/DowngradePhp80/Rector/Class_/DowngradeAttributeToAnnotationRector.php',
'Rector\\DowngradePhp80\\Rector\\Class_\\DowngradePropertyPromotionRector' => __DIR__ . '/..' . '/rector/rector-downgrade-php/rules/DowngradePhp80/Rector/Class_/DowngradePropertyPromotionRector.php',
'Rector\\DowngradePhp80\\Rector\\Enum_\\DowngradeEnumToConstantListClassRector' => __DIR__ . '/..' . '/rector/rector-downgrade-php/rules/DowngradePhp80/Rector/Enum_/DowngradeEnumToConstantListClassRector.php',
@ -3016,9 +3046,9 @@ class ComposerStaticInita806b829d393c0a5e11675def42b2d90
public static function getInitializer(ClassLoader $loader)
{
return \Closure::bind(function () use ($loader) {
$loader->prefixLengthsPsr4 = ComposerStaticInita806b829d393c0a5e11675def42b2d90::$prefixLengthsPsr4;
$loader->prefixDirsPsr4 = ComposerStaticInita806b829d393c0a5e11675def42b2d90::$prefixDirsPsr4;
$loader->classMap = ComposerStaticInita806b829d393c0a5e11675def42b2d90::$classMap;
$loader->prefixLengthsPsr4 = ComposerStaticInit2013c4036af687539af844c049a07fba::$prefixLengthsPsr4;
$loader->prefixDirsPsr4 = ComposerStaticInit2013c4036af687539af844c049a07fba::$prefixDirsPsr4;
$loader->classMap = ComposerStaticInit2013c4036af687539af844c049a07fba::$classMap;
}, null, ClassLoader::class);
}

View File

@ -1849,12 +1849,12 @@
"source": {
"type": "git",
"url": "https:\/\/github.com\/rectorphp\/rector-downgrade-php.git",
"reference": "4a0952896de3c5bccaf46dc2c7c35ceee2a8c0e1"
"reference": "5a6a365b6688dbd11424ff8801f393e37235fc84"
},
"dist": {
"type": "zip",
"url": "https:\/\/api.github.com\/repos\/rectorphp\/rector-downgrade-php\/zipball\/4a0952896de3c5bccaf46dc2c7c35ceee2a8c0e1",
"reference": "4a0952896de3c5bccaf46dc2c7c35ceee2a8c0e1",
"url": "https:\/\/api.github.com\/repos\/rectorphp\/rector-downgrade-php\/zipball\/5a6a365b6688dbd11424ff8801f393e37235fc84",
"reference": "5a6a365b6688dbd11424ff8801f393e37235fc84",
"shasum": ""
},
"require": {
@ -1871,6 +1871,7 @@
"phpunit\/phpunit": "^9.5",
"rector\/phpstan-rules": "^0.6",
"rector\/rector-debugging": "dev-main",
"rector\/rector-generator": "^0.6.14",
"rector\/rector-src": "dev-main",
"symplify\/easy-ci": "^11.1",
"symplify\/easy-coding-standard": "^11.1",
@ -1879,7 +1880,7 @@
"symplify\/rule-doc-generator": "^11.1",
"symplify\/vendor-patches": "^11.1"
},
"time": "2022-11-23T10:25:55+00:00",
"time": "2022-12-01T16:51:06+00:00",
"default-branch": true,
"type": "rector-extension",
"extra": {
@ -2194,17 +2195,17 @@
},
{
"name": "symfony\/config",
"version": "v6.1.3",
"version_normalized": "6.1.3.0",
"version": "v6.2.0",
"version_normalized": "6.2.0.0",
"source": {
"type": "git",
"url": "https:\/\/github.com\/symfony\/config.git",
"reference": "a0645dc585d378b73c01115dd7ab9348f7d40c85"
"reference": "ebf27792246165a2a0b6b69ec9c620cac8c5a2f0"
},
"dist": {
"type": "zip",
"url": "https:\/\/api.github.com\/repos\/symfony\/config\/zipball\/a0645dc585d378b73c01115dd7ab9348f7d40c85",
"reference": "a0645dc585d378b73c01115dd7ab9348f7d40c85",
"url": "https:\/\/api.github.com\/repos\/symfony\/config\/zipball\/ebf27792246165a2a0b6b69ec9c620cac8c5a2f0",
"reference": "ebf27792246165a2a0b6b69ec9c620cac8c5a2f0",
"shasum": ""
},
"require": {
@ -2226,7 +2227,7 @@
"suggest": {
"symfony\/yaml": "To use the yaml reference dumper"
},
"time": "2022-07-20T15:00:40+00:00",
"time": "2022-11-02T09:08:04+00:00",
"type": "library",
"installation-source": "dist",
"autoload": {
@ -2254,7 +2255,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.1.3"
"source": "https:\/\/github.com\/symfony\/config\/tree\/v6.2.0"
},
"funding": [
{
@ -2274,17 +2275,17 @@
},
{
"name": "symfony\/console",
"version": "v6.1.8",
"version_normalized": "6.1.8.0",
"version": "v6.2.0",
"version_normalized": "6.2.0.0",
"source": {
"type": "git",
"url": "https:\/\/github.com\/symfony\/console.git",
"reference": "a71863ea74f444d93c768deb3e314e1f750cf20d"
"reference": "75d4749d9620a8fa21a2d2847800a84b5c4e7682"
},
"dist": {
"type": "zip",
"url": "https:\/\/api.github.com\/repos\/symfony\/console\/zipball\/a71863ea74f444d93c768deb3e314e1f750cf20d",
"reference": "a71863ea74f444d93c768deb3e314e1f750cf20d",
"url": "https:\/\/api.github.com\/repos\/symfony\/console\/zipball\/75d4749d9620a8fa21a2d2847800a84b5c4e7682",
"reference": "75d4749d9620a8fa21a2d2847800a84b5c4e7682",
"shasum": ""
},
"require": {
@ -2319,7 +2320,7 @@
"symfony\/lock": "",
"symfony\/process": ""
},
"time": "2022-11-25T18:59:16+00:00",
"time": "2022-11-29T16:44:51+00:00",
"type": "library",
"installation-source": "dist",
"autoload": {
@ -2353,7 +2354,7 @@
"terminal"
],
"support": {
"source": "https:\/\/github.com\/symfony\/console\/tree\/v6.1.8"
"source": "https:\/\/github.com\/symfony\/console\/tree\/v6.2.0"
},
"funding": [
{
@ -2477,30 +2478,31 @@
},
{
"name": "symfony\/dependency-injection",
"version": "v6.1.8",
"version_normalized": "6.1.8.0",
"version": "v6.2.0",
"version_normalized": "6.2.0.0",
"source": {
"type": "git",
"url": "https:\/\/github.com\/symfony\/dependency-injection.git",
"reference": "11e33ed84db0ced77511a23b35168db127909f0e"
"reference": "bb328032f400961be5db5aed87fac9742b506f80"
},
"dist": {
"type": "zip",
"url": "https:\/\/api.github.com\/repos\/symfony\/dependency-injection\/zipball\/11e33ed84db0ced77511a23b35168db127909f0e",
"reference": "11e33ed84db0ced77511a23b35168db127909f0e",
"url": "https:\/\/api.github.com\/repos\/symfony\/dependency-injection\/zipball\/bb328032f400961be5db5aed87fac9742b506f80",
"reference": "bb328032f400961be5db5aed87fac9742b506f80",
"shasum": ""
},
"require": {
"php": ">=8.1",
"psr\/container": "^1.1|^2.0",
"symfony\/deprecation-contracts": "^2.1|^3",
"symfony\/service-contracts": "^1.1.6|^2.0|^3.0"
"symfony\/service-contracts": "^1.1.6|^2.0|^3.0",
"symfony\/var-exporter": "^6.2"
},
"conflict": {
"ext-psr": "<1.1|>=2",
"symfony\/config": "<6.1",
"symfony\/finder": "<5.4",
"symfony\/proxy-manager-bridge": "<5.4",
"symfony\/proxy-manager-bridge": "<6.2",
"symfony\/yaml": "<5.4"
},
"provide": {
@ -2519,12 +2521,12 @@
"symfony\/proxy-manager-bridge": "Generate service proxies to lazy load them",
"symfony\/yaml": ""
},
"time": "2022-11-25T07:34:52+00:00",
"time": "2022-11-25T07:37:13+00:00",
"type": "library",
"extra": {
"patches_applied": [
"https:\/\/raw.githubusercontent.com\/symplify\/vendor-patch-files\/main\/patches\/generic-php-config-loader.patch",
"https:\/\/raw.githubusercontent.com\/rectorphp\/vendor-patches\/main\/patches\/symfony-dependency-injection.patch"
"https:\/\/raw.githubusercontent.com\/rectorphp\/vendor-patches\/main\/patches\/symfony-dependency-injection.patch",
"https:\/\/raw.githubusercontent.com\/rectorphp\/vendor-patches\/main\/patches\/symfony-dependency-injection-loader-phpfileloader-php.patch"
]
},
"installation-source": "dist",
@ -2553,7 +2555,7 @@
"description": "Allows you to standardize and centralize the way objects are constructed in your application",
"homepage": "https:\/\/symfony.com",
"support": {
"source": "https:\/\/github.com\/symfony\/dependency-injection\/tree\/v6.1.8"
"source": "https:\/\/github.com\/symfony\/dependency-injection\/tree\/v6.2.0"
},
"funding": [
{
@ -2639,17 +2641,17 @@
},
{
"name": "symfony\/finder",
"version": "v6.1.3",
"version_normalized": "6.1.3.0",
"version": "v6.2.0",
"version_normalized": "6.2.0.0",
"source": {
"type": "git",
"url": "https:\/\/github.com\/symfony\/finder.git",
"reference": "39696bff2c2970b3779a5cac7bf9f0b88fc2b709"
"reference": "eb2355f69519e4ef33f1835bca4c935f5d42e570"
},
"dist": {
"type": "zip",
"url": "https:\/\/api.github.com\/repos\/symfony\/finder\/zipball\/39696bff2c2970b3779a5cac7bf9f0b88fc2b709",
"reference": "39696bff2c2970b3779a5cac7bf9f0b88fc2b709",
"url": "https:\/\/api.github.com\/repos\/symfony\/finder\/zipball\/eb2355f69519e4ef33f1835bca4c935f5d42e570",
"reference": "eb2355f69519e4ef33f1835bca4c935f5d42e570",
"shasum": ""
},
"require": {
@ -2658,7 +2660,7 @@
"require-dev": {
"symfony\/filesystem": "^6.0"
},
"time": "2022-07-29T07:42:06+00:00",
"time": "2022-10-09T08:55:40+00:00",
"type": "library",
"installation-source": "dist",
"autoload": {
@ -2686,7 +2688,7 @@
"description": "Finds files and directories via an intuitive fluent interface",
"homepage": "https:\/\/symfony.com",
"support": {
"source": "https:\/\/github.com\/symfony\/finder\/tree\/v6.1.3"
"source": "https:\/\/github.com\/symfony\/finder\/tree\/v6.2.0"
},
"funding": [
{
@ -2879,17 +2881,17 @@
},
{
"name": "symfony\/string",
"version": "v6.1.7",
"version_normalized": "6.1.7.0",
"version": "v6.2.0",
"version_normalized": "6.2.0.0",
"source": {
"type": "git",
"url": "https:\/\/github.com\/symfony\/string.git",
"reference": "823f143370880efcbdfa2dbca946b3358c4707e5"
"reference": "145702685e0d12f81d755c71127bfff7582fdd36"
},
"dist": {
"type": "zip",
"url": "https:\/\/api.github.com\/repos\/symfony\/string\/zipball\/823f143370880efcbdfa2dbca946b3358c4707e5",
"reference": "823f143370880efcbdfa2dbca946b3358c4707e5",
"url": "https:\/\/api.github.com\/repos\/symfony\/string\/zipball\/145702685e0d12f81d755c71127bfff7582fdd36",
"reference": "145702685e0d12f81d755c71127bfff7582fdd36",
"shasum": ""
},
"require": {
@ -2905,10 +2907,11 @@
"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\/var-exporter": "^5.4|^6.0"
},
"time": "2022-10-10T09:34:31+00:00",
"time": "2022-11-30T17:13:47+00:00",
"type": "library",
"installation-source": "dist",
"autoload": {
@ -2947,7 +2950,7 @@
"utf8"
],
"support": {
"source": "https:\/\/github.com\/symfony\/string\/tree\/v6.1.7"
"source": "https:\/\/github.com\/symfony\/string\/tree\/v6.2.0"
},
"funding": [
{
@ -2965,6 +2968,83 @@
],
"install-path": "..\/symfony\/string"
},
{
"name": "symfony\/var-exporter",
"version": "v6.2.0",
"version_normalized": "6.2.0.0",
"source": {
"type": "git",
"url": "https:\/\/github.com\/symfony\/var-exporter.git",
"reference": "0437f26ca0c648071cc15ddacd26152cc65f4cd6"
},
"dist": {
"type": "zip",
"url": "https:\/\/api.github.com\/repos\/symfony\/var-exporter\/zipball\/0437f26ca0c648071cc15ddacd26152cc65f4cd6",
"reference": "0437f26ca0c648071cc15ddacd26152cc65f4cd6",
"shasum": ""
},
"require": {
"php": ">=8.1"
},
"require-dev": {
"symfony\/var-dumper": "^5.4|^6.0"
},
"time": "2022-11-25T08:33:31+00:00",
"type": "library",
"installation-source": "dist",
"autoload": {
"psr-4": {
"RectorPrefix202212\\Symfony\\Component\\VarExporter\\": ""
},
"exclude-from-classmap": [
"\/Tests\/"
]
},
"notification-url": "https:\/\/packagist.org\/downloads\/",
"license": [
"MIT"
],
"authors": [
{
"name": "Nicolas Grekas",
"email": "p@tchwork.com"
},
{
"name": "Symfony Community",
"homepage": "https:\/\/symfony.com\/contributors"
}
],
"description": "Allows exporting any serializable PHP data structure to plain PHP code",
"homepage": "https:\/\/symfony.com",
"keywords": [
"clone",
"construct",
"export",
"hydrate",
"instantiate",
"lazy loading",
"proxy",
"serialize"
],
"support": {
"source": "https:\/\/github.com\/symfony\/var-exporter\/tree\/v6.2.0"
},
"funding": [
{
"url": "https:\/\/symfony.com\/sponsor",
"type": "custom"
},
{
"url": "https:\/\/github.com\/fabpot",
"type": "github"
},
{
"url": "https:\/\/tidelift.com\/funding\/github\/packagist\/symfony\/symfony",
"type": "tidelift"
}
],
"install-path": "..\/symfony\/var-exporter"
},
{
"name": "symplify\/autowire-array-parameter",
"version": "11.1.17",

File diff suppressed because one or more lines are too long

View File

@ -9,7 +9,7 @@ namespace Rector\RectorInstaller;
*/
final class GeneratedConfig
{
public const EXTENSIONS = array('rector/rector-doctrine' => array('install_path' => '/home/runner/work/rector-src/rector-src/vendor/rector/rector-doctrine', 'relative_install_path' => '../../rector-doctrine', 'extra' => array('includes' => array(0 => 'config/config.php')), 'version' => 'dev-main bf394ee'), 'rector/rector-downgrade-php' => array('install_path' => '/home/runner/work/rector-src/rector-src/vendor/rector/rector-downgrade-php', 'relative_install_path' => '../../rector-downgrade-php', 'extra' => array('includes' => array(0 => 'config/config.php')), 'version' => 'dev-main 4a09528'), 'rector/rector-php-parser' => array('install_path' => '/home/runner/work/rector-src/rector-src/vendor/rector/rector-php-parser', 'relative_install_path' => '../../rector-php-parser', 'extra' => array('includes' => array(0 => 'config/config.php')), 'version' => 'dev-main 9ea5f62'), 'rector/rector-phpunit' => array('install_path' => '/home/runner/work/rector-src/rector-src/vendor/rector/rector-phpunit', 'relative_install_path' => '../../rector-phpunit', 'extra' => array('includes' => array(0 => 'config/config.php')), 'version' => 'dev-main e646c56'), 'rector/rector-symfony' => array('install_path' => '/home/runner/work/rector-src/rector-src/vendor/rector/rector-symfony', 'relative_install_path' => '../../rector-symfony', 'extra' => array('includes' => array(0 => 'config/config.php')), 'version' => 'dev-main caa1373'));
public const EXTENSIONS = array('rector/rector-doctrine' => array('install_path' => '/home/runner/work/rector-src/rector-src/vendor/rector/rector-doctrine', 'relative_install_path' => '../../rector-doctrine', 'extra' => array('includes' => array(0 => 'config/config.php')), 'version' => 'dev-main bf394ee'), 'rector/rector-downgrade-php' => array('install_path' => '/home/runner/work/rector-src/rector-src/vendor/rector/rector-downgrade-php', 'relative_install_path' => '../../rector-downgrade-php', 'extra' => array('includes' => array(0 => 'config/config.php')), 'version' => 'dev-main 5a6a365'), 'rector/rector-php-parser' => array('install_path' => '/home/runner/work/rector-src/rector-src/vendor/rector/rector-php-parser', 'relative_install_path' => '../../rector-php-parser', 'extra' => array('includes' => array(0 => 'config/config.php')), 'version' => 'dev-main 9ea5f62'), 'rector/rector-phpunit' => array('install_path' => '/home/runner/work/rector-src/rector-src/vendor/rector/rector-phpunit', 'relative_install_path' => '../../rector-phpunit', 'extra' => array('includes' => array(0 => 'config/config.php')), 'version' => 'dev-main e646c56'), 'rector/rector-symfony' => array('install_path' => '/home/runner/work/rector-src/rector-src/vendor/rector/rector-symfony', 'relative_install_path' => '../../rector-symfony', 'extra' => array('includes' => array(0 => 'config/config.php')), 'version' => 'dev-main caa1373'));
private function __construct()
{
}

View File

@ -14,6 +14,7 @@
"phpunit\/phpunit": "^9.5",
"rector\/phpstan-rules": "^0.6",
"rector\/rector-debugging": "dev-main",
"rector\/rector-generator": "^0.6.14",
"rector\/rector-src": "dev-main",
"symplify\/easy-ci": "^11.1",
"symplify\/easy-coding-standard": "^11.1",

View File

@ -3,6 +3,7 @@
declare (strict_types=1);
namespace RectorPrefix202212;
use Rector\DowngradePhp80\Rector\ClassMethod\RemoveReturnTypeDeclarationFromCloneRector;
use Rector\Config\RectorConfig;
use Rector\Core\ValueObject\PhpVersion;
use Rector\DowngradePhp80\Rector\ArrayDimFetch\DowngradeDereferenceableOperationRector;
@ -76,4 +77,5 @@ return static function (RectorConfig $rectorConfig) : void {
$rectorConfig->rule(DowngradeNumberFormatNoFourthArgRector::class);
$rectorConfig->rule(DowngradeStringReturnTypeOnToStringRector::class);
$rectorConfig->rule(DowngradeMixedTypeTypedPropertyRector::class);
$rectorConfig->rule(RemoveReturnTypeDeclarationFromCloneRector::class);
};

View File

@ -7,6 +7,7 @@ use PhpParser\Node;
use PhpParser\Node\Expr\ArrowFunction;
use PhpParser\Node\Expr\Closure;
use PhpParser\Node\Stmt\Return_;
use PhpParser\Node\Stmt\Throw_;
use Rector\Core\Rector\AbstractRector;
use Rector\Php72\NodeFactory\AnonymousFunctionFactory;
use Symplify\RuleDocGenerator\ValueObject\CodeSample\CodeSample;
@ -66,6 +67,19 @@ CODE_SAMPLE
public function refactor(Node $node) : Closure
{
$stmts = [new Return_($node->expr)];
return $this->anonymousFunctionFactory->create($node->params, $stmts, $node->returnType, $node->static);
$anonymousFunctionFactory = $this->anonymousFunctionFactory->create($node->params, $stmts, $node->returnType, $node->static);
// downgrade "return throw"
$this->traverseNodesWithCallable($anonymousFunctionFactory, static function (Node $node) : ?Throw_ {
if (!$node instanceof Return_) {
return null;
}
if (!$node->expr instanceof Node\Expr\Throw_) {
return null;
}
$throw = $node->expr;
// throw expr to throw stmts
return new Throw_($throw->expr);
});
return $anonymousFunctionFactory;
}
}

View File

@ -0,0 +1,59 @@
<?php
declare (strict_types=1);
namespace Rector\DowngradePhp80\Rector\ClassMethod;
use PhpParser\Node;
use PhpParser\Node\Stmt\ClassMethod;
use Rector\Core\Rector\AbstractRector;
use Symplify\RuleDocGenerator\ValueObject\CodeSample\CodeSample;
use Symplify\RuleDocGenerator\ValueObject\RuleDefinition;
/**
* @changelog https://3v4l.org/Wgj19
*
* @see \Rector\Tests\DowngradePhp80\Rector\ClassMethod\RemoveReturnTypeDeclarationFromCloneRector\RemoveReturnTypeDeclarationFromCloneRectorTest
*/
final class RemoveReturnTypeDeclarationFromCloneRector extends AbstractRector
{
public function getRuleDefinition() : RuleDefinition
{
return new RuleDefinition('Remove return type from __clone() method', [new CodeSample(<<<'CODE_SAMPLE'
final class SomeClass
{
public function __clone(): void
{
}
}
CODE_SAMPLE
, <<<'CODE_SAMPLE'
final class SomeClass
{
public function __clone()
{
}
}
CODE_SAMPLE
)]);
}
/**
* @return array<class-string<Node>>
*/
public function getNodeTypes() : array
{
return [ClassMethod::class];
}
/**
* @param ClassMethod $node
*/
public function refactor(Node $node) : ?Node
{
if (!$this->isName($node, '__clone')) {
return null;
}
if (!$node->returnType instanceof Node) {
return null;
}
$node->returnType = null;
return $node;
}
}

View File

@ -3,16 +3,21 @@
declare (strict_types=1);
namespace Rector\DowngradePhp80\Rector\Expression;
use PhpParser\Node\Expr;
use PhpParser\Node;
use PhpParser\Node\Expr\ArrayDimFetch;
use PhpParser\Node\Expr\Assign;
use PhpParser\Node\Expr\BinaryOp\Coalesce;
use PhpParser\Node\Expr\BinaryOp\Identical;
use PhpParser\Node\Expr\BinaryOp\NotIdentical;
use PhpParser\Node\Expr\BooleanNot;
use PhpParser\Node\Expr\ConstFetch;
use PhpParser\Node\Expr\Isset_;
use PhpParser\Node\Expr\PropertyFetch;
use PhpParser\Node\Expr\Ternary;
use PhpParser\Node\Expr\Throw_;
use PhpParser\Node\Expr\Variable;
use PhpParser\Node\Name;
use PhpParser\Node\Stmt;
use PhpParser\Node\Stmt\Expression;
use PhpParser\Node\Stmt\If_;
@ -21,6 +26,7 @@ use Rector\Core\NodeAnalyzer\CoalesceAnalyzer;
use Rector\Core\NodeManipulator\BinaryOpManipulator;
use Rector\Core\NodeManipulator\IfManipulator;
use Rector\Core\Rector\AbstractRector;
use Rector\PostRector\Collector\NodesToAddCollector;
use Symplify\RuleDocGenerator\ValueObject\CodeSample\CodeSample;
use Symplify\RuleDocGenerator\ValueObject\RuleDefinition;
/**
@ -45,11 +51,17 @@ final class DowngradeThrowExprRector extends AbstractRector
* @var \Rector\Core\NodeManipulator\BinaryOpManipulator
*/
private $binaryOpManipulator;
public function __construct(IfManipulator $ifManipulator, CoalesceAnalyzer $coalesceAnalyzer, BinaryOpManipulator $binaryOpManipulator)
/**
* @readonly
* @var \Rector\PostRector\Collector\NodesToAddCollector
*/
private $nodesToAddCollector;
public function __construct(IfManipulator $ifManipulator, CoalesceAnalyzer $coalesceAnalyzer, BinaryOpManipulator $binaryOpManipulator, NodesToAddCollector $nodesToAddCollector)
{
$this->ifManipulator = $ifManipulator;
$this->coalesceAnalyzer = $coalesceAnalyzer;
$this->binaryOpManipulator = $binaryOpManipulator;
$this->nodesToAddCollector = $nodesToAddCollector;
}
public function getRuleDefinition() : RuleDefinition
{
@ -70,14 +82,17 @@ CODE_SAMPLE
*/
public function getNodeTypes() : array
{
return [Expression::class, Return_::class];
return [Expression::class, Return_::class, Coalesce::class];
}
/**
* @param Expression|Return_ $node
* @param Expression|Return_|Coalesce $node
* @return Node|Node[]|null
*/
public function refactor(Node $node)
{
if ($node instanceof Coalesce) {
return $this->refactorDirectCoalesce($node);
}
if ($node instanceof Return_) {
return $this->refactorReturn($node);
}
@ -172,11 +187,19 @@ CODE_SAMPLE
$if = $this->createIf($coalesce, $coalesce->right);
return [$if, new Return_($coalesce->left)];
}
if ($return->expr instanceof Throw_) {
return [new Expression($return->expr)];
}
return null;
}
private function createIf(Coalesce $coalesce, Throw_ $throw) : If_
{
$booleanNot = new BooleanNot(new Isset_([$coalesce->left]));
$conditionalExpr = $coalesce->left;
if ($conditionalExpr instanceof Variable || $conditionalExpr instanceof ArrayDimFetch || $conditionalExpr instanceof PropertyFetch) {
$booleanNot = new BooleanNot(new Isset_([$conditionalExpr]));
} else {
$booleanNot = new NotIdentical($conditionalExpr, new ConstFetch(new Name('null')));
}
return new If_($booleanNot, ['stmts' => [new Expression($throw)]]);
}
/**
@ -189,4 +212,16 @@ CODE_SAMPLE
}
return new Identical($coalesce->left, $this->nodeFactory->createNull());
}
private function refactorDirectCoalesce(Coalesce $coalesce) : ?Expr
{
if (!$coalesce->right instanceof Throw_) {
return null;
}
// add condition if above
$throwExpr = $coalesce->right;
$throw = new Stmt\Throw_($throwExpr->expr);
$if = new If_(new Identical($coalesce->left, new ConstFetch(new Name('null'))), ['stmts' => [$throw]]);
$this->nodesToAddCollector->addNodeBeforeNode($if, $coalesce);
return $coalesce->left;
}
}

View File

@ -13,6 +13,7 @@ namespace RectorPrefix202212\Symfony\Component\Config\Builder;
use RectorPrefix202212\Symfony\Component\Config\Definition\ArrayNode;
use RectorPrefix202212\Symfony\Component\Config\Definition\BaseNode;
use RectorPrefix202212\Symfony\Component\Config\Definition\BooleanNode;
use RectorPrefix202212\Symfony\Component\Config\Definition\Builder\ExprBuilder;
use RectorPrefix202212\Symfony\Component\Config\Definition\ConfigurationInterface;
use RectorPrefix202212\Symfony\Component\Config\Definition\EnumNode;
use RectorPrefix202212\Symfony\Component\Config\Definition\Exception\InvalidConfigurationException;
@ -123,14 +124,17 @@ public function NAME(): string
$hasNormalizationClosures = $this->hasNormalizationClosures($node);
$comment = $this->getComment($node);
if ($hasNormalizationClosures) {
$comment .= \sprintf(' * @return %s|$this' . "\n ", $childClass->getFqcn());
$comment = \sprintf(" * @template TValue\n * @param TValue \$value\n%s", $comment);
$comment .= \sprintf(' * @return %s|$this' . "\n", $childClass->getFqcn());
$comment .= \sprintf(' * @psalm-return (TValue is array ? %s : static)' . "\n ", $childClass->getFqcn());
}
if ('' !== $comment) {
$comment = "/**\n{$comment}*/\n";
}
$property = $class->addProperty($node->getName(), $this->getType($childClass->getFqcn(), $hasNormalizationClosures));
$nodeTypes = $this->getParameterTypes($node);
$body = $hasNormalizationClosures ? '
COMMENTpublic function NAME(mixed $value = []): CLASS|static
COMMENTpublic function NAME(PARAM_TYPE $value = []): CLASS|static
{
if (!\\is_array($value)) {
$this->_usedProperties[\'PROPERTY\'] = true;
@ -160,7 +164,7 @@ COMMENTpublic function NAME(array $value = []): CLASS
return $this->PROPERTY;
}';
$class->addUse(InvalidConfigurationException::class);
$class->addMethod($node->getName(), $body, ['COMMENT' => $comment, 'PROPERTY' => $property->getName(), 'CLASS' => $childClass->getFqcn()]);
$class->addMethod($node->getName(), $body, ['COMMENT' => $comment, 'PROPERTY' => $property->getName(), 'CLASS' => $childClass->getFqcn(), 'PARAM_TYPE' => \in_array('mixed', $nodeTypes, \true) ? 'mixed' : \implode('|', $nodeTypes)]);
$this->buildNode($node, $childClass, $this->getSubNamespace($childClass));
}
private function handleVariableNode(VariableNode $node, ClassBuilder $class) : void
@ -188,26 +192,30 @@ public function NAME(mixed $valueDEFAULT): static
$prototype = $node->getPrototype();
$methodName = $name;
$hasNormalizationClosures = $this->hasNormalizationClosures($node) || $this->hasNormalizationClosures($prototype);
$parameterType = $this->getParameterType($prototype);
if (null !== $parameterType || $prototype instanceof ScalarNode) {
$nodeParameterTypes = $this->getParameterTypes($node);
$prototypeParameterTypes = $this->getParameterTypes($prototype);
if (!$prototype instanceof ArrayNode || $prototype instanceof PrototypedArrayNode && $prototype->getPrototype() instanceof ScalarNode) {
$class->addUse(ParamConfigurator::class);
$property = $class->addProperty($node->getName());
if (null === ($key = $node->getKeyAttribute())) {
// This is an array of values; don't use singular name
$nodeTypesWithoutArray = \array_filter($nodeParameterTypes, static function ($type) {
return 'array' !== $type;
});
$body = '
/**
* @param PHPDOC_TYPE $value
* @param ParamConfigurator|list<ParamConfigurator|PROTOTYPE_TYPE>EXTRA_TYPE $value
*
* @return $this
*/
public function NAME(TYPE $value): static
public function NAME(PARAM_TYPE $value): static
{
$this->_usedProperties[\'PROPERTY\'] = true;
$this->PROPERTY = $value;
return $this;
}';
$class->addMethod($node->getName(), $body, ['PROPERTY' => $property->getName(), 'TYPE' => $hasNormalizationClosures ? 'mixed' : 'ParamConfigurator|array', 'PHPDOC_TYPE' => $hasNormalizationClosures ? 'mixed' : \sprintf('ParamConfigurator|list<ParamConfigurator|%s>', '' === $parameterType ? 'mixed' : $parameterType)]);
$class->addMethod($node->getName(), $body, ['PROPERTY' => $property->getName(), 'PROTOTYPE_TYPE' => \implode('|', $prototypeParameterTypes), 'EXTRA_TYPE' => $nodeTypesWithoutArray ? '|' . \implode('|', $nodeTypesWithoutArray) : '', 'PARAM_TYPE' => \in_array('mixed', $nodeParameterTypes, \true) ? 'mixed' : 'ParamConfigurator|' . \implode('|', $nodeParameterTypes)]);
} else {
$body = '
/**
@ -220,7 +228,7 @@ public function NAME(string $VAR, TYPE $VALUE): static
return $this;
}';
$class->addMethod($methodName, $body, ['PROPERTY' => $property->getName(), 'TYPE' => $hasNormalizationClosures || '' === $parameterType ? 'mixed' : 'ParamConfigurator|' . $parameterType, 'VAR' => '' === $key ? 'key' : $key, 'VALUE' => 'value' === $key ? 'data' : 'value']);
$class->addMethod($methodName, $body, ['PROPERTY' => $property->getName(), 'TYPE' => \in_array('mixed', $prototypeParameterTypes, \true) ? 'mixed' : 'ParamConfigurator|' . \implode('|', $prototypeParameterTypes), 'VAR' => '' === $key ? 'key' : $key, 'VALUE' => 'value' === $key ? 'data' : 'value']);
}
return;
}
@ -233,14 +241,16 @@ public function NAME(string $VAR, TYPE $VALUE): static
$property = $class->addProperty($node->getName(), $this->getType($childClass->getFqcn() . '[]', $hasNormalizationClosures));
$comment = $this->getComment($node);
if ($hasNormalizationClosures) {
$comment .= \sprintf(' * @return %s|$this' . "\n ", $childClass->getFqcn());
$comment = \sprintf(" * @template TValue\n * @param TValue \$value\n%s", $comment);
$comment .= \sprintf(' * @return %s|$this' . "\n", $childClass->getFqcn());
$comment .= \sprintf(' * @psalm-return (TValue is array ? %s : static)' . "\n ", $childClass->getFqcn());
}
if ('' !== $comment) {
$comment = "/**\n{$comment}*/\n";
}
if (null === ($key = $node->getKeyAttribute())) {
$body = $hasNormalizationClosures ? '
COMMENTpublic function NAME(mixed $value = []): CLASS|static
COMMENTpublic function NAME(PARAM_TYPE $value = []): CLASS|static
{
$this->_usedProperties[\'PROPERTY\'] = true;
if (!\\is_array($value)) {
@ -257,10 +267,10 @@ COMMENTpublic function NAME(array $value = []): CLASS
return $this->PROPERTY[] = new CLASS($value);
}';
$class->addMethod($methodName, $body, ['COMMENT' => $comment, 'PROPERTY' => $property->getName(), 'CLASS' => $childClass->getFqcn()]);
$class->addMethod($methodName, $body, ['COMMENT' => $comment, 'PROPERTY' => $property->getName(), 'CLASS' => $childClass->getFqcn(), 'PARAM_TYPE' => \in_array('mixed', $nodeParameterTypes, \true) ? 'mixed' : \implode('|', $nodeParameterTypes)]);
} else {
$body = $hasNormalizationClosures ? '
COMMENTpublic function NAME(string $VAR, mixed $VALUE = []): CLASS|static
COMMENTpublic function NAME(string $VAR, PARAM_TYPE $VALUE = []): CLASS|static
{
if (!\\is_array($VALUE)) {
$this->_usedProperties[\'PROPERTY\'] = true;
@ -290,7 +300,7 @@ COMMENTpublic function NAME(string $VAR, array $VALUE = []): CLASS
return $this->PROPERTY[$VAR];
}';
$class->addUse(InvalidConfigurationException::class);
$class->addMethod($methodName, $body, ['COMMENT' => $comment, 'PROPERTY' => $property->getName(), 'CLASS' => $childClass->getFqcn(), 'VAR' => '' === $key ? 'key' : $key, 'VALUE' => 'value' === $key ? 'data' : 'value']);
$class->addMethod($methodName, \str_replace('$value', '$VAR', $body), ['COMMENT' => $comment, 'PROPERTY' => $property->getName(), 'CLASS' => $childClass->getFqcn(), 'VAR' => '' === $key ? 'key' : $key, 'VALUE' => 'value' === $key ? 'data' : 'value', 'PARAM_TYPE' => \in_array('mixed', $prototypeParameterTypes, \true) ? 'mixed' : \implode('|', $prototypeParameterTypes)]);
}
$this->buildNode($prototype, $childClass, $namespace . '\\' . $childClass->getName());
}
@ -312,29 +322,32 @@ public function NAME($value): static
}';
$class->addMethod($node->getName(), $body, ['PROPERTY' => $property->getName(), 'COMMENT' => $comment]);
}
private function getParameterType(NodeInterface $node) : ?string
private function getParameterTypes(NodeInterface $node) : array
{
$paramTypes = [];
if ($node instanceof BaseNode) {
$types = $node->getNormalizedTypes();
if (\in_array(ExprBuilder::TYPE_ANY, $types, \true)) {
$paramTypes[] = 'mixed';
}
if (\in_array(ExprBuilder::TYPE_STRING, $types, \true)) {
$paramTypes[] = 'string';
}
}
if ($node instanceof BooleanNode) {
return 'bool';
$paramTypes[] = 'bool';
} elseif ($node instanceof IntegerNode) {
$paramTypes[] = 'int';
} elseif ($node instanceof FloatNode) {
$paramTypes[] = 'float';
} elseif ($node instanceof EnumNode) {
$paramTypes[] = 'mixed';
} elseif ($node instanceof ArrayNode) {
$paramTypes[] = 'array';
} elseif ($node instanceof VariableNode) {
$paramTypes[] = 'mixed';
}
if ($node instanceof IntegerNode) {
return 'int';
}
if ($node instanceof FloatNode) {
return 'float';
}
if ($node instanceof EnumNode) {
return '';
}
if ($node instanceof PrototypedArrayNode && $node->getPrototype() instanceof ScalarNode) {
// This is just an array of variables
return 'array';
}
if ($node instanceof VariableNode) {
// mixed
return '';
}
return null;
return \array_unique($paramTypes);
}
private function getComment(BaseNode $node) : string
{
@ -354,11 +367,8 @@ public function NAME($value): static
return \var_export($a, \true);
}, $node->getValues()))) . "\n";
} else {
$parameterType = $this->getParameterType($node);
if (null === $parameterType || '' === $parameterType) {
$parameterType = 'mixed';
}
$comment .= ' * @param ParamConfigurator|' . $parameterType . ' $value' . "\n";
$parameterTypes = $this->getParameterTypes($node);
$comment .= ' * @param ParamConfigurator|' . \implode('|', $parameterTypes) . ' $value' . "\n";
}
} else {
foreach ((array) ($node->getExample() ?? []) as $example) {

View File

@ -1,6 +1,12 @@
CHANGELOG
=========
6.2
---
* Deprecate calling `NodeBuilder::setParent()` without any arguments
* Add a more accurate typehint in generated PHP config
6.1
---

View File

@ -32,9 +32,6 @@ class ConfigCacheFactory implements ConfigCacheFactoryInterface
{
$this->debug = $debug;
}
/**
* {@inheritdoc}
*/
public function cache(string $file, callable $callback) : ConfigCacheInterface
{
$cache = new ConfigCache($file, $this->debug);

View File

@ -34,8 +34,6 @@ class ArrayNode extends BaseNode implements PrototypeNodeInterface
$this->normalizeKeys = $normalizeKeys;
}
/**
* {@inheritdoc}
*
* Namely, you mostly have foo_bar in YAML while you have foo-bar in XML.
* After running this method, all keys are normalized to foo_bar.
*
@ -133,22 +131,15 @@ class ArrayNode extends BaseNode implements PrototypeNodeInterface
{
return $this->ignoreExtraKeys;
}
/**
* {@inheritdoc}
*/
public function setName(string $name)
{
$this->name = $name;
}
/**
* {@inheritdoc}
*/
public function hasDefaultValue() : bool
{
return $this->addIfNotSet;
}
/**
* {@inheritdoc}
* @return mixed
*/
public function getDefaultValue()
@ -182,8 +173,6 @@ class ArrayNode extends BaseNode implements PrototypeNodeInterface
$this->children[$name] = $node;
}
/**
* {@inheritdoc}
*
* @throws UnsetKeyException
* @throws InvalidConfigurationException if the node doesn't have enough children
* @param mixed $value
@ -225,7 +214,6 @@ class ArrayNode extends BaseNode implements PrototypeNodeInterface
return $value;
}
/**
* {@inheritdoc}
* @param mixed $value
*/
protected function validateType($value)
@ -240,8 +228,6 @@ class ArrayNode extends BaseNode implements PrototypeNodeInterface
}
}
/**
* {@inheritdoc}
*
* @throws InvalidConfigurationException
* @param mixed $value
* @return mixed
@ -307,8 +293,6 @@ class ArrayNode extends BaseNode implements PrototypeNodeInterface
return $value;
}
/**
* {@inheritdoc}
*
* @throws InvalidConfigurationException
* @throws \RuntimeException
* @param mixed $leftSide
@ -347,9 +331,6 @@ class ArrayNode extends BaseNode implements PrototypeNodeInterface
}
return $leftSide;
}
/**
* {@inheritdoc}
*/
protected function allowPlaceholders() : bool
{
return \false;

View File

@ -34,6 +34,7 @@ abstract class BaseNode implements NodeInterface
protected $name;
protected $parent;
protected $normalizationClosures = [];
protected $normalizedTypes = [];
protected $finalValidationClosures = [];
protected $allowOverwrite = \true;
protected $required = \false;
@ -201,6 +202,24 @@ abstract class BaseNode implements NodeInterface
{
$this->normalizationClosures = $closures;
}
/**
* Sets the list of types supported by normalization.
*
* see ExprBuilder::TYPE_* constants.
*/
public function setNormalizedTypes(array $types)
{
$this->normalizedTypes = $types;
}
/**
* Gets the list of types supported by normalization.
*
* see ExprBuilder::TYPE_* constants.
*/
public function getNormalizedTypes() : array
{
return $this->normalizedTypes;
}
/**
* Sets the closures used for final validation.
*
@ -210,9 +229,6 @@ abstract class BaseNode implements NodeInterface
{
$this->finalValidationClosures = $closures;
}
/**
* {@inheritdoc}
*/
public function isRequired() : bool
{
return $this->required;
@ -232,16 +248,10 @@ abstract class BaseNode implements NodeInterface
{
return ['package' => $this->deprecation['package'], 'version' => $this->deprecation['version'], 'message' => \strtr($this->deprecation['message'], ['%node%' => $node, '%path%' => $path])];
}
/**
* {@inheritdoc}
*/
public function getName() : string
{
return $this->name;
}
/**
* {@inheritdoc}
*/
public function getPath() : string
{
if (null !== $this->parent) {
@ -250,7 +260,6 @@ abstract class BaseNode implements NodeInterface
return $this->name;
}
/**
* {@inheritdoc}
* @param mixed $leftSide
* @param mixed $rightSide
* @return mixed
@ -287,7 +296,6 @@ abstract class BaseNode implements NodeInterface
return $this->mergeValues($leftSide, $rightSide);
}
/**
* {@inheritdoc}
* @param mixed $value
* @return mixed
*/
@ -338,7 +346,6 @@ abstract class BaseNode implements NodeInterface
return $this->parent;
}
/**
* {@inheritdoc}
* @param mixed $value
* @return mixed
*/

View File

@ -19,7 +19,6 @@ use RectorPrefix202212\Symfony\Component\Config\Definition\Exception\InvalidType
class BooleanNode extends ScalarNode
{
/**
* {@inheritdoc}
* @param mixed $value
*/
protected function validateType($value)
@ -34,7 +33,6 @@ class BooleanNode extends ScalarNode
}
}
/**
* {@inheritdoc}
* @param mixed $value
*/
protected function isValueEmpty($value) : bool
@ -42,9 +40,6 @@ class BooleanNode extends ScalarNode
// a boolean value cannot be empty
return \false;
}
/**
* {@inheritdoc}
*/
protected function getValidPlaceholderTypes() : array
{
return ['bool'];

View File

@ -34,25 +34,16 @@ class ArrayNodeDefinition extends NodeDefinition implements ParentNodeDefinition
protected $addDefaultChildren = \false;
protected $nodeBuilder;
protected $normalizeKeys = \true;
/**
* {@inheritdoc}
*/
public function __construct(?string $name, NodeParentInterface $parent = null)
{
parent::__construct($name, $parent);
$this->nullEquivalent = [];
$this->trueEquivalent = [];
}
/**
* {@inheritdoc}
*/
public function setBuilder(NodeBuilder $builder)
{
$this->nodeBuilder = $builder;
}
/**
* {@inheritdoc}
*/
public function children() : NodeBuilder
{
return $this->getNodeBuilder();
@ -276,7 +267,6 @@ class ArrayNodeDefinition extends NodeDefinition implements ParentNodeDefinition
return $this;
}
/**
* {@inheritdoc}
* @return $this
*/
public function append(NodeDefinition $node)
@ -289,14 +279,9 @@ class ArrayNodeDefinition extends NodeDefinition implements ParentNodeDefinition
*/
protected function getNodeBuilder() : NodeBuilder
{
if (null === $this->nodeBuilder) {
$this->nodeBuilder = new NodeBuilder();
}
$this->nodeBuilder = $this->nodeBuilder ?? new NodeBuilder();
return $this->nodeBuilder->setParent($this);
}
/**
* {@inheritdoc}
*/
protected function createNode() : NodeInterface
{
if (null === $this->prototype) {
@ -344,6 +329,7 @@ class ArrayNodeDefinition extends NodeDefinition implements ParentNodeDefinition
}
if (null !== $this->normalization) {
$node->setNormalizationClosures($this->normalization->before);
$node->setNormalizedTypes($this->normalization->declaredTypes);
$node->setXmlRemappings($this->normalization->remappings);
}
if (null !== $this->merge) {

View File

@ -19,9 +19,6 @@ use RectorPrefix202212\Symfony\Component\Config\Definition\Exception\InvalidDefi
*/
class BooleanNodeDefinition extends ScalarNodeDefinition
{
/**
* {@inheritdoc}
*/
public function __construct(?string $name, NodeParentInterface $parent = null)
{
parent::__construct($name, $parent);
@ -35,8 +32,6 @@ class BooleanNodeDefinition extends ScalarNodeDefinition
return new BooleanNode($this->name, $this->parent, $this->pathSeparator);
}
/**
* {@inheritdoc}
*
* @throws InvalidDefinitionException
* @return $this
*/

View File

@ -28,7 +28,7 @@ class EnumNodeDefinition extends ScalarNodeDefinition
public function values(array $values)
{
$values = \array_unique($values);
if (empty($values)) {
if (!$values) {
throw new \InvalidArgumentException('->values() must be called with at least one value.');
}
$this->values = $values;

View File

@ -19,7 +19,12 @@ use RectorPrefix202212\Symfony\Component\Config\Definition\Exception\UnsetKeyExc
*/
class ExprBuilder
{
public const TYPE_ANY = 'any';
public const TYPE_STRING = 'string';
public const TYPE_NULL = 'null';
public const TYPE_ARRAY = 'array';
protected $node;
public $allowedTypes;
public $ifPart;
public $thenPart;
public function __construct(NodeDefinition $node)
@ -33,9 +38,10 @@ class ExprBuilder
*/
public function always(\Closure $then = null)
{
$this->ifPart = function () {
$this->ifPart = static function () {
return \true;
};
$this->allowedTypes = self::TYPE_ANY;
if (null !== $then) {
$this->thenPart = $then;
}
@ -50,12 +56,10 @@ class ExprBuilder
*/
public function ifTrue(\Closure $closure = null)
{
if (null === $closure) {
$closure = function ($v) {
return \true === $v;
};
}
$this->ifPart = $closure;
$this->ifPart = $closure ?? static function ($v) {
return \true === $v;
};
$this->allowedTypes = self::TYPE_ANY;
return $this;
}
/**
@ -65,9 +69,8 @@ class ExprBuilder
*/
public function ifString()
{
$this->ifPart = function ($v) {
return \is_string($v);
};
$this->ifPart = \Closure::fromCallable('is_string');
$this->allowedTypes = self::TYPE_STRING;
return $this;
}
/**
@ -77,9 +80,8 @@ class ExprBuilder
*/
public function ifNull()
{
$this->ifPart = function ($v) {
return null === $v;
};
$this->ifPart = \Closure::fromCallable('is_null');
$this->allowedTypes = self::TYPE_NULL;
return $this;
}
/**
@ -89,9 +91,10 @@ class ExprBuilder
*/
public function ifEmpty()
{
$this->ifPart = function ($v) {
$this->ifPart = static function ($v) {
return empty($v);
};
$this->allowedTypes = self::TYPE_ANY;
return $this;
}
/**
@ -101,9 +104,8 @@ class ExprBuilder
*/
public function ifArray()
{
$this->ifPart = function ($v) {
return \is_array($v);
};
$this->ifPart = \Closure::fromCallable('is_array');
$this->allowedTypes = self::TYPE_ARRAY;
return $this;
}
/**
@ -113,9 +115,10 @@ class ExprBuilder
*/
public function ifInArray(array $array)
{
$this->ifPart = function ($v) use($array) {
$this->ifPart = static function ($v) use($array) {
return \in_array($v, $array, \true);
};
$this->allowedTypes = self::TYPE_ANY;
return $this;
}
/**
@ -125,9 +128,10 @@ class ExprBuilder
*/
public function ifNotInArray(array $array)
{
$this->ifPart = function ($v) use($array) {
$this->ifPart = static function ($v) use($array) {
return !\in_array($v, $array, \true);
};
$this->allowedTypes = self::TYPE_ANY;
return $this;
}
/**
@ -137,10 +141,11 @@ class ExprBuilder
*/
public function castToArray()
{
$this->ifPart = function ($v) {
$this->ifPart = static function ($v) {
return !\is_array($v);
};
$this->thenPart = function ($v) {
$this->allowedTypes = self::TYPE_ANY;
$this->thenPart = static function ($v) {
return [$v];
};
return $this;
@ -162,7 +167,7 @@ class ExprBuilder
*/
public function thenEmptyArray()
{
$this->thenPart = function () {
$this->thenPart = static function () {
return [];
};
return $this;
@ -178,7 +183,7 @@ class ExprBuilder
*/
public function thenInvalid(string $message)
{
$this->thenPart = function ($v) use($message) {
$this->thenPart = static function ($v) use($message) {
throw new \InvalidArgumentException(\sprintf($message, \json_encode($v)));
};
return $this;
@ -192,7 +197,7 @@ class ExprBuilder
*/
public function thenUnset()
{
$this->thenPart = function () {
$this->thenPart = static function () {
throw new UnsetKeyException('Unsetting key.');
};
return $this;
@ -224,7 +229,7 @@ class ExprBuilder
if ($expr instanceof self) {
$if = $expr->ifPart;
$then = $expr->thenPart;
$expressions[$k] = function ($v) use($if, $then) {
$expressions[$k] = static function ($v) use($if, $then) {
return $if($v) ? $then($v) : $v;
};
}

View File

@ -30,6 +30,9 @@ class NodeBuilder implements NodeParentInterface
*/
public function setParent(ParentNodeDefinitionInterface $parent = null)
{
if (1 > \func_num_args()) {
\RectorPrefix202212\trigger_deprecation('symfony/form', '6.2', 'Calling "%s()" without any arguments is deprecated, pass null explicitly instead.', __METHOD__);
}
$this->parent = $parent;
return $this;
}

View File

@ -97,7 +97,13 @@ abstract class NodeDefinition implements NodeParentInterface
$this->parent = null;
}
if (null !== $this->normalization) {
$allowedTypes = [];
foreach ($this->normalization->before as $expr) {
$allowedTypes[] = $expr->allowedTypes;
}
$allowedTypes = \array_unique($allowedTypes);
$this->normalization->before = ExprBuilder::buildExpressions($this->normalization->before);
$this->normalization->declaredTypes = $allowedTypes;
}
if (null !== $this->validation) {
$this->validation->rules = ExprBuilder::buildExpressions($this->validation->rules);
@ -250,30 +256,21 @@ abstract class NodeDefinition implements NodeParentInterface
*/
protected function validation() : ValidationBuilder
{
if (null === $this->validation) {
$this->validation = new ValidationBuilder($this);
}
return $this->validation;
return $this->validation = $this->validation ?? new ValidationBuilder($this);
}
/**
* Gets the builder for merging rules.
*/
protected function merge() : MergeBuilder
{
if (null === $this->merge) {
$this->merge = new MergeBuilder($this);
}
return $this->merge;
return $this->merge = $this->merge ?? new MergeBuilder($this);
}
/**
* Gets the builder for normalization rules.
*/
protected function normalization() : NormalizationBuilder
{
if (null === $this->normalization) {
$this->normalization = new NormalizationBuilder($this);
}
return $this->normalization;
return $this->normalization = $this->normalization ?? new NormalizationBuilder($this);
}
/**
* Instantiate and configure the node according to this definition.

View File

@ -19,6 +19,7 @@ class NormalizationBuilder
{
protected $node;
public $before = [];
public $declaredTypes = [];
public $remappings = [];
public function __construct(NodeDefinition $node)
{

View File

@ -53,8 +53,6 @@ abstract class NumericNodeDefinition extends ScalarNodeDefinition
return $this;
}
/**
* {@inheritdoc}
*
* @throws InvalidDefinitionException
* @return $this
*/

View File

@ -26,9 +26,6 @@ class VariableNodeDefinition extends NodeDefinition
{
return new VariableNode($this->name, $this->parent, $this->pathSeparator);
}
/**
* {@inheritdoc}
*/
protected function createNode() : NodeInterface
{
$node = $this->instantiateNode();

View File

@ -140,7 +140,7 @@ class YamlReferenceDumper
$this->writeLine('');
$message = \count($example) > 1 ? 'Examples' : 'Example';
$this->writeLine('# ' . $message . ':', $depth * 4 + 4);
$this->writeArray(\array_map([Inline::class, 'dump'], $example), $depth + 1);
$this->writeArray(\array_map(\Closure::fromCallable([Inline::class, 'dump']), $example), $depth + 1);
}
if ($children) {
foreach ($children as $childNode) {

View File

@ -25,7 +25,7 @@ class EnumNode extends ScalarNode
public function __construct(?string $name, NodeInterface $parent = null, array $values = [], string $pathSeparator = BaseNode::DEFAULT_PATH_SEPARATOR)
{
$values = \array_unique($values);
if (empty($values)) {
if (!$values) {
throw new \InvalidArgumentException('$values must contain at least one element.');
}
parent::__construct($name, $parent, $pathSeparator);
@ -36,7 +36,6 @@ class EnumNode extends ScalarNode
return $this->values;
}
/**
* {@inheritdoc}
* @param mixed $value
* @return mixed
*/

View File

@ -19,7 +19,6 @@ use RectorPrefix202212\Symfony\Component\Config\Definition\Exception\InvalidType
class FloatNode extends NumericNode
{
/**
* {@inheritdoc}
* @param mixed $value
*/
protected function validateType($value)
@ -37,9 +36,6 @@ class FloatNode extends NumericNode
throw $ex;
}
}
/**
* {@inheritdoc}
*/
protected function getValidPlaceholderTypes() : array
{
return ['float'];

View File

@ -19,7 +19,6 @@ use RectorPrefix202212\Symfony\Component\Config\Definition\Exception\InvalidType
class IntegerNode extends NumericNode
{
/**
* {@inheritdoc}
* @param mixed $value
*/
protected function validateType($value)
@ -33,9 +32,6 @@ class IntegerNode extends NumericNode
throw $ex;
}
}
/**
* {@inheritdoc}
*/
protected function getValidPlaceholderTypes() : array
{
return ['int'];

View File

@ -39,7 +39,6 @@ class DefinitionFileLoader extends FileLoader
parent::__construct($locator);
}
/**
* {@inheritdoc}
* @param mixed $resource
* @return mixed
*/
@ -61,7 +60,6 @@ class DefinitionFileLoader extends FileLoader
return null;
}
/**
* {@inheritdoc}
* @param mixed $resource
*/
public function supports($resource, string $type = null) : bool

View File

@ -31,7 +31,6 @@ class NumericNode extends ScalarNode
$this->max = $max;
}
/**
* {@inheritdoc}
* @param mixed $value
* @return mixed
*/
@ -53,7 +52,6 @@ class NumericNode extends ScalarNode
return $value;
}
/**
* {@inheritdoc}
* @param mixed $value
*/
protected function isValueEmpty($value) : bool

View File

@ -65,9 +65,7 @@ class Processor
*/
public static function normalizeConfig(array $config, string $key, string $plural = null) : array
{
if (null === $plural) {
$plural = $key . 's';
}
$plural = $plural ?? $key . 's';
if (isset($config[$plural])) {
return $config[$plural];
}

View File

@ -82,9 +82,6 @@ class PrototypedArrayNode extends ArrayNode
{
$this->defaultValue = $value;
}
/**
* {@inheritdoc}
*/
public function hasDefaultValue() : bool
{
return \true;
@ -103,8 +100,6 @@ class PrototypedArrayNode extends ArrayNode
}
}
/**
* {@inheritdoc}
*
* The default value could be either explicited or derived from the prototype
* default value.
* @return mixed
@ -145,7 +140,6 @@ class PrototypedArrayNode extends ArrayNode
throw new Exception('A prototyped array node cannot have concrete children.');
}
/**
* {@inheritdoc}
* @param mixed $value
* @return mixed
*/
@ -170,8 +164,6 @@ class PrototypedArrayNode extends ArrayNode
return $value;
}
/**
* {@inheritdoc}
*
* @throws DuplicateKeyException
* @param mixed $value
* @return mixed
@ -246,7 +238,6 @@ class PrototypedArrayNode extends ArrayNode
return $normalized;
}
/**
* {@inheritdoc}
* @param mixed $leftSide
* @param mixed $rightSide
* @return mixed

View File

@ -26,7 +26,6 @@ use RectorPrefix202212\Symfony\Component\Config\Definition\Exception\InvalidType
class ScalarNode extends VariableNode
{
/**
* {@inheritdoc}
* @param mixed $value
*/
protected function validateType($value)
@ -41,7 +40,6 @@ class ScalarNode extends VariableNode
}
}
/**
* {@inheritdoc}
* @param mixed $value
*/
protected function isValueEmpty($value) : bool
@ -53,9 +51,6 @@ class ScalarNode extends VariableNode
}
return null === $value || '' === $value;
}
/**
* {@inheritdoc}
*/
protected function getValidPlaceholderTypes() : array
{
return ['bool', 'int', 'float', 'string'];

View File

@ -32,15 +32,11 @@ class VariableNode extends BaseNode implements PrototypeNodeInterface
$this->defaultValueSet = \true;
$this->defaultValue = $value;
}
/**
* {@inheritdoc}
*/
public function hasDefaultValue() : bool
{
return $this->defaultValueSet;
}
/**
* {@inheritdoc}
* @return mixed
*/
public function getDefaultValue()
@ -57,22 +53,17 @@ class VariableNode extends BaseNode implements PrototypeNodeInterface
{
$this->allowEmptyValue = $boolean;
}
/**
* {@inheritdoc}
*/
public function setName(string $name)
{
$this->name = $name;
}
/**
* {@inheritdoc}
* @param mixed $value
*/
protected function validateType($value)
{
}
/**
* {@inheritdoc}
* @param mixed $value
* @return mixed
*/
@ -99,7 +90,6 @@ class VariableNode extends BaseNode implements PrototypeNodeInterface
return $value;
}
/**
* {@inheritdoc}
* @param mixed $value
* @return mixed
*/
@ -108,7 +98,6 @@ class VariableNode extends BaseNode implements PrototypeNodeInterface
return $value;
}
/**
* {@inheritdoc}
* @param mixed $leftSide
* @param mixed $rightSide
* @return mixed

View File

@ -18,14 +18,21 @@ namespace RectorPrefix202212\Symfony\Component\Config\Exception;
class LoaderLoadException extends \Exception
{
/**
* @param string $resource The resource that could not be imported
* @param mixed $resource The resource that could not be imported
* @param string|null $sourceResource The original resource importing the new resource
* @param int $code The error code
* @param \Throwable|null $previous A previous exception
* @param string|null $type The type of resource
*/
public function __construct(string $resource, string $sourceResource = null, int $code = 0, \Throwable $previous = null, string $type = null)
public function __construct($resource, string $sourceResource = null, int $code = 0, \Throwable $previous = null, string $type = null)
{
if (!\is_string($resource)) {
try {
$resource = \json_encode($resource, 0);
} catch (\JsonException $exception) {
$resource = \sprintf('resource of type "%s"', \get_debug_type($resource));
}
}
$message = '';
if ($previous) {
// Include the previous exception, to help the user see what might be the underlying cause

View File

@ -26,9 +26,6 @@ class FileLocator implements FileLocatorInterface
{
$this->paths = (array) $paths;
}
/**
* {@inheritdoc}
*/
public function locate(string $name, string $currentPath = null, bool $first = \true)
{
if ('' === $name) {

View File

@ -26,7 +26,6 @@ class DelegatingLoader extends Loader
$this->resolver = $resolver;
}
/**
* {@inheritdoc}
* @param mixed $resource
* @return mixed
*/
@ -38,7 +37,6 @@ class DelegatingLoader extends Loader
return $loader->load($resource, $type);
}
/**
* {@inheritdoc}
* @param mixed $resource
*/
public function supports($resource, string $type = null) : bool

View File

@ -0,0 +1,24 @@
<?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 RectorPrefix202212\Symfony\Component\Config\Loader;
/**
* A loader that can be scoped to a given filesystem directory.
*
* @author Alexander M. Turek <me@derrabus.de>
*/
interface DirectoryAwareLoaderInterface
{
/**
* @return $this
*/
public function forDirectory(string $currentDirectory);
}

View File

@ -57,8 +57,6 @@ 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
@ -125,7 +123,13 @@ abstract class FileLoader extends Loader
{
try {
$loader = $this->resolve($resource, $type);
if ($loader instanceof self && null !== $this->currentDir) {
if ($loader instanceof DirectoryAwareLoaderInterface) {
$loader = $loader->forDirectory($this->currentDir);
}
if (!$loader instanceof self) {
return $loader->load($resource, $type);
}
if (null !== $this->currentDir) {
$resource = $loader->getLocator()->locate($resource, $this->currentDir, \false);
}
$resources = \is_array($resource) ? $resource : [$resource];

View File

@ -18,7 +18,6 @@ namespace RectorPrefix202212\Symfony\Component\Config\Loader;
class GlobFileLoader extends FileLoader
{
/**
* {@inheritdoc}
* @param mixed $resource
* @return mixed
*/
@ -27,7 +26,6 @@ class GlobFileLoader extends FileLoader
return $this->import($resource);
}
/**
* {@inheritdoc}
* @param mixed $resource
*/
public function supports($resource, string $type = null) : bool

View File

@ -24,16 +24,10 @@ abstract class Loader implements LoaderInterface
{
$this->env = $env;
}
/**
* {@inheritdoc}
*/
public function getResolver() : LoaderResolverInterface
{
return $this->resolver;
}
/**
* {@inheritdoc}
*/
public function setResolver(LoaderResolverInterface $resolver)
{
$this->resolver = $resolver;

View File

@ -34,7 +34,6 @@ class LoaderResolver implements LoaderResolverInterface
}
}
/**
* {@inheritdoc}
* @return \Symfony\Component\Config\Loader\LoaderInterface|true
* @param mixed $resource
*/

View File

@ -62,8 +62,6 @@ class ClassExistenceResource implements SelfCheckingResourceInterface
return $this->resource;
}
/**
* {@inheritdoc}
*
* @throws \ReflectionException when a parent class/interface/trait is not found
*/
public function isFresh(int $timestamp) : bool
@ -102,9 +100,7 @@ class ClassExistenceResource implements SelfCheckingResourceInterface
}
}
}
if (null === $this->exists) {
$this->exists = $exists;
}
$this->exists = $this->exists ?? $exists;
return $this->exists[0] xor !$exists[0];
}
/**

View File

@ -40,9 +40,6 @@ class ComposerResource implements SelfCheckingResourceInterface
{
return __CLASS__;
}
/**
* {@inheritdoc}
*/
public function isFresh(int $timestamp) : bool
{
self::refresh();

View File

@ -54,9 +54,6 @@ class DirectoryResource implements SelfCheckingResourceInterface
{
return $this->pattern;
}
/**
* {@inheritdoc}
*/
public function isFresh(int $timestamp) : bool
{
if (!\is_dir($this->resource)) {

View File

@ -46,9 +46,6 @@ class FileExistenceResource implements SelfCheckingResourceInterface
{
return $this->resource;
}
/**
* {@inheritdoc}
*/
public function isFresh(int $timestamp) : bool
{
return \file_exists($this->resource) === $this->exists;

View File

@ -49,9 +49,6 @@ class FileResource implements SelfCheckingResourceInterface
{
return $this->resource;
}
/**
* {@inheritdoc}
*/
public function isFresh(int $timestamp) : bool
{
return \false !== ($filemtime = @\filemtime($this->resource)) && $filemtime <= $timestamp;

View File

@ -82,9 +82,6 @@ class GlobResource implements \IteratorAggregate, SelfCheckingResourceInterface
{
return 'glob.' . $this->prefix . (int) $this->recursive . $this->pattern . (int) $this->forExclusion . \implode("\x00", $this->excludedPrefixes);
}
/**
* {@inheritdoc}
*/
public function isFresh(int $timestamp) : bool
{
$hash = $this->computeHash();

View File

@ -46,9 +46,6 @@ class ReflectionClassResource implements SelfCheckingResourceInterface
$this->classReflector = $classReflector;
$this->excludedVendors = $excludedVendors;
}
/**
* {@inheritdoc}
*/
public function isFresh(int $timestamp) : bool
{
if (!isset($this->hash)) {

View File

@ -39,6 +39,6 @@ class SelfCheckingResourceChecker implements ResourceCheckerInterface
public function isFresh(ResourceInterface $resource, int $timestamp) : bool
{
$key = "{$resource}:{$timestamp}";
return self::$cache[$key] ?? (self::$cache[$key] = $resource->isFresh($timestamp));
return self::$cache[$key] = self::$cache[$key] ?? $resource->isFresh($timestamp);
}
}

View File

@ -38,9 +38,6 @@ class ResourceCheckerConfigCache implements ConfigCacheInterface
$this->file = $file;
$this->resourceCheckers = $resourceCheckers;
}
/**
* {@inheritdoc}
*/
public function getPath() : string
{
return $this->file;
@ -119,7 +116,7 @@ class ResourceCheckerConfigCache implements ConfigCacheInterface
// discard chmod failure (some filesystem may not support it)
}
}
if (\function_exists('opcache_invalidate') && \filter_var(\ini_get('opcache.enable'), \FILTER_VALIDATE_BOOLEAN)) {
if (\function_exists('opcache_invalidate') && \filter_var(\ini_get('opcache.enable'), \FILTER_VALIDATE_BOOL)) {
@\opcache_invalidate($this->file, \true);
}
}

View File

@ -29,9 +29,6 @@ class ResourceCheckerConfigCacheFactory implements ConfigCacheFactoryInterface
{
$this->resourceCheckers = $resourceCheckers;
}
/**
* {@inheritdoc}
*/
public function cache(string $file, callable $callable) : ConfigCacheInterface
{
$cache = new ResourceCheckerConfigCache($file, $this->resourceCheckers);

View File

@ -77,7 +77,7 @@ class XmlUtils
}
if (!$valid) {
$messages = static::getXmlErrors($internalErrors);
if (empty($messages)) {
if (!$messages) {
throw new InvalidXmlException('The XML is not valid.', 0, $e);
}
throw new XmlParsingException(\implode("\n", $messages), 0, $e);

View File

@ -20,6 +20,7 @@ use RectorPrefix202212\Symfony\Component\Console\Command\SignalableCommandInterf
use RectorPrefix202212\Symfony\Component\Console\CommandLoader\CommandLoaderInterface;
use RectorPrefix202212\Symfony\Component\Console\Completion\CompletionInput;
use RectorPrefix202212\Symfony\Component\Console\Completion\CompletionSuggestions;
use RectorPrefix202212\Symfony\Component\Console\Completion\Suggestion;
use RectorPrefix202212\Symfony\Component\Console\Event\ConsoleCommandEvent;
use RectorPrefix202212\Symfony\Component\Console\Event\ConsoleErrorEvent;
use RectorPrefix202212\Symfony\Component\Console\Event\ConsoleSignalEvent;
@ -31,6 +32,7 @@ use RectorPrefix202212\Symfony\Component\Console\Exception\NamespaceNotFoundExce
use RectorPrefix202212\Symfony\Component\Console\Exception\RuntimeException;
use RectorPrefix202212\Symfony\Component\Console\Formatter\OutputFormatter;
use RectorPrefix202212\Symfony\Component\Console\Helper\DebugFormatterHelper;
use RectorPrefix202212\Symfony\Component\Console\Helper\DescriptorHelper;
use RectorPrefix202212\Symfony\Component\Console\Helper\FormatterHelper;
use RectorPrefix202212\Symfony\Component\Console\Helper\Helper;
use RectorPrefix202212\Symfony\Component\Console\Helper\HelperSet;
@ -182,12 +184,8 @@ class Application implements ResetInterface
@\putenv('LINES=' . $this->terminal->getHeight());
@\putenv('COLUMNS=' . $this->terminal->getWidth());
}
if (null === $input) {
$input = new ArgvInput();
}
if (null === $output) {
$output = new ConsoleOutput();
}
$input = $input ?? new ArgvInput();
$output = $output ?? new ConsoleOutput();
$renderException = function (\Throwable $e) use($output) {
if ($output instanceof ConsoleOutputInterface) {
$this->renderThrowable($e, $output->getErrorOutput());
@ -279,7 +277,22 @@ class Application implements ResetInterface
// the command name MUST be the first element of the input
$command = $this->find($name);
} catch (\Throwable $e) {
if (!($e instanceof CommandNotFoundException && !$e instanceof NamespaceNotFoundException) || 1 !== \count($alternatives = $e->getAlternatives()) || !$input->isInteractive()) {
if ($e instanceof CommandNotFoundException && !$e instanceof NamespaceNotFoundException && 1 === \count($alternatives = $e->getAlternatives()) && $input->isInteractive()) {
$alternative = $alternatives[0];
$style = new SymfonyStyle($input, $output);
$output->writeln('');
$formattedBlock = (new FormatterHelper())->formatBlock(\sprintf('Command "%s" is not defined.', $name), 'error', \true);
$output->writeln($formattedBlock);
if (!$style->confirm(\sprintf('Do you want to run "%s" instead? ', $alternative), \false)) {
if (null !== $this->dispatcher) {
$event = new ConsoleErrorEvent($input, $output, $e);
$this->dispatcher->dispatch($event, ConsoleEvents::ERROR);
return $event->getExitCode();
}
return 1;
}
$command = $this->find($alternative);
} else {
if (null !== $this->dispatcher) {
$event = new ConsoleErrorEvent($input, $output, $e);
$this->dispatcher->dispatch($event, ConsoleEvents::ERROR);
@ -288,22 +301,16 @@ class Application implements ResetInterface
}
$e = $event->getError();
}
throw $e;
}
$alternative = $alternatives[0];
$style = new SymfonyStyle($input, $output);
$output->writeln('');
$formattedBlock = (new FormatterHelper())->formatBlock(\sprintf('Command "%s" is not defined.', $name), 'error', \true);
$output->writeln($formattedBlock);
if (!$style->confirm(\sprintf('Do you want to run "%s" instead? ', $alternative), \false)) {
if (null !== $this->dispatcher) {
$event = new ConsoleErrorEvent($input, $output, $e);
$this->dispatcher->dispatch($event, ConsoleEvents::ERROR);
return $event->getExitCode();
try {
if ($e instanceof CommandNotFoundException && ($namespace = $this->findNamespace($name))) {
$helper = new DescriptorHelper();
$helper->describe($output instanceof ConsoleOutputInterface ? $output->getErrorOutput() : $output, $this, ['format' => 'txt', 'raw_text' => \false, 'namespace' => $namespace, 'short' => \false]);
return isset($event) ? $event->getExitCode() : 1;
}
} catch (NamespaceNotFoundException $exception) {
throw $e;
}
return 1;
}
$command = $this->find($alternative);
}
if ($command instanceof LazyCommand) {
$command = $command->getCommand();
@ -313,9 +320,6 @@ class Application implements ResetInterface
$this->runningCommand = null;
return $exitCode;
}
/**
* {@inheritdoc}
*/
public function reset()
{
}
@ -353,18 +357,16 @@ class Application implements ResetInterface
public function complete(CompletionInput $input, CompletionSuggestions $suggestions) : void
{
if (CompletionInput::TYPE_ARGUMENT_VALUE === $input->getCompletionType() && 'command' === $input->getCompletionName()) {
$commandNames = [];
foreach ($this->all() as $name => $command) {
// skip hidden commands and aliased commands as they already get added below
if ($command->isHidden() || $command->getName() !== $name) {
continue;
}
$commandNames[] = $command->getName();
$suggestions->suggestValue(new Suggestion($command->getName(), $command->getDescription()));
foreach ($command->getAliases() as $name) {
$commandNames[] = $name;
$suggestions->suggestValue(new Suggestion($name, $command->getDescription()));
}
}
$suggestions->suggestValues(\array_filter($commandNames));
return;
}
if (CompletionInput::TYPE_OPTION_NAME === $input->getCompletionType()) {

View File

@ -1,13 +1,24 @@
CHANGELOG
=========
6.2
---
* Improve truecolor terminal detection in some cases
* Add support for 256 color terminals (conversion from Ansi24 to Ansi8 if terminal is capable of it)
* Deprecate calling `*Command::setApplication()`, `*FormatterStyle::setForeground/setBackground()`, `Helper::setHelpSet()`, `Input*::setDefault()`, `Question::setAutocompleterCallback/setValidator()`without any arguments
* Change the signature of `OutputFormatterStyleInterface::setForeground/setBackground()` to `setForeground/setBackground(?string)`
* Change the signature of `HelperInterface::setHelperSet()` to `setHelperSet(?HelperSet)`
6.1
---
* Add support to display table vertically when calling setVertical()
* Add method `__toString()` to `InputInterface`
* Added `OutputWrapper` to prevent truncated URL in `SymfonyStyle::createBlock`.
* Deprecate `Command::$defaultName` and `Command::$defaultDescription`, use the `AsCommand` attribute instead
* Add suggested values for arguments and options in input definition, for input completion
* Add `$resumeAt` parameter to `ProgressBar#start()`, so that one can easily 'resume' progress on longer tasks, and still get accurate `getEstimate()` and `getRemaining()` results.
6.0
---

View File

@ -86,14 +86,7 @@ final class Color
return '';
}
if ('#' === $color[0]) {
$color = \substr($color, 1);
if (3 === \strlen($color)) {
$color = $color[0] . $color[0] . $color[1] . $color[1] . $color[2] . $color[2];
}
if (6 !== \strlen($color)) {
throw new InvalidArgumentException(\sprintf('Invalid "%s" color.', $color));
}
return ($background ? '4' : '3') . $this->convertHexColorToAnsi(\hexdec($color));
return ($background ? '4' : '3') . Terminal::getColorMode()->convertFromHexToAnsiColorCode($color);
}
if (isset(self::COLORS[$color])) {
return ($background ? '4' : '3') . self::COLORS[$color];
@ -103,33 +96,4 @@ final class Color
}
throw new InvalidArgumentException(\sprintf('Invalid "%s" color; expected one of (%s).', $color, \implode(', ', \array_merge(\array_keys(self::COLORS), \array_keys(self::BRIGHT_COLORS)))));
}
private function convertHexColorToAnsi(int $color) : string
{
$r = $color >> 16 & 255;
$g = $color >> 8 & 255;
$b = $color & 255;
// see https://github.com/termstandard/colors/ for more information about true color support
if ('truecolor' !== \getenv('COLORTERM')) {
return (string) $this->degradeHexColorToAnsi($r, $g, $b);
}
return \sprintf('8;2;%d;%d;%d', $r, $g, $b);
}
private function degradeHexColorToAnsi(int $r, int $g, int $b) : int
{
if (0 === \round($this->getSaturation($r, $g, $b) / 50)) {
return 0;
}
return \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) $diff * 100 / $v;
}
}

View File

@ -18,6 +18,7 @@ use RectorPrefix202212\Symfony\Component\Console\Completion\Suggestion;
use RectorPrefix202212\Symfony\Component\Console\Exception\ExceptionInterface;
use RectorPrefix202212\Symfony\Component\Console\Exception\InvalidArgumentException;
use RectorPrefix202212\Symfony\Component\Console\Exception\LogicException;
use RectorPrefix202212\Symfony\Component\Console\Helper\HelperInterface;
use RectorPrefix202212\Symfony\Component\Console\Helper\HelperSet;
use RectorPrefix202212\Symfony\Component\Console\Input\InputArgument;
use RectorPrefix202212\Symfony\Component\Console\Input\InputDefinition;
@ -164,6 +165,9 @@ class Command
}
public function setApplication(Application $application = null)
{
if (1 > \func_num_args()) {
\RectorPrefix202212\trigger_deprecation('symfony/console', '6.2', 'Calling "%s()" without any arguments is deprecated, pass null explicitly instead.', __METHOD__);
}
$this->application = $application;
if ($application) {
$this->setHelperSet($application->getHelperSet());
@ -427,9 +431,9 @@ class Command
* @param $default The default value (for InputArgument::OPTIONAL mode only)
* @param array|\Closure(CompletionInput,CompletionSuggestions):list<string|Suggestion> $suggestedValues The values used for input completion
*
* @throws InvalidArgumentException When argument mode is not valid
*
* @return $this
*
* @throws InvalidArgumentException When argument mode is not valid
* @param mixed $default
*/
public function addArgument(string $name, int $mode = null, string $description = '', $default = null)
@ -450,9 +454,9 @@ class Command
* @param $default The default value (must be null for InputOption::VALUE_NONE)
* @param array|\Closure(CompletionInput,CompletionSuggestions):list<string|Suggestion> $suggestedValues The values used for input completion
*
* @throws InvalidArgumentException If option mode is invalid or incompatible
*
* @return $this
*
* @throws InvalidArgumentException If option mode is invalid or incompatible
* @param string|mixed[] $shortcut
* @param mixed $default
*/
@ -629,9 +633,10 @@ class Command
/**
* Gets a helper instance by name.
*
* @return HelperInterface
*
* @throws LogicException if no HelperSet is defined
* @throws InvalidArgumentException if the helper is not defined
* @return mixed
*/
public function getHelper(string $name)
{

View File

@ -16,6 +16,7 @@ use RectorPrefix202212\Symfony\Component\Console\Completion\CompletionSuggestion
use RectorPrefix202212\Symfony\Component\Console\Completion\Output\BashCompletionOutput;
use RectorPrefix202212\Symfony\Component\Console\Completion\Output\CompletionOutputInterface;
use RectorPrefix202212\Symfony\Component\Console\Completion\Output\FishCompletionOutput;
use RectorPrefix202212\Symfony\Component\Console\Completion\Output\ZshCompletionOutput;
use RectorPrefix202212\Symfony\Component\Console\Exception\CommandNotFoundException;
use RectorPrefix202212\Symfony\Component\Console\Exception\ExceptionInterface;
use RectorPrefix202212\Symfony\Component\Console\Input\InputInterface;
@ -29,6 +30,7 @@ use RectorPrefix202212\Symfony\Component\Console\Output\OutputInterface;
#[\Symfony\Component\Console\Attribute\AsCommand(name: '|_complete', description: 'Internal command to provide shell completion suggestions')]
final class CompleteCommand extends Command
{
public const COMPLETION_API_VERSION = '1';
/**
* @deprecated since Symfony 6.1
*/
@ -45,28 +47,28 @@ final class CompleteCommand extends Command
public function __construct(array $completionOutputs = [])
{
// must be set before the parent constructor, as the property value is used in configure()
$this->completionOutputs = $completionOutputs + ['bash' => BashCompletionOutput::class, 'fish' => FishCompletionOutput::class];
$this->completionOutputs = $completionOutputs + ['bash' => BashCompletionOutput::class, 'fish' => FishCompletionOutput::class, 'zsh' => ZshCompletionOutput::class];
parent::__construct();
}
protected function configure() : void
{
$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('symfony', 'S', InputOption::VALUE_REQUIRED, 'The version of the completion script');
$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)
{
$this->isDebug = \filter_var(\getenv('SYMFONY_COMPLETION_DEBUG'), \FILTER_VALIDATE_BOOLEAN);
$this->isDebug = \filter_var(\getenv('SYMFONY_COMPLETION_DEBUG'), \FILTER_VALIDATE_BOOL);
}
protected function execute(InputInterface $input, OutputInterface $output) : int
{
try {
// uncomment when a bugfix or BC break has been introduced in the shell completion scripts
// $version = $input->getOption('symfony');
// if ($version && version_compare($version, 'x.y', '>=')) {
// $message = sprintf('Completion script version is not supported ("%s" given, ">=x.y" required).', $version);
// $this->log($message);
// $output->writeln($message.' Install the Symfony completion script again by using the "completion" command.');
// return 126;
// }
// "symfony" must be kept for compat with the shell scripts generated by Symfony Console 5.4 - 6.1
$version = $input->getOption('symfony') ? '1' : $input->getOption('api-version');
if ($version && \version_compare($version, self::COMPLETION_API_VERSION, '<')) {
$message = \sprintf('Completion script version is not supported ("%s" given, ">=%s" required).', $version, self::COMPLETION_API_VERSION);
$this->log($message);
$output->writeln($message . ' Install the Symfony completion script again by using the "completion" command.');
return 126;
}
$shell = $input->getOption('shell');
if (!$shell) {
throw new \RuntimeException('The "--shell" option must be set.');

View File

@ -47,6 +47,9 @@ final class DumpCompletionCommand extends Command
case 'fish':
[$rcFile, $completionFile] = ['~/.config/fish/config.fish', "/etc/fish/completions/{$commandName}.fish"];
break;
case 'zsh':
[$rcFile, $completionFile] = ['~/.zshrc', '$fpath[1]/' . $commandName];
break;
default:
[$rcFile, $completionFile] = ['~/.bashrc', "/etc/bash_completion.d/{$commandName}"];
break;
@ -102,7 +105,7 @@ EOH
}
return self::INVALID;
}
$output->write(\str_replace(['{{ COMMAND_NAME }}', '{{ VERSION }}'], [$commandName, $this->getApplication()->getVersion()], \file_get_contents($completionFile)));
$output->write(\str_replace(['{{ COMMAND_NAME }}', '{{ VERSION }}'], [$commandName, CompleteCommand::COMPLETION_API_VERSION], \file_get_contents($completionFile)));
return self::SUCCESS;
}
private static function guessShell() : string

View File

@ -27,9 +27,6 @@ class HelpCommand extends Command
* @var \Symfony\Component\Console\Command\Command
*/
private $command;
/**
* {@inheritdoc}
*/
protected function configure()
{
$this->ignoreValidationErrors();
@ -54,9 +51,6 @@ EOF
{
$this->command = $command;
}
/**
* {@inheritdoc}
*/
protected function execute(InputInterface $input, OutputInterface $output) : int
{
$this->command = $this->command ?? $this->getApplication()->find($input->getArgument('command_name'));

View File

@ -14,6 +14,7 @@ use RectorPrefix202212\Symfony\Component\Console\Application;
use RectorPrefix202212\Symfony\Component\Console\Completion\CompletionInput;
use RectorPrefix202212\Symfony\Component\Console\Completion\CompletionSuggestions;
use RectorPrefix202212\Symfony\Component\Console\Completion\Suggestion;
use RectorPrefix202212\Symfony\Component\Console\Helper\HelperInterface;
use RectorPrefix202212\Symfony\Component\Console\Helper\HelperSet;
use RectorPrefix202212\Symfony\Component\Console\Input\InputDefinition;
use RectorPrefix202212\Symfony\Component\Console\Input\InputInterface;
@ -43,6 +44,9 @@ final class LazyCommand extends Command
}
public function setApplication(Application $application = null) : void
{
if (1 > \func_num_args()) {
\RectorPrefix202212\trigger_deprecation('symfony/console', '6.2', 'Calling "%s()" without any arguments is deprecated, pass null explicitly instead.', __METHOD__);
}
if ($this->command instanceof parent) {
$this->command->setApplication($application);
}
@ -100,8 +104,6 @@ final class LazyCommand extends Command
return $this->getCommand()->getNativeDefinition();
}
/**
* {@inheritdoc}
*
* @param array|\Closure(CompletionInput,CompletionSuggestions):list<string|Suggestion> $suggestedValues The values used for input completion
* @param mixed $default
* @return $this
@ -113,8 +115,6 @@ final class LazyCommand extends Command
return $this;
}
/**
* {@inheritdoc}
*
* @param array|\Closure(CompletionInput,CompletionSuggestions):list<string|Suggestion> $suggestedValues The values used for input completion
* @param string|mixed[] $shortcut
* @param mixed $default
@ -166,10 +166,7 @@ final class LazyCommand extends Command
{
return $this->getCommand()->getUsages();
}
/**
* @return mixed
*/
public function getHelper(string $name)
public function getHelper(string $name) : HelperInterface
{
return $this->getCommand()->getHelper($name);
}

View File

@ -23,9 +23,6 @@ use RectorPrefix202212\Symfony\Component\Console\Output\OutputInterface;
*/
class ListCommand extends Command
{
/**
* {@inheritdoc}
*/
protected function configure()
{
$this->setName('list')->setDefinition([new InputArgument('namespace', InputArgument::OPTIONAL, 'The namespace name', null, function () {
@ -51,9 +48,6 @@ It's also possible to get raw list of commands (useful for embedding command run
EOF
);
}
/**
* {@inheritdoc}
*/
protected function execute(InputInterface $input, OutputInterface $output) : int
{
$helper = new DescriptorHelper();

View File

@ -36,9 +36,6 @@ class ContainerCommandLoader implements CommandLoaderInterface
$this->container = $container;
$this->commandMap = $commandMap;
}
/**
* {@inheritdoc}
*/
public function get(string $name) : Command
{
if (!$this->has($name)) {
@ -46,16 +43,10 @@ class ContainerCommandLoader implements CommandLoaderInterface
}
return $this->container->get($this->commandMap[$name]);
}
/**
* {@inheritdoc}
*/
public function has(string $name) : bool
{
return isset($this->commandMap[$name]) && $this->container->has($this->commandMap[$name]);
}
/**
* {@inheritdoc}
*/
public function getNames() : array
{
return \array_keys($this->commandMap);

View File

@ -30,16 +30,10 @@ class FactoryCommandLoader implements CommandLoaderInterface
{
$this->factories = $factories;
}
/**
* {@inheritdoc}
*/
public function has(string $name) : bool
{
return isset($this->factories[$name]);
}
/**
* {@inheritdoc}
*/
public function get(string $name) : Command
{
if (!isset($this->factories[$name])) {
@ -48,9 +42,6 @@ class FactoryCommandLoader implements CommandLoaderInterface
$factory = $this->factories[$name];
return $factory();
}
/**
* {@inheritdoc}
*/
public function getNames() : array
{
return \array_keys($this->factories);

View File

@ -56,9 +56,6 @@ final class CompletionInput extends ArgvInput
$input->currentIndex = $currentIndex;
return $input;
}
/**
* {@inheritdoc}
*/
public function bind(InputDefinition $definition) : void
{
parent::bind($definition);

View File

@ -0,0 +1,33 @@
<?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 RectorPrefix202212\Symfony\Component\Console\Completion\Output;
use RectorPrefix202212\Symfony\Component\Console\Completion\CompletionSuggestions;
use RectorPrefix202212\Symfony\Component\Console\Output\OutputInterface;
/**
* @author Jitendra A <adhocore@gmail.com>
*/
class ZshCompletionOutput implements CompletionOutputInterface
{
public function write(CompletionSuggestions $suggestions, OutputInterface $output) : void
{
foreach ($suggestions->getValueSuggestions() as $value) {
$values[] = $value->getValue() . ($value->getDescription() ? "\t" . $value->getDescription() : '');
}
foreach ($suggestions->getOptionSuggestions() as $option) {
$values[] = '--' . $option->getName() . ($option->getDescription() ? "\t" . $option->getDescription() : '');
if ($option->isNegatable()) {
$values[] = '--no-' . $option->getName() . ($option->getDescription() ? "\t" . $option->getDescription() : '');
}
}
$output->write(\implode("\n", $values) . "\n");
}
}

View File

@ -18,17 +18,28 @@ namespace RectorPrefix202212\Symfony\Component\Console\Completion;
class Suggestion
{
/**
* @readonly
* @var string
*/
private $value;
public function __construct(string $value)
/**
* @readonly
* @var string
*/
private $description = '';
public function __construct(string $value, string $description = '')
{
$this->value = $value;
$this->description = $description;
}
public function getValue() : string
{
return $this->value;
}
public function getDescription() : string
{
return $this->description;
}
public function __toString() : string
{
return $this->getValue();

View File

@ -153,10 +153,7 @@ final class Cursor
public function getCurrentPosition() : array
{
static $isTtySupported;
if (null === $isTtySupported && \function_exists('proc_open')) {
$isTtySupported = (bool) @\proc_open('echo 1 >/dev/null', [['file', '/dev/tty', 'r'], ['file', '/dev/tty', 'w'], ['file', '/dev/tty', 'w']], $pipes);
}
if (!$isTtySupported) {
if (!($isTtySupported = $isTtySupported ?? '/' === \DIRECTORY_SEPARATOR && \stream_isatty(\STDOUT))) {
return [1, 1];
}
$sttyMode = \shell_exec('stty -g');

View File

@ -28,9 +28,6 @@ abstract class Descriptor implements DescriptorInterface
* @var OutputInterface
*/
protected $output;
/**
* {@inheritdoc}
*/
public function describe(OutputInterface $output, object $object, array $options = [])
{
$this->output = $output;

View File

@ -24,16 +24,10 @@ use RectorPrefix202212\Symfony\Component\Console\Input\InputOption;
*/
class JsonDescriptor extends Descriptor
{
/**
* {@inheritdoc}
*/
protected function describeInputArgument(InputArgument $argument, array $options = [])
{
$this->writeData($this->getInputArgumentData($argument), $options);
}
/**
* {@inheritdoc}
*/
protected function describeInputOption(InputOption $option, array $options = [])
{
$this->writeData($this->getInputOptionData($option), $options);
@ -41,23 +35,14 @@ class JsonDescriptor extends Descriptor
$this->writeData($this->getInputOptionData($option, \true), $options);
}
}
/**
* {@inheritdoc}
*/
protected function describeInputDefinition(InputDefinition $definition, array $options = [])
{
$this->writeData($this->getInputDefinitionData($definition), $options);
}
/**
* {@inheritdoc}
*/
protected function describeCommand(Command $command, array $options = [])
{
$this->writeData($this->getCommandData($command, $options['short'] ?? \false), $options);
}
/**
* {@inheritdoc}
*/
protected function describeApplication(Application $application, array $options = [])
{
$describedNamespace = $options['namespace'] ?? null;

View File

@ -26,9 +26,6 @@ use RectorPrefix202212\Symfony\Component\Console\Output\OutputInterface;
*/
class MarkdownDescriptor extends Descriptor
{
/**
* {@inheritdoc}
*/
public function describe(OutputInterface $output, object $object, array $options = [])
{
$decorated = $output->isDecorated();
@ -36,23 +33,14 @@ class MarkdownDescriptor extends Descriptor
parent::describe($output, $object, $options);
$output->setDecorated($decorated);
}
/**
* {@inheritdoc}
*/
protected function write(string $content, bool $decorated = \true)
{
parent::write($content, $decorated);
}
/**
* {@inheritdoc}
*/
protected function describeInputArgument(InputArgument $argument, array $options = [])
{
$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)) . '`');
}
/**
* {@inheritdoc}
*/
protected function describeInputOption(InputOption $option, array $options = [])
{
$name = '--' . $option->getName();
@ -64,9 +52,6 @@ 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)) . '`');
}
/**
* {@inheritdoc}
*/
protected function describeInputDefinition(InputDefinition $definition, array $options = [])
{
if ($showArguments = \count($definition->getArguments()) > 0) {
@ -91,9 +76,6 @@ class MarkdownDescriptor extends Descriptor
}
}
}
/**
* {@inheritdoc}
*/
protected function describeCommand(Command $command, array $options = [])
{
if ($options['short'] ?? \false) {
@ -116,9 +98,6 @@ class MarkdownDescriptor extends Descriptor
$this->describeInputDefinition($definition);
}
}
/**
* {@inheritdoc}
*/
protected function describeApplication(Application $application, array $options = [])
{
$describedNamespace = $options['namespace'] ?? null;

View File

@ -26,9 +26,6 @@ use RectorPrefix202212\Symfony\Component\Console\Input\InputOption;
*/
class TextDescriptor extends Descriptor
{
/**
* {@inheritdoc}
*/
protected function describeInputArgument(InputArgument $argument, array $options = [])
{
if (null !== $argument->getDefault() && (!\is_array($argument->getDefault()) || \count($argument->getDefault()))) {
@ -47,9 +44,6 @@ class TextDescriptor extends Descriptor
$default
), $options);
}
/**
* {@inheritdoc}
*/
protected function describeInputOption(InputOption $option, array $options = [])
{
if ($option->acceptValue() && null !== $option->getDefault() && (!\is_array($option->getDefault()) || \count($option->getDefault()))) {
@ -77,9 +71,6 @@ class TextDescriptor extends Descriptor
$option->isArray() ? '<comment> (multiple values allowed)</comment>' : ''
), $options);
}
/**
* {@inheritdoc}
*/
protected function describeInputDefinition(InputDefinition $definition, array $options = [])
{
$totalWidth = $this->calculateTotalWidthForOptions($definition->getOptions());
@ -114,9 +105,6 @@ class TextDescriptor extends Descriptor
}
}
}
/**
* {@inheritdoc}
*/
protected function describeCommand(Command $command, array $options = [])
{
$command->mergeApplicationDefinition(\false);
@ -147,9 +135,6 @@ class TextDescriptor extends Descriptor
$this->writeText("\n");
}
}
/**
* {@inheritdoc}
*/
protected function describeApplication(Application $application, array $options = [])
{
$describedNamespace = $options['namespace'] ?? null;
@ -209,9 +194,6 @@ class TextDescriptor extends Descriptor
$this->writeText("\n");
}
}
/**
* {@inheritdoc}
*/
private function writeText(string $content, array $options = [])
{
$this->write(isset($options['raw_text']) && $options['raw_text'] ? \strip_tags($content) : $content, isset($options['raw_output']) ? !$options['raw_output'] : \true);

View File

@ -95,37 +95,22 @@ class XmlDescriptor extends Descriptor
}
return $dom;
}
/**
* {@inheritdoc}
*/
protected function describeInputArgument(InputArgument $argument, array $options = [])
{
$this->writeDocument($this->getInputArgumentDocument($argument));
}
/**
* {@inheritdoc}
*/
protected function describeInputOption(InputOption $option, array $options = [])
{
$this->writeDocument($this->getInputOptionDocument($option));
}
/**
* {@inheritdoc}
*/
protected function describeInputDefinition(InputDefinition $definition, array $options = [])
{
$this->writeDocument($this->getInputDefinitionDocument($definition));
}
/**
* {@inheritdoc}
*/
protected function describeCommand(Command $command, array $options = [])
{
$this->writeDocument($this->getCommandDocument($command, $options['short'] ?? \false));
}
/**
* {@inheritdoc}
*/
protected function describeApplication(Application $application, array $options = [])
{
$this->writeDocument($this->getApplicationDocument($application, $options['namespace'] ?? null, $options['short'] ?? \false));

View File

@ -19,45 +19,27 @@ final class NullOutputFormatter implements OutputFormatterInterface
* @var \Symfony\Component\Console\Formatter\NullOutputFormatterStyle
*/
private $style;
/**
* {@inheritdoc}
*/
public function format(?string $message) : ?string
{
return null;
}
/**
* {@inheritdoc}
*/
public function getStyle(string $name) : OutputFormatterStyleInterface
{
// to comply with the interface we must return a OutputFormatterStyleInterface
return $this->style = $this->style ?? new NullOutputFormatterStyle();
}
/**
* {@inheritdoc}
*/
public function hasStyle(string $name) : bool
{
return \false;
}
/**
* {@inheritdoc}
*/
public function isDecorated() : bool
{
return \false;
}
/**
* {@inheritdoc}
*/
public function setDecorated(bool $decorated) : void
{
// do nothing
}
/**
* {@inheritdoc}
*/
public function setStyle(string $name, OutputFormatterStyleInterface $style) : void
{
// do nothing

View File

@ -15,44 +15,32 @@ namespace RectorPrefix202212\Symfony\Component\Console\Formatter;
*/
final class NullOutputFormatterStyle implements OutputFormatterStyleInterface
{
/**
* {@inheritdoc}
*/
public function apply(string $text) : string
{
return $text;
}
/**
* {@inheritdoc}
*/
public function setBackground(string $color = null) : void
{
if (1 > \func_num_args()) {
\RectorPrefix202212\trigger_deprecation('symfony/console', '6.2', 'Calling "%s()" without any arguments is deprecated, pass null explicitly instead.', __METHOD__);
}
// do nothing
}
/**
* {@inheritdoc}
*/
public function setForeground(string $color = null) : void
{
if (1 > \func_num_args()) {
\RectorPrefix202212\trigger_deprecation('symfony/console', '6.2', 'Calling "%s()" without any arguments is deprecated, pass null explicitly instead.', __METHOD__);
}
// do nothing
}
/**
* {@inheritdoc}
*/
public function setOption(string $option) : void
{
// do nothing
}
/**
* {@inheritdoc}
*/
public function setOptions(array $options) : void
{
// do nothing
}
/**
* {@inheritdoc}
*/
public function unsetOption(string $option) : void
{
// do nothing

View File

@ -78,37 +78,22 @@ class OutputFormatter implements WrappableOutputFormatterInterface
}
$this->styleStack = new OutputFormatterStyleStack();
}
/**
* {@inheritdoc}
*/
public function setDecorated(bool $decorated)
{
$this->decorated = $decorated;
}
/**
* {@inheritdoc}
*/
public function isDecorated() : bool
{
return $this->decorated;
}
/**
* {@inheritdoc}
*/
public function setStyle(string $name, OutputFormatterStyleInterface $style)
{
$this->styles[\strtolower($name)] = $style;
}
/**
* {@inheritdoc}
*/
public function hasStyle(string $name) : bool
{
return isset($this->styles[\strtolower($name)]);
}
/**
* {@inheritdoc}
*/
public function getStyle(string $name) : OutputFormatterStyleInterface
{
if (!$this->hasStyle($name)) {
@ -116,16 +101,10 @@ class OutputFormatter implements WrappableOutputFormatterInterface
}
return $this->styles[\strtolower($name)];
}
/**
* {@inheritdoc}
*/
public function format(?string $message) : ?string
{
return $this->formatAndWrap($message, 0);
}
/**
* {@inheritdoc}
*/
public function formatAndWrap(?string $message, int $width)
{
if (null === $message) {
@ -147,7 +126,7 @@ class OutputFormatter implements WrappableOutputFormatterInterface
$output .= $this->applyCurrentStyle(\substr($message, $offset, $pos - $offset), $output, $width, $currentLineLength);
$offset = $pos + \strlen($text);
// opening tag?
if ($open = '/' != $text[1]) {
if ($open = '/' !== $text[1]) {
$tag = $matches[1][$i][0];
} else {
$tag = $matches[3][$i][0] ?? '';

View File

@ -52,35 +52,29 @@ class OutputFormatterStyle implements OutputFormatterStyleInterface
{
$this->color = new Color($this->foreground = $foreground ?: '', $this->background = $background ?: '', $this->options = $options);
}
/**
* {@inheritdoc}
*/
public function setForeground(string $color = null)
{
if (1 > \func_num_args()) {
\RectorPrefix202212\trigger_deprecation('symfony/console', '6.2', 'Calling "%s()" without any arguments is deprecated, pass null explicitly instead.', __METHOD__);
}
$this->color = new Color($this->foreground = $color ?: '', $this->background, $this->options);
}
/**
* {@inheritdoc}
*/
public function setBackground(string $color = null)
{
if (1 > \func_num_args()) {
\RectorPrefix202212\trigger_deprecation('symfony/console', '6.2', 'Calling "%s()" without any arguments is deprecated, pass null explicitly instead.', __METHOD__);
}
$this->color = new Color($this->foreground, $this->background = $color ?: '', $this->options);
}
public function setHref(string $url) : void
{
$this->href = $url;
}
/**
* {@inheritdoc}
*/
public function setOption(string $option)
{
$this->options[] = $option;
$this->color = new Color($this->foreground, $this->background, $this->options);
}
/**
* {@inheritdoc}
*/
public function unsetOption(string $option)
{
$pos = \array_search($option, $this->options);
@ -89,16 +83,10 @@ class OutputFormatterStyle implements OutputFormatterStyleInterface
}
$this->color = new Color($this->foreground, $this->background, $this->options);
}
/**
* {@inheritdoc}
*/
public function setOptions(array $options)
{
$this->color = new Color($this->foreground, $this->background, $this->options = $options);
}
/**
* {@inheritdoc}
*/
public function apply(string $text) : string
{
$this->handlesHrefGracefully = $this->handlesHrefGracefully ?? 'JetBrains-JediTerm' !== \getenv('TERMINAL_EMULATOR') && (!\getenv('KONSOLE_VERSION') || (int) \getenv('KONSOLE_VERSION') > 201100);

View File

@ -20,11 +20,11 @@ interface OutputFormatterStyleInterface
/**
* Sets style foreground color.
*/
public function setForeground(string $color = null);
public function setForeground(?string $color);
/**
* Sets style background color.
*/
public function setBackground(string $color = null);
public function setBackground(?string $color);
/**
* Sets some specific style option.
*/

View File

@ -51,7 +51,7 @@ class OutputFormatterStyleStack implements ResetInterface
*/
public function pop(OutputFormatterStyleInterface $style = null) : OutputFormatterStyleInterface
{
if (empty($this->styles)) {
if (!$this->styles) {
return $this->emptyStyle;
}
if (null === $style) {
@ -70,7 +70,7 @@ class OutputFormatterStyleStack implements ResetInterface
*/
public function getCurrent() : OutputFormatterStyleInterface
{
if (empty($this->styles)) {
if (!$this->styles) {
return $this->emptyStyle;
}
return $this->styles[\count($this->styles) - 1];

View File

@ -82,9 +82,6 @@ class DebugFormatterHelper extends Helper
{
return \sprintf('<bg=%s> </>', self::COLORS[$this->started[$id]['border']]);
}
/**
* {@inheritdoc}
*/
public function getName() : string
{
return 'debug_formatter';

View File

@ -60,9 +60,6 @@ class DescriptorHelper extends Helper
$this->descriptors[$format] = $descriptor;
return $this;
}
/**
* {@inheritdoc}
*/
public function getName() : string
{
return 'descriptor';

View File

@ -64,9 +64,6 @@ class FormatterHelper extends Helper
}
return self::substr($message, 0, $length) . $suffix;
}
/**
* {@inheritdoc}
*/
public function getName() : string
{
return 'formatter';

View File

@ -20,16 +20,13 @@ use RectorPrefix202212\Symfony\Component\String\UnicodeString;
abstract class Helper implements HelperInterface
{
protected $helperSet = null;
/**
* {@inheritdoc}
*/
public function setHelperSet(HelperSet $helperSet = null)
{
if (1 > \func_num_args()) {
\RectorPrefix202212\trigger_deprecation('symfony/console', '6.2', 'Calling "%s()" without any arguments is deprecated, pass null explicitly instead.', __METHOD__);
}
$this->helperSet = $helperSet;
}
/**
* {@inheritdoc}
*/
public function getHelperSet() : ?HelperSet
{
return $this->helperSet;

View File

@ -20,7 +20,7 @@ interface HelperInterface
/**
* Sets the helper set associated with this helper.
*/
public function setHelperSet(HelperSet $helperSet = null);
public function setHelperSet(?HelperSet $helperSet);
/**
* Gets the helper set associated with this helper.
*/

View File

@ -16,14 +16,14 @@ use RectorPrefix202212\Symfony\Component\Console\Exception\InvalidArgumentExcept
*
* @author Fabien Potencier <fabien@symfony.com>
*
* @implements \IteratorAggregate<string, Helper>
* @implements \IteratorAggregate<string, HelperInterface>
*/
class HelperSet implements \IteratorAggregate
{
/** @var array<string, Helper> */
/** @var array<string, HelperInterface> */
private $helpers = [];
/**
* @param Helper[] $helpers An array of helper
* @param HelperInterface[] $helpers
*/
public function __construct(array $helpers = [])
{

View File

@ -20,9 +20,6 @@ use RectorPrefix202212\Symfony\Component\Console\Input\InputInterface;
abstract class InputAwareHelper extends Helper implements InputAwareInterface
{
protected $input;
/**
* {@inheritdoc}
*/
public function setInput(InputInterface $input)
{
$this->input = $input;

View File

@ -0,0 +1,75 @@
<?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 RectorPrefix202212\Symfony\Component\Console\Helper;
/**
* Simple output wrapper for "tagged outputs" instead of wordwrap(). This solution is based on a StackOverflow
* answer: https://stackoverflow.com/a/20434776/1476819 from user557597 (alias SLN).
*
* (?:
* # -- Words/Characters
* ( # (1 start)
* (?> # Atomic Group - Match words with valid breaks
* .{1,16} # 1-N characters
* # Followed by one of 4 prioritized, non-linebreak whitespace
* (?: # break types:
* (?<= [^\S\r\n] ) # 1. - Behind a non-linebreak whitespace
* [^\S\r\n]? # ( optionally accept an extra non-linebreak whitespace )
* | (?= \r? \n ) # 2. - Ahead a linebreak
* | $ # 3. - EOS
* | [^\S\r\n] # 4. - Accept an extra non-linebreak whitespace
* )
* ) # End atomic group
* |
* .{1,16} # No valid word breaks, just break on the N'th character
* ) # (1 end)
* (?: \r? \n )? # Optional linebreak after Words/Characters
* |
* # -- Or, Linebreak
* (?: \r? \n | $ ) # Stand alone linebreak or at EOS
* )
*
* @author Krisztián Ferenczi <ferenczi.krisztian@gmail.com>
*
* @see https://stackoverflow.com/a/20434776/1476819
*/
final class OutputWrapper
{
private const TAG_OPEN_REGEX_SEGMENT = '[a-z](?:[^\\\\<>]*+ | \\\\.)*';
private const TAG_CLOSE_REGEX_SEGMENT = '[a-z][^<>]*+';
private const URL_PATTERN = 'https?://\\S+';
/**
* @var bool
*/
private $allowCutUrls = \false;
public function __construct(bool $allowCutUrls = \false)
{
$this->allowCutUrls = $allowCutUrls;
}
public function wrap(string $text, int $width, string $break = "\n") : string
{
if (!$width) {
return $text;
}
$tagPattern = \sprintf('<(?:(?:%s)|/(?:%s)?)>', self::TAG_OPEN_REGEX_SEGMENT, self::TAG_CLOSE_REGEX_SEGMENT);
$limitPattern = "{1,{$width}}";
$patternBlocks = [$tagPattern];
if (!$this->allowCutUrls) {
$patternBlocks[] = self::URL_PATTERN;
}
$patternBlocks[] = '.';
$blocks = \implode('|', $patternBlocks);
$rowPattern = "(?:{$blocks}){$limitPattern}";
$pattern = \sprintf('#(?:((?>(%1$s)((?<=[^\\S\\r\\n])[^\\S\\r\\n]?|(?=\\r?\\n)|$|[^\\S\\r\\n]))|(%1$s))(?:\\r?\\n)?|(?:\\r?\\n|$))#imux', $rowPattern);
$output = \rtrim(\preg_replace($pattern, '\\1' . $break, $text), $break);
return \str_replace(' ' . $break, $break, $output);
}
}

View File

@ -109,9 +109,6 @@ class ProcessHelper extends Helper
{
return \str_replace('<', '\\<', $str);
}
/**
* {@inheritdoc}
*/
public function getName() : string
{
return 'process';

View File

@ -84,6 +84,10 @@ final class ProgressBar
* @var int
*/
private $step = 0;
/**
* @var int
*/
private $startingStep = 0;
/**
* @var int|null
*/
@ -246,17 +250,17 @@ final class ProgressBar
}
public function getEstimated() : float
{
if (!$this->step) {
if (0 === $this->step || $this->step === $this->startingStep) {
return 0;
}
return \round((\time() - $this->startTime) / $this->step * $this->max);
return \round((\time() - $this->startTime) / ($this->step - $this->startingStep) * $this->max);
}
public function getRemaining() : float
{
if (!$this->step) {
return 0;
}
return \round((\time() - $this->startTime) / $this->step * ($this->max - $this->step));
return \round((\time() - $this->startTime) / ($this->step - $this->startingStep) * ($this->max - $this->step));
}
public function setBarWidth(int $size)
{
@ -329,13 +333,15 @@ final class ProgressBar
/**
* Starts the progress output.
*
* @param int|null $max Number of steps to complete the bar (0 if indeterminate), null to leave unchanged
* @param int|null $max Number of steps to complete the bar (0 if indeterminate), null to leave unchanged
* @param int $startAt The starting point of the bar (useful e.g. when resuming a previously started bar)
*/
public function start(int $max = null)
public function start(int $max = null, int $startAt = 0) : void
{
$this->startTime = \time();
$this->step = 0;
$this->percent = 0.0;
$this->step = $startAt;
$this->startingStep = $startAt;
$startAt > 0 ? $this->setProgress($startAt) : ($this->percent = 0.0);
if (null !== $max) {
$this->setMaxSteps($max);
}

View File

@ -66,12 +66,8 @@ class ProgressIndicator
public function __construct(OutputInterface $output, string $format = null, int $indicatorChangeInterval = 100, array $indicatorValues = null)
{
$this->output = $output;
if (null === $format) {
$format = $this->determineBestFormat();
}
if (null === $indicatorValues) {
$indicatorValues = ['-', '\\', '|', '/'];
}
$format = $format ?? $this->determineBestFormat();
$indicatorValues = $indicatorValues ?? ['-', '\\', '|', '/'];
$indicatorValues = \array_values($indicatorValues);
if (2 > \count($indicatorValues)) {
throw new InvalidArgumentException('Must have at least 2 indicator value characters.');

View File

@ -77,9 +77,6 @@ class QuestionHelper extends Helper
return $fallbackOutput;
}
}
/**
* {@inheritdoc}
*/
public function getName() : string
{
return 'question';
@ -128,6 +125,8 @@ class QuestionHelper extends Helper
$ret = $question->isTrimmable() ? \trim($autocomplete) : $autocomplete;
}
if ($output instanceof ConsoleSectionOutput) {
$output->addContent('');
// add EOL to the question
$output->addContent($ret);
}
$ret = \strlen($ret) > 0 ? $ret : $question->getDefault();
@ -361,6 +360,10 @@ class QuestionHelper extends Helper
throw new RuntimeException('Unable to hide the response.');
}
$value = \fgets($inputStream, 4096);
if (4095 === \strlen($value)) {
$errOutput = $output instanceof ConsoleOutputInterface ? $output->getErrorOutput() : $output;
$errOutput->warning('The value was possibly truncated by your shell or terminal emulator');
}
if (self::$stty && Terminal::hasSttyAvailable()) {
\shell_exec('stty ' . $sttyMode);
}

View File

@ -23,9 +23,6 @@ use RectorPrefix202212\Symfony\Component\Console\Style\SymfonyStyle;
*/
class SymfonyQuestionHelper extends QuestionHelper
{
/**
* {@inheritdoc}
*/
protected function writePrompt(OutputInterface $output, Question $question)
{
$text = OutputFormatter::escapeTrailingBackslash($question->getQuestion());
@ -63,9 +60,6 @@ class SymfonyQuestionHelper extends QuestionHelper
}
$output->write($prompt);
}
/**
* {@inheritdoc}
*/
protected function writeError(OutputInterface $output, \Exception $error)
{
if ($output instanceof SymfonyStyle) {

View File

@ -201,12 +201,15 @@ class Table
public function setHeaders(array $headers)
{
$headers = \array_values($headers);
if (!empty($headers) && !\is_array($headers[0])) {
if ($headers && !\is_array($headers[0])) {
$headers = [$headers];
}
$this->headers = $headers;
return $this;
}
/**
* @return $this
*/
public function setRows(array $rows)
{
$this->rows = [];
@ -563,7 +566,7 @@ class Table
if (\strpos($cell ?? '', "\n") === \false) {
continue;
}
$escaped = \implode("\n", \array_map([OutputFormatter::class, 'escapeTrailingBackslash'], \explode("\n", $cell)));
$escaped = \implode("\n", \array_map(\Closure::fromCallable([OutputFormatter::class, 'escapeTrailingBackslash']), \explode("\n", $cell)));
$cell = $cell instanceof TableCell ? new TableCell($escaped, ['colspan' => $cell->getColspan()]) : $escaped;
$lines = \explode("\n", \str_replace("\n", "<fg=default;bg=default></>\n", $cell));
foreach ($lines as $lineKey => $line) {

View File

@ -58,9 +58,6 @@ class ArgvInput extends Input
{
$this->tokens = $tokens;
}
/**
* {@inheritdoc}
*/
protected function parse()
{
$parseOptions = \true;
@ -237,9 +234,6 @@ class ArgvInput extends Input
$this->options[$name] = $value;
}
}
/**
* {@inheritdoc}
*/
public function getFirstArgument() : ?string
{
$isOption = \false;
@ -267,7 +261,6 @@ class ArgvInput extends Input
return null;
}
/**
* {@inheritdoc}
* @param string|mixed[] $values
*/
public function hasParameterOption($values, bool $onlyParams = \false) : bool
@ -290,7 +283,6 @@ class ArgvInput extends Input
return \false;
}
/**
* {@inheritdoc}
* @param string|mixed[] $values
* @param string|bool|int|float|mixed[]|null $default
* @return mixed

Some files were not shown because too many files have changed in this diff Show More