mirror of
https://github.com/Combodo/iTop.git
synced 2026-05-01 06:28:46 +02:00
N°8834 - Add compatibility with PHP 8.4 (#819)
* N°8834 - Add compatibility with PHP 8.4 * Rollback of scssphp/scssphp version upgrade due to compilation error
This commit is contained in:
@@ -63,7 +63,7 @@ class SymfonyStyle extends OutputStyle
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function block(string|array $messages, string $type = null, string $style = null, string $prefix = ' ', bool $padding = false, bool $escape = true)
|
||||
public function block(string|array $messages, ?string $type = null, ?string $style = null, string $prefix = ' ', bool $padding = false, bool $escape = true)
|
||||
{
|
||||
$messages = \is_array($messages) ? array_values($messages) : [$messages];
|
||||
|
||||
@@ -79,8 +79,8 @@ class SymfonyStyle extends OutputStyle
|
||||
{
|
||||
$this->autoPrependBlock();
|
||||
$this->writeln([
|
||||
sprintf('<comment>%s</>', OutputFormatter::escapeTrailingBackslash($message)),
|
||||
sprintf('<comment>%s</>', str_repeat('=', Helper::width(Helper::removeDecoration($this->getFormatter(), $message)))),
|
||||
\sprintf('<comment>%s</>', OutputFormatter::escapeTrailingBackslash($message)),
|
||||
\sprintf('<comment>%s</>', str_repeat('=', Helper::width(Helper::removeDecoration($this->getFormatter(), $message)))),
|
||||
]);
|
||||
$this->newLine();
|
||||
}
|
||||
@@ -92,8 +92,8 @@ class SymfonyStyle extends OutputStyle
|
||||
{
|
||||
$this->autoPrependBlock();
|
||||
$this->writeln([
|
||||
sprintf('<comment>%s</>', OutputFormatter::escapeTrailingBackslash($message)),
|
||||
sprintf('<comment>%s</>', str_repeat('-', Helper::width(Helper::removeDecoration($this->getFormatter(), $message)))),
|
||||
\sprintf('<comment>%s</>', OutputFormatter::escapeTrailingBackslash($message)),
|
||||
\sprintf('<comment>%s</>', str_repeat('-', Helper::width(Helper::removeDecoration($this->getFormatter(), $message)))),
|
||||
]);
|
||||
$this->newLine();
|
||||
}
|
||||
@@ -104,7 +104,7 @@ class SymfonyStyle extends OutputStyle
|
||||
public function listing(array $elements)
|
||||
{
|
||||
$this->autoPrependText();
|
||||
$elements = array_map(fn ($element) => sprintf(' * %s', $element), $elements);
|
||||
$elements = array_map(fn ($element) => \sprintf(' * %s', $element), $elements);
|
||||
|
||||
$this->writeln($elements);
|
||||
$this->newLine();
|
||||
@@ -119,7 +119,7 @@ class SymfonyStyle extends OutputStyle
|
||||
|
||||
$messages = \is_array($message) ? array_values($message) : [$message];
|
||||
foreach ($messages as $message) {
|
||||
$this->writeln(sprintf(' %s', $message));
|
||||
$this->writeln(\sprintf(' %s', $message));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -249,7 +249,7 @@ class SymfonyStyle extends OutputStyle
|
||||
$this->horizontalTable($headers, [$row]);
|
||||
}
|
||||
|
||||
public function ask(string $question, string $default = null, callable $validator = null): mixed
|
||||
public function ask(string $question, ?string $default = null, ?callable $validator = null): mixed
|
||||
{
|
||||
$question = new Question($question, $default);
|
||||
$question->setValidator($validator);
|
||||
@@ -257,7 +257,7 @@ class SymfonyStyle extends OutputStyle
|
||||
return $this->askQuestion($question);
|
||||
}
|
||||
|
||||
public function askHidden(string $question, callable $validator = null): mixed
|
||||
public function askHidden(string $question, ?callable $validator = null): mixed
|
||||
{
|
||||
$question = new Question($question);
|
||||
|
||||
@@ -336,7 +336,7 @@ class SymfonyStyle extends OutputStyle
|
||||
*
|
||||
* @return iterable<TKey, TValue>
|
||||
*/
|
||||
public function progressIterate(iterable $iterable, int $max = null): iterable
|
||||
public function progressIterate(iterable $iterable, ?int $max = null): iterable
|
||||
{
|
||||
yield from $this->createProgressBar()->iterate($iterable, $max);
|
||||
|
||||
@@ -456,14 +456,14 @@ class SymfonyStyle extends OutputStyle
|
||||
$this->bufferedOutput->write($message, $newLine, $type);
|
||||
}
|
||||
|
||||
private function createBlock(iterable $messages, string $type = null, string $style = null, string $prefix = ' ', bool $padding = false, bool $escape = false): array
|
||||
private function createBlock(iterable $messages, ?string $type = null, ?string $style = null, string $prefix = ' ', bool $padding = false, bool $escape = false): array
|
||||
{
|
||||
$indentLength = 0;
|
||||
$prefixLength = Helper::width(Helper::removeDecoration($this->getFormatter(), $prefix));
|
||||
$lines = [];
|
||||
|
||||
if (null !== $type) {
|
||||
$type = sprintf('[%s] ', $type);
|
||||
$type = \sprintf('[%s] ', $type);
|
||||
$indentLength = Helper::width($type);
|
||||
$lineIndentation = str_repeat(' ', $indentLength);
|
||||
}
|
||||
@@ -505,7 +505,7 @@ class SymfonyStyle extends OutputStyle
|
||||
$line .= str_repeat(' ', max($this->lineLength - Helper::width(Helper::removeDecoration($this->getFormatter(), $line)), 0));
|
||||
|
||||
if ($style) {
|
||||
$line = sprintf('<%s>%s</>', $style, $line);
|
||||
$line = \sprintf('<%s>%s</>', $style, $line);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user