updated-packages

This commit is contained in:
RafficMohammed
2023-01-08 00:13:22 +05:30
parent 3ff7df7487
commit da241bacb6
12659 changed files with 563377 additions and 510538 deletions

View File

@@ -37,17 +37,17 @@ class Command
private $application;
private $name;
private $processTitle;
private $aliases = array();
private $aliases = [];
private $definition;
private $hidden = false;
private $help;
private $description;
private $help = '';
private $description = '';
private $ignoreValidationErrors = false;
private $applicationDefinitionMerged = false;
private $applicationDefinitionMergedWithArgs = false;
private $code;
private $synopsis = array();
private $usages = array();
private $synopsis = [];
private $usages = [];
private $helperSet;
/**
@@ -55,7 +55,7 @@ class Command
*/
public static function getDefaultName()
{
$class = \get_called_class();
$class = static::class;
$r = new \ReflectionProperty($class, 'defaultName');
return $class === $r->class ? static::$defaultName : null;
@@ -105,7 +105,7 @@ class Command
/**
* Gets the helper set.
*
* @return HelperSet A HelperSet instance
* @return HelperSet|null A HelperSet instance
*/
public function getHelperSet()
{
@@ -115,7 +115,7 @@ class Command
/**
* Gets the application instance for this command.
*
* @return Application An Application instance
* @return Application|null An Application instance
*/
public function getApplication()
{
@@ -150,7 +150,7 @@ class Command
* execute() method, you set the code to execute by passing
* a Closure to the setCode() method.
*
* @return int|null null or 0 if everything went fine, or an error code
* @return int 0 if everything went fine, or an exit code
*
* @throws LogicException When this abstract method is not implemented
*
@@ -195,7 +195,7 @@ class Command
*
* @return int The command exit code
*
* @throws \Exception When binding input fails. Bypass this by calling {@link ignoreValidationErrors()}.
* @throws ExceptionInterface When input binding fails. Bypass this by calling {@link ignoreValidationErrors()}.
*
* @see setCode()
* @see execute()
@@ -223,7 +223,7 @@ class Command
if (null !== $this->processTitle) {
if (\function_exists('cli_set_process_title')) {
if (!@cli_set_process_title($this->processTitle)) {
if ('Darwin' === PHP_OS) {
if ('Darwin' === \PHP_OS) {
$output->writeln('<comment>Running "cli_set_process_title" as an unprivileged user is not supported on MacOS.</comment>', OutputInterface::VERBOSITY_VERY_VERBOSE);
} else {
cli_set_process_title($this->processTitle);
@@ -250,9 +250,13 @@ class Command
$input->validate();
if ($this->code) {
$statusCode = \call_user_func($this->code, $input, $output);
$statusCode = ($this->code)($input, $output);
} else {
$statusCode = $this->execute($input, $output);
if (!\is_int($statusCode)) {
@trigger_error(sprintf('Return value of "%s::execute()" should always be of the type int since Symfony 4.4, %s returned.', static::class, \gettype($statusCode)), \E_USER_DEPRECATED);
}
}
return is_numeric($statusCode) ? (int) $statusCode : 0;
@@ -277,7 +281,14 @@ class Command
if ($code instanceof \Closure) {
$r = new \ReflectionFunction($code);
if (null === $r->getClosureThis()) {
$code = \Closure::bind($code, $this);
set_error_handler(static function () {});
try {
if ($c = \Closure::bind($code, $this)) {
$code = $c;
}
} finally {
restore_error_handler();
}
}
}
@@ -339,6 +350,10 @@ class Command
*/
public function getDefinition()
{
if (null === $this->definition) {
throw new LogicException(sprintf('Command class "%s" is not correctly initialized. You probably forgot to call the parent constructor.', static::class));
}
return $this->definition;
}
@@ -360,10 +375,10 @@ class Command
/**
* Adds an argument.
*
* @param string $name The argument name
* @param int|null $mode The argument mode: self::REQUIRED or self::OPTIONAL
* @param string $description A description text
* @param string|string[]|null $default The default value (for self::OPTIONAL mode only)
* @param string $name The argument name
* @param int|null $mode The argument mode: InputArgument::REQUIRED or InputArgument::OPTIONAL
* @param string $description A description text
* @param mixed $default The default value (for InputArgument::OPTIONAL mode only)
*
* @throws InvalidArgumentException When argument mode is not valid
*
@@ -379,11 +394,11 @@ class Command
/**
* Adds an option.
*
* @param string $name The option name
* @param string|array $shortcut The shortcuts, can be null, a string of shortcuts delimited by | or an array of shortcuts
* @param int|null $mode The option mode: One of the VALUE_* constants
* @param string $description A description text
* @param string|string[]|int|bool|null $default The default value (must be null for self::VALUE_NONE)
* @param string $name The option name
* @param string|array|null $shortcut The shortcuts, can be null, a string of shortcuts delimited by | or an array of shortcuts
* @param int|null $mode The option mode: One of the InputOption::VALUE_* constants
* @param string $description A description text
* @param mixed $default The default value (must be null for InputOption::VALUE_NONE)
*
* @throws InvalidArgumentException If option mode is invalid or incompatible
*
@@ -425,8 +440,6 @@ class Command
* This feature should be used only when creating a long process command,
* like a daemon.
*
* PHP 5.5+ or the proctitle PECL library is required
*
* @param string $title The process title
*
* @return $this
@@ -441,7 +454,7 @@ class Command
/**
* Returns the command name.
*
* @return string The command name
* @return string|null
*/
public function getName()
{
@@ -451,7 +464,7 @@ class Command
/**
* @param bool $hidden Whether or not the command should be hidden from the list of commands
*
* @return Command The current instance
* @return $this
*/
public function setHidden($hidden)
{
@@ -525,15 +538,16 @@ class Command
public function getProcessedHelp()
{
$name = $this->name;
$isSingleCommand = $this->application && $this->application->isSingleCommand();
$placeholders = array(
$placeholders = [
'%command.name%',
'%command.full_name%',
);
$replacements = array(
];
$replacements = [
$name,
$_SERVER['PHP_SELF'].' '.$name,
);
$isSingleCommand ? $_SERVER['PHP_SELF'] : $_SERVER['PHP_SELF'].' '.$name,
];
return str_replace($placeholders, $replacements, $this->getHelp() ?: $this->getDescription());
}
@@ -550,7 +564,7 @@ class Command
public function setAliases($aliases)
{
if (!\is_array($aliases) && !$aliases instanceof \Traversable) {
throw new InvalidArgumentException('$aliases must be an array or an instance of \Traversable');
throw new InvalidArgumentException('$aliases must be an array or an instance of \Traversable.');
}
foreach ($aliases as $alias) {
@@ -599,7 +613,7 @@ class Command
*/
public function addUsage($usage)
{
if (0 !== strpos($usage, $this->name)) {
if (!str_starts_with($usage, $this->name)) {
$usage = sprintf('%s %s', $this->name, $usage);
}

View File

@@ -35,12 +35,12 @@ class HelpCommand extends Command
$this
->setName('help')
->setDefinition(array(
->setDefinition([
new InputArgument('command_name', InputArgument::OPTIONAL, 'The command name', 'help'),
new InputOption('format', null, InputOption::VALUE_REQUIRED, 'The output format (txt, xml, json, or md)', 'txt'),
new InputOption('raw', null, InputOption::VALUE_NONE, 'To output raw command help'),
))
->setDescription('Displays help for a command')
])
->setDescription('Display help for a command')
->setHelp(<<<'EOF'
The <info>%command.name%</info> command displays help for a given command:
@@ -71,11 +71,13 @@ EOF
}
$helper = new DescriptorHelper();
$helper->describe($output, $this->command, array(
$helper->describe($output, $this->command, [
'format' => $input->getOption('format'),
'raw_text' => $input->getOption('raw'),
));
]);
$this->command = null;
return 0;
}
}

View File

@@ -33,7 +33,7 @@ class ListCommand extends Command
$this
->setName('list')
->setDefinition($this->createDefinition())
->setDescription('Lists commands')
->setDescription('List commands')
->setHelp(<<<'EOF'
The <info>%command.name%</info> command lists all commands:
@@ -69,22 +69,21 @@ EOF
protected function execute(InputInterface $input, OutputInterface $output)
{
$helper = new DescriptorHelper();
$helper->describe($output, $this->getApplication(), array(
$helper->describe($output, $this->getApplication(), [
'format' => $input->getOption('format'),
'raw_text' => $input->getOption('raw'),
'namespace' => $input->getArgument('namespace'),
));
]);
return 0;
}
/**
* {@inheritdoc}
*/
private function createDefinition()
private function createDefinition(): InputDefinition
{
return new InputDefinition(array(
return new InputDefinition([
new InputArgument('namespace', InputArgument::OPTIONAL, 'The namespace name'),
new InputOption('raw', null, InputOption::VALUE_NONE, 'To output raw command list'),
new InputOption('format', null, InputOption::VALUE_REQUIRED, 'The output format (txt, xml, json, or md)', 'txt'),
));
]);
}
}

View File

@@ -12,8 +12,8 @@
namespace Symfony\Component\Console\Command;
use Symfony\Component\Console\Exception\LogicException;
use Symfony\Component\Lock\Factory;
use Symfony\Component\Lock\Lock;
use Symfony\Component\Lock\LockFactory;
use Symfony\Component\Lock\Store\FlockStore;
use Symfony\Component\Lock\Store\SemaphoreStore;
@@ -29,10 +29,8 @@ trait LockableTrait
/**
* Locks a command.
*
* @return bool
*/
private function lock($name = null, $blocking = false)
private function lock(string $name = null, bool $blocking = false): bool
{
if (!class_exists(SemaphoreStore::class)) {
throw new LogicException('To enable the locking feature you must install the symfony/lock component.');
@@ -48,7 +46,7 @@ trait LockableTrait
$store = new FlockStore();
}
$this->lock = (new Factory($store))->createLock($name ?: $this->getName());
$this->lock = (new LockFactory($store))->createLock($name ?: $this->getName());
if (!$this->lock->acquire($blocking)) {
$this->lock = null;