Compare commits

..

24 Commits

Author SHA1 Message Date
b6a90cf203 Update dependency friendsofphp/php-cs-fixer to v3.71.0
Some checks failed
CI Pipeline / install (pull_request) Failing after 8s
CI Pipeline / phpstan (pull_request) Has been skipped
CI Pipeline / rector (pull_request) Has been skipped
CI Pipeline / pest (pull_request) Has been skipped
CI Pipeline / style-check (pull_request) Has been skipped
CI Pipeline / install (push) Failing after 5s
CI Pipeline / phpstan (push) Has been skipped
CI Pipeline / rector (push) Has been skipped
CI Pipeline / pest (push) Has been skipped
CI Pipeline / style-check (push) Has been skipped
2025-03-08 00:00:58 +00:00
6358f4e466 Update dependency friendsofphp/php-cs-fixer to v3.70.2
Some checks failed
CI Pipeline / install (pull_request) Failing after 8s
CI Pipeline / phpstan (pull_request) Has been skipped
CI Pipeline / rector (pull_request) Has been skipped
CI Pipeline / pest (pull_request) Has been skipped
CI Pipeline / style-check (pull_request) Has been skipped
CI Pipeline / install (push) Failing after 6s
CI Pipeline / phpstan (push) Has been skipped
CI Pipeline / rector (push) Has been skipped
CI Pipeline / pest (push) Has been skipped
CI Pipeline / style-check (push) Has been skipped
2025-03-04 00:00:53 +00:00
d646d753a6 Update dependency friendsofphp/php-cs-fixer to v3.70.1
Some checks failed
CI Pipeline / install (pull_request) Failing after 8s
CI Pipeline / phpstan (pull_request) Has been skipped
CI Pipeline / rector (pull_request) Has been skipped
CI Pipeline / pest (pull_request) Has been skipped
CI Pipeline / style-check (pull_request) Has been skipped
CI Pipeline / install (push) Failing after 5s
CI Pipeline / phpstan (push) Has been skipped
CI Pipeline / rector (push) Has been skipped
CI Pipeline / pest (push) Has been skipped
CI Pipeline / style-check (push) Has been skipped
2025-03-02 00:00:53 +00:00
9dce552df2 Update dependency friendsofphp/php-cs-fixer to v3.70.0
Some checks failed
CI Pipeline / install (pull_request) Failing after 7s
CI Pipeline / phpstan (pull_request) Has been skipped
CI Pipeline / rector (pull_request) Has been skipped
CI Pipeline / pest (pull_request) Has been skipped
CI Pipeline / style-check (pull_request) Has been skipped
CI Pipeline / install (push) Failing after 4s
CI Pipeline / phpstan (push) Has been skipped
CI Pipeline / rector (push) Has been skipped
CI Pipeline / pest (push) Has been skipped
CI Pipeline / style-check (push) Has been skipped
2025-02-23 00:00:48 +00:00
aca4a85101 Update dependency friendsofphp/php-cs-fixer to v3.69.1
Some checks failed
CI Pipeline / install (pull_request) Failing after 5s
CI Pipeline / phpstan (pull_request) Has been skipped
CI Pipeline / rector (pull_request) Has been skipped
CI Pipeline / pest (pull_request) Has been skipped
CI Pipeline / style-check (pull_request) Has been skipped
CI Pipeline / install (push) Failing after 4s
CI Pipeline / phpstan (push) Has been skipped
CI Pipeline / rector (push) Has been skipped
CI Pipeline / pest (push) Has been skipped
CI Pipeline / style-check (push) Has been skipped
2025-02-19 00:00:42 +00:00
7dd87b8be8 Update dependency friendsofphp/php-cs-fixer to v3.69.0
Some checks failed
CI Pipeline / install (pull_request) Failing after 7s
CI Pipeline / phpstan (pull_request) Has been skipped
CI Pipeline / rector (pull_request) Has been skipped
CI Pipeline / pest (pull_request) Has been skipped
CI Pipeline / style-check (pull_request) Has been skipped
CI Pipeline / install (push) Failing after 3s
CI Pipeline / phpstan (push) Has been skipped
CI Pipeline / rector (push) Has been skipped
CI Pipeline / pest (push) Has been skipped
CI Pipeline / style-check (push) Has been skipped
2025-02-16 00:00:49 +00:00
2b07571ffd Update dependency friendsofphp/php-cs-fixer to v3.68.5
Some checks failed
CI Pipeline / install (pull_request) Failing after 5s
CI Pipeline / phpstan (pull_request) Has been skipped
CI Pipeline / rector (pull_request) Has been skipped
CI Pipeline / pest (pull_request) Has been skipped
CI Pipeline / style-check (pull_request) Has been skipped
CI Pipeline / install (push) Failing after 2s
CI Pipeline / phpstan (push) Has been skipped
CI Pipeline / rector (push) Has been skipped
CI Pipeline / pest (push) Has been skipped
CI Pipeline / style-check (push) Has been skipped
2025-01-31 00:00:38 +00:00
52a18f5020 Update dependency friendsofphp/php-cs-fixer to v3.68.3
Some checks failed
CI Pipeline / install (pull_request) Failing after 6s
CI Pipeline / phpstan (pull_request) Has been skipped
CI Pipeline / rector (pull_request) Has been skipped
CI Pipeline / pest (pull_request) Has been skipped
CI Pipeline / style-check (pull_request) Has been skipped
CI Pipeline / install (push) Failing after 2s
CI Pipeline / phpstan (push) Has been skipped
CI Pipeline / rector (push) Has been skipped
CI Pipeline / pest (push) Has been skipped
CI Pipeline / style-check (push) Has been skipped
2025-01-28 00:00:39 +00:00
93a6896c5b Update dependency friendsofphp/php-cs-fixer to v3.68.1
Some checks failed
CI Pipeline / install (pull_request) Failing after 7s
CI Pipeline / phpstan (pull_request) Has been skipped
CI Pipeline / rector (pull_request) Has been skipped
CI Pipeline / pest (pull_request) Has been skipped
CI Pipeline / style-check (pull_request) Has been skipped
CI Pipeline / install (push) Failing after 2s
CI Pipeline / phpstan (push) Has been skipped
CI Pipeline / rector (push) Has been skipped
CI Pipeline / pest (push) Has been skipped
CI Pipeline / style-check (push) Has been skipped
2025-01-18 00:00:39 +00:00
0d4b5c407a Update dependency friendsofphp/php-cs-fixer to v3.68.0
Some checks failed
CI Pipeline / install (pull_request) Failing after 54s
CI Pipeline / phpstan (pull_request) Has been skipped
CI Pipeline / rector (pull_request) Has been skipped
CI Pipeline / pest (pull_request) Has been skipped
CI Pipeline / style-check (pull_request) Has been skipped
CI Pipeline / install (push) Failing after 2m13s
CI Pipeline / phpstan (push) Has been skipped
CI Pipeline / rector (push) Has been skipped
CI Pipeline / pest (push) Has been skipped
CI Pipeline / style-check (push) Has been skipped
2025-01-14 00:00:40 +00:00
02705353ef Update dependency friendsofphp/php-cs-fixer to v3.67.1
Some checks failed
CI Pipeline / install (pull_request) Failing after 13s
CI Pipeline / phpstan (pull_request) Has been skipped
CI Pipeline / rector (pull_request) Has been skipped
CI Pipeline / pest (pull_request) Has been skipped
CI Pipeline / style-check (pull_request) Has been skipped
CI Pipeline / install (push) Failing after 3s
CI Pipeline / phpstan (push) Has been skipped
CI Pipeline / rector (push) Has been skipped
CI Pipeline / pest (push) Has been skipped
CI Pipeline / style-check (push) Has been skipped
2025-01-13 00:00:41 +00:00
4d8de674b7 Update dependency friendsofphp/php-cs-fixer to v3.67.0
Some checks failed
CI Pipeline / install (pull_request) Failing after 7s
CI Pipeline / phpstan (pull_request) Has been skipped
CI Pipeline / rector (pull_request) Has been skipped
CI Pipeline / pest (pull_request) Has been skipped
CI Pipeline / style-check (pull_request) Has been skipped
CI Pipeline / install (push) Failing after 4s
CI Pipeline / phpstan (push) Has been skipped
CI Pipeline / rector (push) Has been skipped
CI Pipeline / pest (push) Has been skipped
CI Pipeline / style-check (push) Has been skipped
2025-01-09 00:00:46 +00:00
8dc9727141 Update dependency friendsofphp/php-cs-fixer to v3.66.2
Some checks failed
CI Pipeline / install (pull_request) Failing after 5s
CI Pipeline / phpstan (pull_request) Has been skipped
CI Pipeline / rector (pull_request) Has been skipped
CI Pipeline / pest (pull_request) Has been skipped
CI Pipeline / style-check (pull_request) Has been skipped
CI Pipeline / install (push) Failing after 2s
CI Pipeline / phpstan (push) Has been skipped
CI Pipeline / rector (push) Has been skipped
CI Pipeline / pest (push) Has been skipped
CI Pipeline / style-check (push) Has been skipped
2025-01-08 00:00:41 +00:00
964d1ad793 Update dependency friendsofphp/php-cs-fixer to v3.66.1
Some checks failed
CI Pipeline / install (pull_request) Failing after 6s
CI Pipeline / phpstan (pull_request) Has been skipped
CI Pipeline / rector (pull_request) Has been skipped
CI Pipeline / pest (pull_request) Has been skipped
CI Pipeline / style-check (pull_request) Has been skipped
CI Pipeline / install (push) Failing after 3s
CI Pipeline / phpstan (push) Has been skipped
CI Pipeline / rector (push) Has been skipped
CI Pipeline / pest (push) Has been skipped
CI Pipeline / style-check (push) Has been skipped
2025-01-06 00:00:42 +00:00
b8063e48e0 Update dependency friendsofphp/php-cs-fixer to v3.66.0
Some checks failed
CI Pipeline / install (pull_request) Failing after 6s
CI Pipeline / phpstan (pull_request) Has been skipped
CI Pipeline / rector (pull_request) Has been skipped
CI Pipeline / pest (pull_request) Has been skipped
CI Pipeline / style-check (pull_request) Has been skipped
CI Pipeline / install (push) Failing after 3s
CI Pipeline / phpstan (push) Has been skipped
CI Pipeline / rector (push) Has been skipped
CI Pipeline / pest (push) Has been skipped
CI Pipeline / style-check (push) Has been skipped
2024-12-30 00:00:41 +00:00
0f250ab844 Update dependency rector/rector to v2.0.4
Some checks failed
CI Pipeline / phpstan (pull_request) Has been skipped
CI Pipeline / rector (pull_request) Has been skipped
CI Pipeline / pest (pull_request) Has been skipped
CI Pipeline / style-check (pull_request) Has been skipped
CI Pipeline / install (pull_request) Failing after 3s
CI Pipeline / install (push) Failing after 3s
CI Pipeline / phpstan (push) Has been skipped
CI Pipeline / rector (push) Has been skipped
CI Pipeline / pest (push) Has been skipped
CI Pipeline / style-check (push) Has been skipped
2024-12-27 00:00:45 +00:00
1066916742 Update dependency rector/rector to v2.0.3
Some checks failed
CI Pipeline / install (pull_request) Failing after 5s
CI Pipeline / phpstan (pull_request) Has been skipped
CI Pipeline / rector (pull_request) Has been skipped
CI Pipeline / pest (pull_request) Has been skipped
CI Pipeline / style-check (pull_request) Has been skipped
CI Pipeline / install (push) Failing after 3s
CI Pipeline / phpstan (push) Has been skipped
CI Pipeline / rector (push) Has been skipped
CI Pipeline / pest (push) Has been skipped
CI Pipeline / style-check (push) Has been skipped
2024-12-13 00:00:39 +00:00
2db41dde7c Update dependency rector/rector to v2.0.0-rc3
Some checks failed
CI Pipeline / install (pull_request) Failing after 5s
CI Pipeline / phpstan (pull_request) Has been skipped
CI Pipeline / rector (pull_request) Has been skipped
CI Pipeline / pest (pull_request) Has been skipped
CI Pipeline / style-check (pull_request) Has been skipped
CI Pipeline / install (push) Failing after 4s
CI Pipeline / phpstan (push) Has been skipped
CI Pipeline / rector (push) Has been skipped
CI Pipeline / pest (push) Has been skipped
CI Pipeline / style-check (push) Has been skipped
2024-12-10 00:00:42 +00:00
e47dc820d5 Update dependency rector/rector to v2.0.0-rc2
Some checks failed
CI Pipeline / install (pull_request) Failing after 4s
CI Pipeline / phpstan (pull_request) Has been skipped
CI Pipeline / rector (pull_request) Has been skipped
CI Pipeline / pest (pull_request) Has been skipped
CI Pipeline / style-check (pull_request) Has been skipped
CI Pipeline / install (push) Failing after 3s
CI Pipeline / phpstan (push) Has been skipped
CI Pipeline / rector (push) Has been skipped
CI Pipeline / pest (push) Has been skipped
CI Pipeline / style-check (push) Has been skipped
2024-12-04 00:00:41 +00:00
9f14ee2dd0 Update actions/checkout action to v4
Some checks failed
CI Pipeline / install (pull_request) Failing after 4s
CI Pipeline / phpstan (pull_request) Has been skipped
CI Pipeline / rector (pull_request) Has been skipped
CI Pipeline / pest (pull_request) Has been skipped
CI Pipeline / style-check (pull_request) Has been skipped
CI Pipeline / install (push) Failing after 4s
CI Pipeline / phpstan (push) Has been skipped
CI Pipeline / rector (push) Has been skipped
CI Pipeline / pest (push) Has been skipped
CI Pipeline / style-check (push) Has been skipped
2024-12-02 00:00:34 +00:00
06c645f064 Use GH Action instead of drone
Some checks failed
CI Pipeline / install (push) Failing after 17s
CI Pipeline / phpstan (push) Has been skipped
CI Pipeline / rector (push) Has been skipped
CI Pipeline / pest (push) Has been skipped
CI Pipeline / style-check (push) Has been skipped
2024-12-01 11:35:01 +01:00
0c9fc4f017 Update php Docker tag to v8.4 2024-12-01 10:32:46 +00:00
a27e188c9e Test '24 2024-12-01 11:30:36 +01:00
6915c35fed Update stuff 2024-12-01 11:30:31 +01:00
16 changed files with 923 additions and 916 deletions

