update patch 1
This commit is contained in:
+5
-6
@@ -23,7 +23,6 @@ use function Symfony\Component\String\b;
|
||||
*/
|
||||
class OutputFormatter implements WrappableOutputFormatterInterface
|
||||
{
|
||||
private bool $decorated;
|
||||
private array $styles = [];
|
||||
private OutputFormatterStyleStack $styleStack;
|
||||
|
||||
@@ -67,10 +66,10 @@ class OutputFormatter implements WrappableOutputFormatterInterface
|
||||
*
|
||||
* @param OutputFormatterStyleInterface[] $styles Array of "name => FormatterStyle" instances
|
||||
*/
|
||||
public function __construct(bool $decorated = false, array $styles = [])
|
||||
{
|
||||
$this->decorated = $decorated;
|
||||
|
||||
public function __construct(
|
||||
private bool $decorated = false,
|
||||
array $styles = [],
|
||||
) {
|
||||
$this->setStyle('error', new OutputFormatterStyle('white', 'red'));
|
||||
$this->setStyle('info', new OutputFormatterStyle('green'));
|
||||
$this->setStyle('comment', new OutputFormatterStyle('yellow'));
|
||||
@@ -106,7 +105,7 @@ class OutputFormatter implements WrappableOutputFormatterInterface
|
||||
public function getStyle(string $name): OutputFormatterStyleInterface
|
||||
{
|
||||
if (!$this->hasStyle($name)) {
|
||||
throw new InvalidArgumentException(sprintf('Undefined style: "%s".', $name));
|
||||
throw new InvalidArgumentException(\sprintf('Undefined style: "%s".', $name));
|
||||
}
|
||||
|
||||
return $this->styles[strtolower($name)];
|
||||
|
||||
Reference in New Issue
Block a user