From 8f6de7b62716e28ebd6a1b4a63c1068d91f513aa Mon Sep 17 00:00:00 2001 From: trizz Date: Thu, 9 Dec 2021 21:45:08 +0000 Subject: [PATCH] Apply php-cs-fixer changes --- src/ExecuteDay.php | 9 ++++----- src/Puzzle.php | 2 +- src/Solution.php | 5 +---- src/Utils/Arr.php | 1 - src/Y21/Day4.php | 32 ++++++++++++++++---------------- src/Y21/Day6.php | 2 +- src/Y21/Day7.php | 1 - 7 files changed, 23 insertions(+), 29 deletions(-) diff --git a/src/ExecuteDay.php b/src/ExecuteDay.php index cc0f9ca..2857834 100644 --- a/src/ExecuteDay.php +++ b/src/ExecuteDay.php @@ -9,15 +9,14 @@ use Symfony\Component\Console\Output\OutputInterface; class ExecuteDay extends Command { + protected int $day; + + protected int $year; /** * @var string The title. */ private string $title; - protected int $day; - - protected int $year; - /** * Configure the command. */ @@ -53,7 +52,7 @@ class ExecuteDay extends Command */ protected function execute(InputInterface $input, OutputInterface $output): int { - $className = sprintf("%s\\Y%d\\Day%d", __NAMESPACE__, $this->year, $this->day); + $className = sprintf('%s\\Y%d\\Day%d', __NAMESPACE__, $this->year, $this->day); /** @var Solution $class */ $class = new $className(); $class->loadData(); diff --git a/src/Puzzle.php b/src/Puzzle.php index 1de360d..23977ec 100644 --- a/src/Puzzle.php +++ b/src/Puzzle.php @@ -2,11 +2,11 @@ namespace trizz\AdventOfCode; -use trizz\AdventOfCode\Utils\SymfonyConsoleMarkdown; use Symfony\Component\Console\Command\Command; use Symfony\Component\Console\Input\InputArgument; use Symfony\Component\Console\Input\InputInterface; use Symfony\Component\Console\Output\OutputInterface; +use trizz\AdventOfCode\Utils\SymfonyConsoleMarkdown; class Puzzle extends Command { diff --git a/src/Solution.php b/src/Solution.php index 30cb06a..94f606c 100644 --- a/src/Solution.php +++ b/src/Solution.php @@ -3,9 +3,6 @@ namespace trizz\AdventOfCode; use JetBrains\PhpStorm\ArrayShape; -use Symfony\Component\Console\Command\Command; -use Symfony\Component\Console\Input\InputInterface; -use Symfony\Component\Console\Output\OutputInterface; abstract class Solution { @@ -93,7 +90,7 @@ abstract class Solution return !empty($this->exampleData); } - #[ArrayShape(['part1' => "int|string", 'part2' => "int|string"])] + #[ArrayShape(['part1' => 'int|string', 'part2' => 'int|string'])] public function results(bool $useExampleData = true): array { $data = $useExampleData ? $this->exampleData : $this->data; diff --git a/src/Utils/Arr.php b/src/Utils/Arr.php index 56651ab..3649a1c 100644 --- a/src/Utils/Arr.php +++ b/src/Utils/Arr.php @@ -4,5 +4,4 @@ namespace AdventOfCode21\Utils; class Arr { - } diff --git a/src/Y21/Day4.php b/src/Y21/Day4.php index 701ad73..9b05c7d 100644 --- a/src/Y21/Day4.php +++ b/src/Y21/Day4.php @@ -12,6 +12,22 @@ class Day4 extends Solution public static int|string|null $part2ExampleResult = 1924; public static int|string|null $part2Result = 17435; + /** + * {@inheritdoc} + */ + public function part1(array $data): int|string + { + return $this->playBingo($data, firstWins: true); + } + + /** + * {@inheritdoc} + */ + public function part2(array $data): int|string + { + return $this->playBingo($data, firstWins: false); + } + /** * @param int[] $winningCard * @param int $number @@ -30,22 +46,6 @@ class Day4 extends Solution return (int) array_sum($unusedNumbers) * $number; } - /** - * {@inheritdoc} - */ - public function part1(array $data): int|string - { - return $this->playBingo($data, firstWins: true); - } - - /** - * {@inheritdoc} - */ - public function part2(array $data): int|string - { - return $this->playBingo($data, firstWins: false); - } - /** * @param string $numberList * @param string $separator diff --git a/src/Y21/Day6.php b/src/Y21/Day6.php index b582787..2309e86 100644 --- a/src/Y21/Day6.php +++ b/src/Y21/Day6.php @@ -2,8 +2,8 @@ namespace trizz\AdventOfCode\Y21; -use trizz\AdventOfCode\Solution; use JetBrains\PhpStorm\Immutable; +use trizz\AdventOfCode\Solution; class Day6 extends Solution { diff --git a/src/Y21/Day7.php b/src/Y21/Day7.php index d4a73f4..e9c7d79 100644 --- a/src/Y21/Day7.php +++ b/src/Y21/Day7.php @@ -2,7 +2,6 @@ namespace trizz\AdventOfCode\Y21; -use trizz\AdventOfCode\ExecuteDay; use trizz\AdventOfCode\Solution; class Day7 extends Solution