View File

@ -1,37 +0,0 @@
kind: pipeline
type: docker
name: default
steps:
- name: install
image: composer
commands:
- composer install
- name: phpstan
image: php:8.3
depends_on:
- install
commands:
- vendor/bin/phpstan analyse
- name: rector
image: php:8.3
depends_on:
- install
commands:
- vendor/bin/rector process --dry-run
- name: pest
image: php:8.3
depends_on:
- install
commands:
- vendor/bin/pest
- name: style check
image: php:8.3
depends_on:
- install
commands:
- vendor/bin/php-cs-fixer fix

69
.github/workflows/ci.yml vendored Normal file
View File

@ -0,0 +1,69 @@
name: CI Pipeline
on:
push:
branches:
- main
pull_request:
branches:
- main
jobs:
install:
runs-on: ubuntu-latest
container:
image: composer:latest
steps:
- name: Checkout Code
uses: actions/checkout@v4
- name: Install Dependencies
run: composer install
phpstan:
runs-on: ubuntu-latest
needs: install
container:
image: php:8.4
steps:
- name: Checkout Code
uses: actions/checkout@v4
- name: PHPStan Analysis
run: vendor/bin/phpstan analyse
rector:
runs-on: ubuntu-latest
needs: install
container:
image: php:8.4
steps:
- name: Checkout Code
uses: actions/checkout@v4
- name: Rector Dry Run
run: vendor/bin/rector process --dry-run
pest:
runs-on: ubuntu-latest
needs: install
container:
image: php:8.4
steps:
- name: Checkout Code
uses: actions/checkout@v4
- name: Run Pest Tests
run: vendor/bin/pest
style-check:
runs-on: ubuntu-latest
needs: install
container:
image: php:8.4
steps:
- name: Checkout Code
uses: actions/checkout@v4
- name: PHP CS Fixer
run: vendor/bin/php-cs-fixer fix

