mirror of
https://github.com/linuxserver/Heimdall.git
synced 2025-12-20 21:57:51 +09:00
Update dependencies
This commit is contained in:
44
vendor/symfony/console/Input/ArgvInput.php
vendored
44
vendor/symfony/console/Input/ArgvInput.php
vendored
@@ -40,12 +40,12 @@ use Symfony\Component\Console\Exception\RuntimeException;
|
||||
*/
|
||||
class ArgvInput extends Input
|
||||
{
|
||||
private $tokens;
|
||||
private $parsed;
|
||||
private array $tokens;
|
||||
private array $parsed;
|
||||
|
||||
public function __construct(array $argv = null, InputDefinition $definition = null)
|
||||
public function __construct(?array $argv = null, ?InputDefinition $definition = null)
|
||||
{
|
||||
$argv = $argv ?? $_SERVER['argv'] ?? [];
|
||||
$argv ??= $_SERVER['argv'] ?? [];
|
||||
|
||||
// strip the application name
|
||||
array_shift($argv);
|
||||
@@ -55,13 +55,16 @@ class ArgvInput extends Input
|
||||
parent::__construct($definition);
|
||||
}
|
||||
|
||||
/**
|
||||
* @return void
|
||||
*/
|
||||
protected function setTokens(array $tokens)
|
||||
{
|
||||
$this->tokens = $tokens;
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
* @return void
|
||||
*/
|
||||
protected function parse()
|
||||
{
|
||||
@@ -92,7 +95,7 @@ class ArgvInput extends Input
|
||||
/**
|
||||
* Parses a short option.
|
||||
*/
|
||||
private function parseShortOption(string $token)
|
||||
private function parseShortOption(string $token): void
|
||||
{
|
||||
$name = substr($token, 1);
|
||||
|
||||
@@ -113,7 +116,7 @@ class ArgvInput extends Input
|
||||
*
|
||||
* @throws RuntimeException When option given doesn't exist
|
||||
*/
|
||||
private function parseShortOptionSet(string $name)
|
||||
private function parseShortOptionSet(string $name): void
|
||||
{
|
||||
$len = \strlen($name);
|
||||
for ($i = 0; $i < $len; ++$i) {
|
||||
@@ -136,7 +139,7 @@ class ArgvInput extends Input
|
||||
/**
|
||||
* Parses a long option.
|
||||
*/
|
||||
private function parseLongOption(string $token)
|
||||
private function parseLongOption(string $token): void
|
||||
{
|
||||
$name = substr($token, 2);
|
||||
|
||||
@@ -155,7 +158,7 @@ class ArgvInput extends Input
|
||||
*
|
||||
* @throws RuntimeException When too many arguments are given
|
||||
*/
|
||||
private function parseArgument(string $token)
|
||||
private function parseArgument(string $token): void
|
||||
{
|
||||
$c = \count($this->arguments);
|
||||
|
||||
@@ -199,7 +202,7 @@ class ArgvInput extends Input
|
||||
*
|
||||
* @throws RuntimeException When option given doesn't exist
|
||||
*/
|
||||
private function addShortOption(string $shortcut, $value)
|
||||
private function addShortOption(string $shortcut, mixed $value): void
|
||||
{
|
||||
if (!$this->definition->hasShortcut($shortcut)) {
|
||||
throw new RuntimeException(sprintf('The "-%s" option does not exist.', $shortcut));
|
||||
@@ -213,7 +216,7 @@ class ArgvInput extends Input
|
||||
*
|
||||
* @throws RuntimeException When option given doesn't exist
|
||||
*/
|
||||
private function addLongOption(string $name, $value)
|
||||
private function addLongOption(string $name, mixed $value): void
|
||||
{
|
||||
if (!$this->definition->hasOption($name)) {
|
||||
if (!$this->definition->hasNegation($name)) {
|
||||
@@ -263,10 +266,7 @@ class ArgvInput extends Input
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function getFirstArgument()
|
||||
public function getFirstArgument(): ?string
|
||||
{
|
||||
$isOption = false;
|
||||
foreach ($this->tokens as $i => $token) {
|
||||
@@ -298,10 +298,7 @@ class ArgvInput extends Input
|
||||
return null;
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function hasParameterOption($values, bool $onlyParams = false)
|
||||
public function hasParameterOption(string|array $values, bool $onlyParams = false): bool
|
||||
{
|
||||
$values = (array) $values;
|
||||
|
||||
@@ -323,10 +320,7 @@ class ArgvInput extends Input
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function getParameterOption($values, $default = false, bool $onlyParams = false)
|
||||
public function getParameterOption(string|array $values, string|bool|int|float|array|null $default = false, bool $onlyParams = false): mixed
|
||||
{
|
||||
$values = (array) $values;
|
||||
$tokens = $this->tokens;
|
||||
@@ -356,10 +350,8 @@ class ArgvInput extends Input
|
||||
|
||||
/**
|
||||
* Returns a stringified representation of the args passed to the command.
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function __toString()
|
||||
public function __toString(): string
|
||||
{
|
||||
$tokens = array_map(function ($token) {
|
||||
if (preg_match('{^(-[^=]+=)(.+)}', $token, $match)) {
|
||||
|
||||
Reference in New Issue
Block a user