Skip to content

Commit

Permalink
Merge branch '5.4' into 6.0
Browse files Browse the repository at this point in the history
* 5.4:
  [Validator] Multi decimal to alpha for CssColor validator
  [Console] Fix null handling in formatAndWrap()
  MailerInterface: failed exception contract when enabling messenger
  add nonces to profiler
  • Loading branch information
nicolas-grekas committed Feb 25, 2022
2 parents aebf06c + d8111ac commit 3bebf41
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 0 deletions.
4 changes: 4 additions & 0 deletions Formatter/OutputFormatter.php
Expand Up @@ -138,6 +138,10 @@ public function format(?string $message): ?string
*/
public function formatAndWrap(?string $message, int $width)
{
if (null === $message) {
return '';
}

$offset = 0;
$output = '';
$openTagRegex = '[a-z](?:[^\\\\<>]*+ | \\\\.)*';
Expand Down
1 change: 1 addition & 0 deletions Tests/Formatter/OutputFormatterTest.php
Expand Up @@ -343,6 +343,7 @@ public function testFormatAndWrap()
$this->assertSame("pre\nfoo\nbar\nbaz\npos\nt", $formatter->formatAndWrap('pre <error>foo bar baz</error> post', 3));
$this->assertSame("pre \nfoo \nbar \nbaz \npost", $formatter->formatAndWrap('pre <error>foo bar baz</error> post', 4));
$this->assertSame("pre f\noo ba\nr baz\npost", $formatter->formatAndWrap('pre <error>foo bar baz</error> post', 5));
$this->assertSame('', $formatter->formatAndWrap(null, 5));
}
}

Expand Down

0 comments on commit 3bebf41

Please sign in to comment.