From ff777e26256f761f4e5fbdb8efee8fda65dc4e6d Mon Sep 17 00:00:00 2001 From: Nuno Maduro Date: Tue, 10 Oct 2023 16:32:25 +0100 Subject: [PATCH] chore: coding style --- src/Components/Element.php | 2 +- src/Functions.php | 2 +- src/Html/CodeRenderer.php | 2 +- src/Question.php | 4 ++-- src/Termwind.php | 6 +++--- src/ValueObjects/Node.php | 4 ++-- 6 files changed, 10 insertions(+), 10 deletions(-) diff --git a/src/Components/Element.php b/src/Components/Element.php index 9ec8fbf..0a8bd72 100644 --- a/src/Components/Element.php +++ b/src/Components/Element.php @@ -40,7 +40,7 @@ abstract class Element final public function __construct( protected OutputInterface $output, protected array|string $content, - Styles|null $styles = null + Styles $styles = null ) { $this->styles = $styles ?? new Styles(defaultStyles: static::$defaultStyles); $this->styles->setElement($this); diff --git a/src/Functions.php b/src/Functions.php index 20cec63..13a6a2c 100644 --- a/src/Functions.php +++ b/src/Functions.php @@ -14,7 +14,7 @@ /** * Sets the renderer implementation. */ - function renderUsing(OutputInterface|null $renderer): void + function renderUsing(?OutputInterface $renderer): void { Termwind::renderUsing($renderer); } diff --git a/src/Html/CodeRenderer.php b/src/Html/CodeRenderer.php index f75898b..475b937 100644 --- a/src/Html/CodeRenderer.php +++ b/src/Html/CodeRenderer.php @@ -239,7 +239,7 @@ private function lineNumbers(array $lines, int $markLine): string foreach ($lines as $i => $line) { $coloredLineNumber = $this->coloredLineNumber(self::LINE_NUMBER, $i, $lineLength); - if (0 !== $markLine) { + if ($markLine !== 0) { $snippet .= ($markLine === $i + 1 ? $this->styleToken(self::ACTUAL_LINE_MARK, $mark) : self::NO_MARK diff --git a/src/Question.php b/src/Question.php index 289f866..76d3d8e 100644 --- a/src/Question.php +++ b/src/Question.php @@ -20,7 +20,7 @@ final class Question /** * The streamable input to receive the input from the user. */ - private static StreamableInputInterface|null $streamableInput; + private static ?StreamableInputInterface $streamableInput; /** * An instance of Symfony's question helper. @@ -35,7 +35,7 @@ public function __construct(SymfonyQuestionHelper $helper = null) /** * Sets the streamable input implementation. */ - public static function setStreamableInput(StreamableInputInterface|null $streamableInput): void + public static function setStreamableInput(?StreamableInputInterface $streamableInput): void { self::$streamableInput = $streamableInput ?? new ArgvInput(); } diff --git a/src/Termwind.php b/src/Termwind.php index 0ce1b51..fa11e6e 100644 --- a/src/Termwind.php +++ b/src/Termwind.php @@ -18,12 +18,12 @@ final class Termwind /** * The implementation of the output. */ - private static OutputInterface|null $renderer; + private static ?OutputInterface $renderer; /** * Sets the renderer implementation. */ - public static function renderUsing(OutputInterface|null $renderer): void + public static function renderUsing(?OutputInterface $renderer): void { self::$renderer = $renderer ?? new ConsoleOutput(); } @@ -287,7 +287,7 @@ public static function getRenderer(): OutputInterface * @param array|string $elements * @return array */ - private static function prepareElements($elements, string $styles = '', Closure|null $callback = null): array + private static function prepareElements($elements, string $styles = '', Closure $callback = null): array { if ($callback === null) { $callback = static fn ($element): string|Element => $element; diff --git a/src/ValueObjects/Node.php b/src/ValueObjects/Node.php index 8e388ae..5ef7bcf 100644 --- a/src/ValueObjects/Node.php +++ b/src/ValueObjects/Node.php @@ -101,7 +101,7 @@ public function isEmpty(): bool /** * Gets the previous sibling from the node. */ - public function getPreviousSibling(): static|null + public function getPreviousSibling(): ?static { $node = $this->node; @@ -127,7 +127,7 @@ public function getPreviousSibling(): static|null /** * Gets the next sibling from the node. */ - public function getNextSibling(): static|null + public function getNextSibling(): ?static { $node = $this->node;