From 43b48b29222efc89b65032409d6eb4d0c2883c34 Mon Sep 17 00:00:00 2001 From: Alexandre Daubois Date: Mon, 22 Jul 2024 10:27:43 +0200 Subject: [PATCH] Use CPP where possible --- CI/GithubActionReporter.php | 8 +++----- Formatter/OutputFormatter.php | 9 ++++----- 2 files changed, 7 insertions(+), 10 deletions(-) diff --git a/CI/GithubActionReporter.php b/CI/GithubActionReporter.php index 28112c2a..952d380d 100644 --- a/CI/GithubActionReporter.php +++ b/CI/GithubActionReporter.php @@ -20,8 +20,6 @@ use Symfony\Component\Console\Output\OutputInterface; */ class GithubActionReporter { - private OutputInterface $output; - /** * @see https://github.com/actions/toolkit/blob/5e5e1b7aacba68a53836a34db4a288c3c1c1585b/packages/core/src/command.ts#L80-L85 */ @@ -42,9 +40,9 @@ class GithubActionReporter ',' => '%2C', ]; - public function __construct(OutputInterface $output) - { - $this->output = $output; + public function __construct( + private OutputInterface $output, + ) { } public static function isGithubActionEnvironment(): bool diff --git a/Formatter/OutputFormatter.php b/Formatter/OutputFormatter.php index 1f3d04a2..3c8c287e 100644 --- a/Formatter/OutputFormatter.php +++ b/Formatter/OutputFormatter.php @@ -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'));