Several 'framework' fixes
This commit is contained in:
parent
c1d5089d0a
commit
17b0d7098c
2
.github/workflows/ci.yaml
vendored
2
.github/workflows/ci.yaml
vendored
@ -57,4 +57,4 @@ jobs:
|
||||
uses: php-actions/composer@v5
|
||||
|
||||
- name: Run Psalm
|
||||
run: ./vendor/bin/psalm --output-format=github
|
||||
run: composer psalm -- --output-format=github
|
||||
|
2
aoc21
2
aoc21
@ -5,6 +5,7 @@ require __DIR__.'/vendor/autoload.php';
|
||||
use AdventOfCode21\Day1;
|
||||
use AdventOfCode21\Day2;
|
||||
use AdventOfCode21\Day3;
|
||||
use AdventOfCode21\Day4;
|
||||
use AdventOfCode21\Puzzle;
|
||||
use Symfony\Component\Console\Application;
|
||||
|
||||
@ -14,5 +15,6 @@ $application->add(new Puzzle());
|
||||
$application->add(new Day1());
|
||||
$application->add(new Day2());
|
||||
$application->add(new Day3());
|
||||
$application->add(new Day4());
|
||||
|
||||
$application->run();
|
||||
|
@ -34,6 +34,7 @@
|
||||
},
|
||||
"scripts": {
|
||||
"test": "vendor/bin/phpunit ./tests --testdox",
|
||||
"style": "vendor/bin/php-cs-fixer fix"
|
||||
"style": "vendor/bin/php-cs-fixer fix",
|
||||
"psalm": "vendor/bin/psalm"
|
||||
}
|
||||
}
|
||||
|
@ -1,6 +1,7 @@
|
||||
<?xml version="1.0"?>
|
||||
<psalm
|
||||
errorLevel="1"
|
||||
reportMixedIssues="false"
|
||||
resolveFromConfigFile="true"
|
||||
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||
xmlns="https://getpsalm.org/schema/config"
|
||||
|
@ -17,13 +17,13 @@ abstract class AbstractCommand extends Command
|
||||
* @var string[] The data to use.
|
||||
* @psalm-suppress PropertyNotSetInConstructor
|
||||
*/
|
||||
protected array $data;
|
||||
protected ?array $data = null;
|
||||
|
||||
/**
|
||||
* @var string[] The example data.
|
||||
* @psalm-suppress PropertyNotSetInConstructor
|
||||
*/
|
||||
protected array $exampleData;
|
||||
protected ?array $exampleData = null;
|
||||
|
||||
/**
|
||||
* @var string The title.
|
||||
@ -102,7 +102,7 @@ abstract class AbstractCommand extends Command
|
||||
/**
|
||||
* Solve the given data for part one of the puzzle.
|
||||
*
|
||||
* @param array $data The data to process.
|
||||
* @param string[] $data The data to process.
|
||||
*
|
||||
* @return int|string The result or null if not (yet?) implemented.
|
||||
*/
|
||||
@ -114,7 +114,7 @@ abstract class AbstractCommand extends Command
|
||||
/**
|
||||
* Solve the given data for part one of the puzzle.
|
||||
*
|
||||
* @param array $data The data to process.
|
||||
* @param string[] $data The data to process.
|
||||
*
|
||||
* @return int|string The result or null if not (yet?) implemented.
|
||||
*/
|
||||
|
@ -17,7 +17,6 @@ class Day2 extends AbstractCommand
|
||||
$depth = 0;
|
||||
$horizontal = 0;
|
||||
|
||||
/** @var string $current */
|
||||
foreach ($data as $current) {
|
||||
/**
|
||||
* @var string $direction
|
||||
@ -44,7 +43,6 @@ class Day2 extends AbstractCommand
|
||||
$depth = 0;
|
||||
$horizontal = 0;
|
||||
|
||||
/** @var string $current */
|
||||
foreach ($data as $current) {
|
||||
/**
|
||||
* @var string $direction
|
||||
|
@ -17,6 +17,9 @@ class Puzzle extends Command
|
||||
->addArgument('day', InputArgument::REQUIRED, 'The day number.');
|
||||
}
|
||||
|
||||
/**
|
||||
* @return int
|
||||
*/
|
||||
protected function execute(InputInterface $input, OutputInterface $output): int
|
||||
{
|
||||
$contents = file_get_contents(sprintf('%s/../data/day%s/puzzle.md', __DIR__, (int) $input->getArgument('day')));
|
||||
|
Loading…
x
Reference in New Issue
Block a user