package and depencies
This commit is contained in:
@@ -22,9 +22,9 @@ class OutputFormatterStyleStack implements ResetInterface
|
||||
/**
|
||||
* @var OutputFormatterStyleInterface[]
|
||||
*/
|
||||
private $styles;
|
||||
private array $styles = [];
|
||||
|
||||
private $emptyStyle;
|
||||
private OutputFormatterStyleInterface $emptyStyle;
|
||||
|
||||
public function __construct(OutputFormatterStyleInterface $emptyStyle = null)
|
||||
{
|
||||
@@ -51,13 +51,11 @@ class OutputFormatterStyleStack implements ResetInterface
|
||||
/**
|
||||
* Pops a style from the stack.
|
||||
*
|
||||
* @return OutputFormatterStyleInterface
|
||||
*
|
||||
* @throws InvalidArgumentException When style tags incorrectly nested
|
||||
*/
|
||||
public function pop(OutputFormatterStyleInterface $style = null)
|
||||
public function pop(OutputFormatterStyleInterface $style = null): OutputFormatterStyleInterface
|
||||
{
|
||||
if (empty($this->styles)) {
|
||||
if (!$this->styles) {
|
||||
return $this->emptyStyle;
|
||||
}
|
||||
|
||||
@@ -78,12 +76,10 @@ class OutputFormatterStyleStack implements ResetInterface
|
||||
|
||||
/**
|
||||
* Computes current style with stacks top codes.
|
||||
*
|
||||
* @return OutputFormatterStyle
|
||||
*/
|
||||
public function getCurrent()
|
||||
public function getCurrent(): OutputFormatterStyleInterface
|
||||
{
|
||||
if (empty($this->styles)) {
|
||||
if (!$this->styles) {
|
||||
return $this->emptyStyle;
|
||||
}
|
||||
|
||||
@@ -93,17 +89,14 @@ class OutputFormatterStyleStack implements ResetInterface
|
||||
/**
|
||||
* @return $this
|
||||
*/
|
||||
public function setEmptyStyle(OutputFormatterStyleInterface $emptyStyle)
|
||||
public function setEmptyStyle(OutputFormatterStyleInterface $emptyStyle): static
|
||||
{
|
||||
$this->emptyStyle = $emptyStyle;
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return OutputFormatterStyleInterface
|
||||
*/
|
||||
public function getEmptyStyle()
|
||||
public function getEmptyStyle(): OutputFormatterStyleInterface
|
||||
{
|
||||
return $this->emptyStyle;
|
||||
}
|
||||
|
Reference in New Issue
Block a user