Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chore: update symfony/console to 5.4.24 #1481

Merged
merged 1 commit into from
Jul 18, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@
"sabre/dav": "^4.4.0",
"scssphp/scssphp": "^1.11",
"stecman/symfony-console-completion": "^0.11.0",
"symfony/console": "5.4.19",
"symfony/console": "^5.4.24",
"symfony/event-dispatcher": "4.4.30",
"symfony/event-dispatcher-contracts": "1.1.9",
"symfony/http-foundation": "^5.4.10",
Expand Down
16 changes: 8 additions & 8 deletions composer.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

16 changes: 8 additions & 8 deletions composer/installed.json
Original file line number Diff line number Diff line change
Expand Up @@ -4627,17 +4627,17 @@
},
{
"name": "symfony/console",
"version": "v5.4.19",
"version_normalized": "5.4.19.0",
"version": "v5.4.24",
"version_normalized": "5.4.24.0",
"source": {
"type": "git",
"url": "https://github.com/symfony/console.git",
"reference": "dccb8d251a9017d5994c988b034d3e18aaabf740"
"reference": "560fc3ed7a43e6d30ea94a07d77f9a60b8ed0fb8"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/symfony/console/zipball/dccb8d251a9017d5994c988b034d3e18aaabf740",
"reference": "dccb8d251a9017d5994c988b034d3e18aaabf740",
"url": "https://api.github.com/repos/symfony/console/zipball/560fc3ed7a43e6d30ea94a07d77f9a60b8ed0fb8",
"reference": "560fc3ed7a43e6d30ea94a07d77f9a60b8ed0fb8",
"shasum": ""
},
"require": {
Expand Down Expand Up @@ -4675,7 +4675,7 @@
"symfony/lock": "",
"symfony/process": ""
},
"time": "2023-01-01T08:32:19+00:00",
"time": "2023-05-26T05:13:16+00:00",
"type": "library",
"installation-source": "dist",
"autoload": {
Expand Down Expand Up @@ -4704,12 +4704,12 @@
"homepage": "https://symfony.com",
"keywords": [
"cli",
"command line",
"command-line",
"console",
"terminal"
],
"support": {
"source": "https://github.com/symfony/console/tree/v5.4.19"
"source": "https://github.com/symfony/console/tree/v5.4.24"
},
"funding": [
{
Expand Down
10 changes: 5 additions & 5 deletions composer/installed.php
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
'name' => 'nextcloud/3rdparty',
'pretty_version' => 'dev-master',
'version' => 'dev-master',
'reference' => '48b720f4253fffbb463b96fc81248e9f3588e2e0',
'reference' => '350e2a466ff849c59386e817c849f9e441fc10ab',
'type' => 'library',
'install_path' => __DIR__ . '/../',
'aliases' => array(),
Expand Down Expand Up @@ -310,7 +310,7 @@
'nextcloud/3rdparty' => array(
'pretty_version' => 'dev-master',
'version' => 'dev-master',
'reference' => '48b720f4253fffbb463b96fc81248e9f3588e2e0',
'reference' => '350e2a466ff849c59386e817c849f9e441fc10ab',
'type' => 'library',
'install_path' => __DIR__ . '/../',
'aliases' => array(),
Expand Down Expand Up @@ -689,9 +689,9 @@
'dev_requirement' => false,
),
'symfony/console' => array(
'pretty_version' => 'v5.4.19',
'version' => '5.4.19.0',
'reference' => 'dccb8d251a9017d5994c988b034d3e18aaabf740',
'pretty_version' => 'v5.4.24',
'version' => '5.4.24.0',
'reference' => '560fc3ed7a43e6d30ea94a07d77f9a60b8ed0fb8',
'type' => 'library',
'install_path' => __DIR__ . '/../symfony/console',
'aliases' => array(),
Expand Down
8 changes: 4 additions & 4 deletions symfony/console/Command/Command.php
Original file line number Diff line number Diff line change
Expand Up @@ -429,9 +429,9 @@ public function getNativeDefinition()
* @param int|null $mode The argument mode: InputArgument::REQUIRED or InputArgument::OPTIONAL
* @param mixed $default The default value (for InputArgument::OPTIONAL mode only)
*
* @throws InvalidArgumentException When argument mode is not valid
*
* @return $this
*
* @throws InvalidArgumentException When argument mode is not valid
*/
public function addArgument(string $name, int $mode = null, string $description = '', $default = null)
{
Expand All @@ -450,9 +450,9 @@ public function addArgument(string $name, int $mode = null, string $description
* @param int|null $mode The option mode: One of the InputOption::VALUE_* constants
* @param mixed $default The default value (must be null for InputOption::VALUE_NONE)
*
* @throws InvalidArgumentException If option mode is invalid or incompatible
*
* @return $this
*
* @throws InvalidArgumentException If option mode is invalid or incompatible
*/
public function addOption(string $name, $shortcut = null, int $mode = null, string $description = '', $default = null)
{
Expand Down
4 changes: 2 additions & 2 deletions symfony/console/Command/CompleteCommand.php
Original file line number Diff line number Diff line change
Expand Up @@ -155,10 +155,10 @@ protected function execute(InputInterface $input, OutputInterface $output): int
throw $e;
}

return self::FAILURE;
return 2;
}

return self::SUCCESS;
return 0;
}

private function createCompletionInput(InputInterface $input): CompletionInput
Expand Down
18 changes: 12 additions & 6 deletions symfony/console/Command/DumpCompletionCommand.php
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,7 @@ protected function execute(InputInterface $input, OutputInterface $output): int
if ($input->getOption('debug')) {
$this->tailDebugLog($commandName, $output);

return self::SUCCESS;
return 0;
}

$shell = $input->getArgument('shell') ?? self::guessShell();
Expand All @@ -102,12 +102,12 @@ protected function execute(InputInterface $input, OutputInterface $output): int
$output->writeln(sprintf('<error>Shell not detected, Symfony shell completion only supports "%s").</>', implode('", "', $supportedShells)));
}

return self::INVALID;
return 2;
}

$output->write(str_replace(['{{ COMMAND_NAME }}', '{{ VERSION }}'], [$commandName, $this->getApplication()->getVersion()], file_get_contents($completionFile)));

return self::SUCCESS;
return 0;
}

private static function guessShell(): string
Expand All @@ -132,8 +132,14 @@ private function tailDebugLog(string $commandName, OutputInterface $output): voi
*/
private function getSupportedShells(): array
{
return array_map(function ($f) {
return pathinfo($f, \PATHINFO_EXTENSION);
}, glob(__DIR__.'/../Resources/completion.*'));
$shells = [];

foreach (new \DirectoryIterator(__DIR__.'/../Resources/') as $file) {
if (str_starts_with($file->getBasename(), 'completion.') && $file->isFile()) {
$shells[] = $file->getExtension();
}
}

return $shells;
}
}
3 changes: 2 additions & 1 deletion symfony/console/Formatter/OutputFormatterStyle.php
Original file line number Diff line number Diff line change
Expand Up @@ -96,7 +96,8 @@ public function apply(string $text)
{
if (null === $this->handlesHrefGracefully) {
$this->handlesHrefGracefully = 'JetBrains-JediTerm' !== getenv('TERMINAL_EMULATOR')
&& (!getenv('KONSOLE_VERSION') || (int) getenv('KONSOLE_VERSION') > 201100);
&& (!getenv('KONSOLE_VERSION') || (int) getenv('KONSOLE_VERSION') > 201100)
&& !isset($_SERVER['IDEA_INITIAL_DIRECTORY']);
}

if (null !== $this->href && $this->handlesHrefGracefully) {
Expand Down
17 changes: 13 additions & 4 deletions symfony/console/Helper/QuestionHelper.php
Original file line number Diff line number Diff line change
Expand Up @@ -128,7 +128,18 @@ private function doAsk(OutputInterface $output, Question $question)
}

if (false === $ret) {
$isBlocked = stream_get_meta_data($inputStream)['blocked'] ?? true;

if (!$isBlocked) {
stream_set_blocking($inputStream, true);
}

$ret = $this->readInput($inputStream, $question);

if (!$isBlocked) {
stream_set_blocking($inputStream, false);
}

if (false === $ret) {
throw new MissingInputException('Aborted.');
}
Expand Down Expand Up @@ -500,13 +511,11 @@ private function isInteractiveInput($inputStream): bool
return self::$stdinIsInteractive = @posix_isatty(fopen('php://stdin', 'r'));
}

if (!\function_exists('exec')) {
if (!\function_exists('shell_exec')) {
return self::$stdinIsInteractive = true;
}

exec('stty 2> /dev/null', $output, $status);

return self::$stdinIsInteractive = 1 !== $status;
return self::$stdinIsInteractive = (bool) shell_exec('stty 2> '.('\\' === \DIRECTORY_SEPARATOR ? 'NUL' : '/dev/null'));
}

/**
Expand Down
2 changes: 1 addition & 1 deletion symfony/console/Helper/Table.php
Original file line number Diff line number Diff line change
Expand Up @@ -805,7 +805,7 @@ private function calculateColumnsWidth(iterable $groups)
$textContent = Helper::removeDecoration($this->output->getFormatter(), $cell);
$textLength = Helper::width($textContent);
if ($textLength > 0) {
$contentColumns = str_split($textContent, ceil($textLength / $cell->getColspan()));
$contentColumns = mb_str_split($textContent, ceil($textLength / $cell->getColspan()));
foreach ($contentColumns as $position => $content) {
$row[$i + $position] = $content;
}
Expand Down
2 changes: 1 addition & 1 deletion symfony/console/Input/InputArgument.php
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ class InputArgument

/**
* @param string $name The argument name
* @param int|null $mode The argument mode: self::REQUIRED or self::OPTIONAL
* @param int|null $mode The argument mode: a bit mask of self::REQUIRED, self::OPTIONAL and self::IS_ARRAY
* @param string $description A description text
* @param string|bool|int|float|array|null $default The default value (for self::OPTIONAL mode only)
*
Expand Down
2 changes: 1 addition & 1 deletion symfony/console/LICENSE
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
Copyright (c) 2004-2023 Fabien Potencier
Copyright (c) 2004-present Fabien Potencier

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
Expand Down
17 changes: 11 additions & 6 deletions symfony/console/Terminal.php
Original file line number Diff line number Diff line change
Expand Up @@ -64,20 +64,19 @@ public static function hasSttyAvailable(): bool
return self::$stty;
}

// skip check if exec function is disabled
if (!\function_exists('exec')) {
// skip check if shell_exec function is disabled
if (!\function_exists('shell_exec')) {
return false;
}

exec('stty 2>&1', $output, $exitcode);

return self::$stty = 0 === $exitcode;
return self::$stty = (bool) shell_exec('stty 2> '.('\\' === \DIRECTORY_SEPARATOR ? 'NUL' : '/dev/null'));
}

private static function initDimensions()
{
if ('\\' === \DIRECTORY_SEPARATOR) {
if (preg_match('/^(\d+)x(\d+)(?: \((\d+)x(\d+)\))?$/', trim(getenv('ANSICON')), $matches)) {
$ansicon = getenv('ANSICON');
if (false !== $ansicon && preg_match('/^(\d+)x(\d+)(?: \((\d+)x(\d+)\))?$/', trim($ansicon), $matches)) {
// extract [w, H] from "wxh (WxH)"
// or [w, h] from "wxh"
self::$width = (int) $matches[1];
Expand Down Expand Up @@ -157,6 +156,8 @@ private static function readFromProcess(string $command): ?string
2 => ['pipe', 'w'],
];

$cp = \function_exists('sapi_windows_cp_set') ? sapi_windows_cp_get() : 0;

$process = proc_open($command, $descriptorspec, $pipes, null, null, ['suppress_errors' => true]);
if (!\is_resource($process)) {
return null;
Expand All @@ -167,6 +168,10 @@ private static function readFromProcess(string $command): ?string
fclose($pipes[2]);
proc_close($process);

if ($cp) {
sapi_windows_cp_set($cp);
}

return $info;
}
}
8 changes: 4 additions & 4 deletions symfony/console/Tester/TesterTrait.php
Original file line number Diff line number Diff line change
Expand Up @@ -35,9 +35,9 @@ trait TesterTrait
/**
* Gets the display returned by the last execution of the command or application.
*
* @throws \RuntimeException If it's called before the execute method
*
* @return string
*
* @throws \RuntimeException If it's called before the execute method
*/
public function getDisplay(bool $normalize = false)
{
Expand Down Expand Up @@ -103,9 +103,9 @@ public function getOutput()
/**
* Gets the status code returned by the last execution of the command or application.
*
* @throws \RuntimeException If it's called before the execute method
*
* @return int
*
* @throws \RuntimeException If it's called before the execute method
*/
public function getStatusCode()
{
Expand Down