View File

@ -1,6 +1,6 @@
# https://taskfile.dev
version: '3'
version: "3"
tasks:
default:
@ -11,21 +11,21 @@ tasks:
check:
cmds:
- task: echo_title
vars: {TITLE: Running php-cs-fixer...}
vars: { TITLE: Running php-cs-fixer... }
- task: style
- task: echo_title
vars: {TITLE: Running phpstan...}
vars: { TITLE: Running phpstan... }
- task: phpstan
- task: echo_title
vars: { TITLE: Running rector... }
- task: rector
- task: echo_title
vars: {TITLE: Running phpunit}
- task: phpunit
vars: { TITLE: Running pest }
- task: pest
style:
cmds:
- php vendor/bin/php-cs-fixer fix
- PHP_CS_FIXER_IGNORE_ENV=1 php vendor/bin/php-cs-fixer fix
silent: true
phpstan:
@ -38,7 +38,7 @@ tasks:
- php vendor/bin/rector process
silent: true
phpunit:
pest:
cmds:
- php vendor/bin/pest
silent: true

View File

@ -1,48 +1,49 @@
{
"name": "trizz/adventofcode",
"description": "My Advent of Code solutions",
"type": "project",
"license": "MIT",
"authors": [
{
"name": "Tristan",
"email": "me@trizz.io"
}
],
"require": {
"php": "^8.3",
"ext-mbstring": "*",
"cebe/markdown": "^1.2",
"laravel/prompts": "^0.1.13",
"nette/php-generator": "^4.1",
"phppkg/cli-markdown": "^2.0",
"symfony/console": "^7"
},
"require-dev": {
"friendsofphp/php-cs-fixer": "^3.3",
"jetbrains/phpstorm-attributes": "^1.0",
"nunomaduro/collision": "^8",
"pestphp/pest": "^2.26",
"phpstan/phpstan": "^1.2",
"rector/rector": "^1.0",
"robiningelbrecht/phpunit-pretty-print": "^1.2",
"symfony/var-dumper": "^7"
},
"autoload": {
"psr-4": {
"trizz\\AdventOfCode\\": "src/"
}
},
"autoload-dev": {
"psr-4": {
"Tests\\": "tests/"
}
},
"config": {
"sort-packages": true,
"optimize-autoloader": true,
"allow-plugins": {
"pestphp/pest-plugin": true
}
"name": "trizz/adventofcode",
"description": "My Advent of Code solutions",
"type": "project",
"license": "MIT",
"authors": [
{
"name": "Tristan",
"email": "me@trizz.io"
}
],
"require": {
"php": "^8.3",
"ext-mbstring": "*",
"cebe/markdown": "^1.2",
"laravel/prompts": "^0.3",
"nette/php-generator": "^4.1",
"phppkg/cli-markdown": "^2.0",
"symfony/console": "^7"
},
"require-dev": {
"friendsofphp/php-cs-fixer": "^3.3",
"jetbrains/phpstorm-attributes": "^1.0",
"nunomaduro/collision": "^8",
"pestphp/pest": "^3.5",
"phpstan/phpstan": "^2.0",
"rector/rector": "^2.0",
"robiningelbrecht/phpunit-pretty-print": "^1.2",
"symfony/var-dumper": "^7"
},
"minimum-stability": "dev",
"autoload": {
"psr-4": {
"trizz\\AdventOfCode\\": "src/"
}
},
"autoload-dev": {
"psr-4": {
"Tests\\": "tests/"
}
},
"config": {
"sort-packages": true,
"optimize-autoloader": true,
"allow-plugins": {
"pestphp/pest-plugin": true
}
}
}

1546
composer.lock generated

File diff suppressed because it is too large Load Diff

View File

@ -21,11 +21,9 @@ final class Day2 extends Solution
$horizontal = 0;
foreach ($data as $current) {
/**
* @var string $direction
* @var int $distance
*/
[$direction, $distance] = explode(' ', $current);
$direction = (string) $direction;
$distance = (int) $distance;
match ($direction) {
'forward' => $horizontal += $distance,
@ -46,11 +44,9 @@ final class Day2 extends Solution
$horizontal = 0;
foreach ($data as $current) {
/**
* @var string $direction
* @var int $distance
*/
[$direction, $distance] = explode(' ', $current);
$direction = (string) $direction;
$distance = (int) $distance;
// Can't use 'match' here because of the multiple expressions for 'forward'.
switch ($direction) {

View File

@ -52,6 +52,10 @@ final class Day7 extends Solution
}
}
if (empty($fuelPerPosition)) {
return -1;
}
return (int) min($fuelPerPosition);
}
}

View File

@ -40,7 +40,7 @@ final class Day8 extends Solution
}
#[\Override]
public function part2(array $data): int|string
public function part2(array $data): int
{
$sequences = [];

View File

@ -69,7 +69,7 @@ final class Day2 extends Solution
}
/**
* @return array<int, array<int, string>>
* @return array{string, non-empty-list<string>}
*/
private function getHand(string $line): array
{

View File

@ -30,6 +30,17 @@ final class Day3 extends Solution
$numbers = $this->checkLocation($row, $col);
$top = (int) $this->processNumbers($numbers['top'], sum: true);
$bottom = (int) $this->processNumbers($numbers['bottom'], sum: true);
if ($numbers === []) {
continue;
}
if (empty($numbers['left'])) {
continue;
}
if (empty($numbers['right'])) {
continue;
}
$score += $top + $bottom + max($numbers['left']) + max($numbers['right']);
}
@ -54,6 +65,18 @@ final class Day3 extends Solution
$top = (array) $this->processNumbers($numbers['top']);
$bottom = (array) $this->processNumbers($numbers['bottom']);
if ($numbers === []) {
continue;
}
if (empty($numbers['left'])) {
continue;
}
if (empty($numbers['right'])) {
continue;
}
$left = max($numbers['left']);
$right = max($numbers['right']);
@ -81,7 +104,7 @@ final class Day3 extends Solution
if ($numbers[0] !== 0 && $numbers[1] === 0 && $numbers[2] !== 0) {
$result[] = $numbers[0];
$result[] = $numbers[2];
} else {
} elseif ($numbers !== []) {
$result[] = max($numbers);
}
@ -127,7 +150,7 @@ final class Day3 extends Solution
return $numbers;
}
private function getNumber(int $row, int $col, string $direction = null): ?string
private function getNumber(int $row, int $col, ?string $direction = null): ?string
{
$number = $this->matrix[$row][$col] ?? null;

View File

@ -2,7 +2,9 @@
namespace trizz\AdventOfCode\Y23;
final class Day5 extends \trizz\AdventOfCode\Solution
use trizz\AdventOfCode\Solution;
final class Day5 extends Solution
{
public static null|int|string $part1ExampleResult = 35;
@ -47,6 +49,10 @@ final class Day5 extends \trizz\AdventOfCode\Solution
$locations[$seed] = $location;
}
if ($locations === []) {
return -1;
}
return min($locations);
}
@ -97,7 +103,7 @@ final class Day5 extends \trizz\AdventOfCode\Solution
}
if (!empty($line) && !str_contains($line, ':')) {
[$destinationRange, $sourceRangeStart, $rangeLength] = array_values(array_map('intval', explode(' ', $line)));
[$destinationRange, $sourceRangeStart, $rangeLength] = array_map('intval', explode(' ', $line));
$this->maps[$currentMap][] = [
'destinationRange' => $destinationRange,
'sourceRangeStart' => $sourceRangeStart,

View File

@ -7,10 +7,14 @@ use trizz\AdventOfCode\Solution;
final class Day1 extends Solution
{
public static null|int|string $part1ExampleResult = 11;
public static null|int|string $part1Result = 1882714;
public static null|int|string $part2ExampleResult = 31;
public static null|int|string $part2Result = null;
public static null|int|string $part1Result = 1882714;
public static null|int|string $part2ExampleResult = 31;
public static null|int|string $part2Result = 19437052;
#[\Override]
public function part1(array $data): int
{
[$listLeft, $listRight] = $this->getList($data);
@ -23,13 +27,14 @@ final class Day1 extends Solution
return $score;
}
#[\Override]
public function part2(array $data): int
{
$score = 0;
[$listLeft, $listRight] = $this->getList($data);
foreach ($listLeft as $index => $left) {
$right = count(array_filter($listRight, fn ($x) => $x === $left));
$right = count(array_filter($listRight, fn ($x): bool => $x === $left));
if ($right > 0) {
$score += $left * $right;
}

View File

@ -39,8 +39,3 @@ parameters:
message: "#^Property trizz\\\\AdventOfCode\\\\Y21\\\\Day8\\:\\:\\$patternDigits type has no value type specified in iterable type array\\.$#"
count: 1
path: data/Y21/day8/Day8.php
-
message: "#^Method trizz\\\\AdventOfCode\\\\Y23\\\\Day2\\:\\:getHand\\(\\) should return array\\<int, array\\<int, string\\>\\> but returns array\\<int, array\\<int, string\\>\\|string\\>\\.$#"
count: 1
path: data/Y23/day2/Day2.php

View File

@ -17,7 +17,7 @@ return static function (RectorConfig $rectorConfig): void {
// define sets of rules
$rectorConfig->sets(
[
LevelSetList::UP_TO_PHP_83,
LevelSetList::UP_TO_PHP_84,
SetList::CODE_QUALITY,
SetList::CODING_STYLE,
SetList::TYPE_DECLARATION,

View File

@ -78,7 +78,7 @@ abstract class AbstractDayCommand extends Command
protected function loadClass(): Solution
{
require_once sprintf('%s/Y%d/day%d/Day%d.php', DATA_DIR, $this->year, $this->day, $this->day);
$className = sprintf('%s\\Y%d\\Day%d', substr(__NAMESPACE__, 0, -9), $this->year, $this->day);
$className = sprintf('%s\Y%d\Day%d', substr(__NAMESPACE__, 0, -9), $this->year, $this->day);
/** @var Solution $class */
$class = new $className();

3
tests/AoC_2024Test.php Normal file
View File

@ -0,0 +1,3 @@
<?php
testYear(24);