fix: 优化 php8 兼容

This commit is contained in:
F4nniu
2024-02-18 22:09:20 +08:00
parent d0f6422a57
commit c769166eac
2 changed files with 2 additions and 2 deletions

View File

@@ -299,7 +299,7 @@ class Ask
$width = max(array_map('strlen', array_keys($this->question->getChoices()))); $width = max(array_map('strlen', array_keys($this->question->getChoices())));
foreach ($this->question->getChoices() as $key => $value) { foreach ($this->question->getChoices() as $key => $value) {
$this->output->writeln(sprintf(" [<comment>%-${width}s</comment>] %s", $key, $value)); $this->output->writeln(sprintf(" [<comment>%-{$width}s</comment>] %s", $key, $value));
} }
} }

View File

@@ -219,7 +219,7 @@ class Descriptor
$width = $this->getColumnWidth($description->getCommands()); $width = $this->getColumnWidth($description->getCommands());
foreach ($description->getCommands() as $command) { foreach ($description->getCommands() as $command) {
$this->writeText(sprintf("%-${width}s %s", $command->getName(), $command->getDescription()), $options); $this->writeText(sprintf("%-{$width}s %s", $command->getName(), $command->getDescription()), $options);
$this->writeText("\n"); $this->writeText("\n");
} }
} else { } else {