Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
Revert back changes of FormatterHelper.php
  • Loading branch information
proggga committed Oct 8, 2019
1 parent cf9efe9 commit 0e1edd9
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 6 deletions.
8 changes: 4 additions & 4 deletions src/Symfony/Component/Console/Helper/FormatterHelper.php
Expand Up @@ -54,12 +54,12 @@ public function formatBlock($messages, $style, $large = false)
foreach ($messages as $message) {
$message = OutputFormatter::escape($message);
$lines[] = sprintf($large ? ' %s ' : ' %s ', $message);
$len = max(static::strlen($message) + ($large ? 4 : 2), $len);
$len = max($this->strlen($message) + ($large ? 4 : 2), $len);
}

$messages = $large ? [str_repeat(' ', $len)] : [];
for ($i = 0; isset($lines[$i]); ++$i) {
$messages[] = $lines[$i].str_repeat(' ', $len - static::strlen($lines[$i]));
$messages[] = $lines[$i].str_repeat(' ', $len - $this->strlen($lines[$i]));
}
if ($large) {
$messages[] = str_repeat(' ', $len);
Expand All @@ -83,9 +83,9 @@ public function formatBlock($messages, $style, $large = false)
*/
public function truncate($message, $length, $suffix = '...')
{
$computedLength = $length - static::strlen($suffix);
$computedLength = $length - $this->strlen($suffix);

if ($computedLength > static::strlen($message)) {
if ($computedLength > $this->strlen($message)) {
return $message;
}

Expand Down
4 changes: 2 additions & 2 deletions src/Symfony/Component/Console/Helper/QuestionHelper.php
Expand Up @@ -217,12 +217,12 @@ protected function prepareChoices($tag, ChoiceQuestion $question)
{
$choices = $question->getChoices();

$maxWidth = max(array_map([static::class, 'strlen'], array_keys($choices)));
$maxWidth = max(array_map([$this, 'strlen'], array_keys($choices)));

$messages = [];

foreach ($choices as $key => $value) {
$width = $maxWidth - static::strlen($key);
$width = $maxWidth - $this->strlen($key);
// We using strlen + str_repeat to fix sprintf whitespace padding problem with UTF-8)
$messages[] = sprintf(' [<%s>%s%s</%s>] %s', $tag, $key, str_repeat(' ', $width), $tag, $value);
}
Expand Down

0 comments on commit 0e1edd9

Please sign in to comment.