Skip to content

Commit bbd0cbe

Browse files
committed
bumped to phpstan 1.11
1 parent a65bea1 commit bbd0cbe

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

48 files changed

+91
-91
lines changed

.github/workflows/qa.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ jobs:
1313
uses: shivammathur/setup-php@v2
1414
with:
1515
php-version: "8.3"
16-
tools: phpcs:3.8, php-cs-fixer:3.49, phpstan:1.10
16+
tools: phpcs:3.9, php-cs-fixer:3.56, phpstan:1.11
1717
coverage: none
1818
env:
1919
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
@@ -45,7 +45,7 @@ jobs:
4545
with:
4646
php-version: "8.3"
4747
extensions: mbstring, bcmath, xdebug
48-
tools: phpunit:11.0
48+
tools: phpunit:11.1
4949
coverage: xdebug
5050
env:
5151
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

.php-cs-fixer.dist.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
/**
44
* php-cs-fixer configuration file.
55
*
6-
* minimum version: ^3.49
6+
* minimum version: ^3.56
77
*
88
* @see https://cs.symfony.com/doc/config.html
99
*/

phpcs.xml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,13 +2,13 @@
22
<!--
33
phpcs configuration file.
44
5-
minimum version: ^3.8
5+
minimum version: ^3.9
66
77
@see https://github.com/PHPCSStandards/PHP_CodeSniffer/wiki/Annotated-Ruleset
88
-->
99
<ruleset xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" name="advent-of-code-solutions">
1010
<description>PHP_CodeSniffer configuration</description>
11-
<config name="php_version" value="80200"/>
11+
<config name="php_version" value="80300"/>
1212
<arg name="cache" value=".tools/.phpcs.cache"/>
1313
<arg name="extensions" value="php"/>
1414
<arg name="encoding" value="utf-8"/>

phpstan.dist.neon

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
# PHPStan configuration file.
22
#
3-
# minimum version: ^1.10.57
3+
# minimum version: ^1.11
44
#
55
# @see https://phpstan.org/config-reference
66
parameters:
@@ -16,7 +16,8 @@ parameters:
1616
- .tools
1717
- vendor
1818
ignoreErrors:
19-
- '#^Static method TBali[a-zA-Z0-9\\_]+::[a-zA-Z0-9_]+\(\) is unused.$#'
20-
- '#^Method TBali[a-zA-Z0-9\\_]+::[a-zA-Z0-9_]+\(\) is unused.$#'
19+
-
20+
message: '#^(Static )?[Mm]ethod TBali[a-zA-Z0-9\\_]+::[a-zA-Z0-9_]+\(\) is unused.$#'
21+
identifier: method.unused
2122
includes:
2223
- phar://phpstan.phar/conf/bleedingEdge.neon

phpunit.xml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,13 +2,13 @@
22
<!--
33
PHPUnit configuration file.
44
5-
minimum version: ^11.0
5+
minimum version: ^11.1
66
77
@see https://phpunit.readthedocs.io/en/11.0/configuration.html
88
-->
99
<phpunit
1010
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
11-
xsi:noNamespaceSchemaLocation="https://schema.phpunit.de/11.0/phpunit.xsd"
11+
xsi:noNamespaceSchemaLocation="https://schema.phpunit.de/11.1/phpunit.xsd"
1212
bootstrap="vendor/autoload.php"
1313
cacheDirectory=".tools/.phpunit.cache/"
1414
colors="true"

src/Aoc/AocRunner.php

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -128,7 +128,6 @@ public function run(): void
128128
echo '======= ' . $year . ' ' . str_repeat('=', 45) . PHP_EOL;
129129
$lastYear = $year;
130130
}
131-
// @ phpstan-ignore-next-line
132131
if (isset(self::TO_SKIP[$year]) and in_array($day, self::TO_SKIP[$year])) {
133132
echo '=== AoC ' . $year . ' Day ' . str_pad(strval($day), 2, '0', STR_PAD_LEFT) . PHP_EOL;
134133
echo Tags::WARN_TAG . 'Skipped.' . PHP_EOL;
@@ -153,11 +152,9 @@ public function run(): void
153152
if ($countFails > 0) {
154153
$messages[] = $countFails . ' failed';
155154
}
156-
// @ phpstan-ignore-next-line
157155
if ($countSkipped > 0) {
158156
$messages[] = $countSkipped . ' skipped';
159157
}
160-
// @ phpstan-ignore-next-line
161158
if (($countFails > 0) or ($countSkipped > 0)) {
162159
$failSkipMsg = ' (' . implode(', ', $messages) . ')';
163160
} else {

src/Aoc2015/Aoc2015Day12.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ public function solve(array $input): array
3939
// ---------- Part 1
4040
$a = json_decode($input, true) ?? []; // true: JSON objects will be returned as associative arrays
4141
$count = 0;
42-
// @phpstan-ignore-next-line
42+
// @phpstan-ignore argument.type
4343
array_walk_recursive($a, static function ($x) use (&$count): void {
4444
if (is_numeric($x)) {
4545
$count += intval($x);
@@ -59,7 +59,7 @@ private function sumNonRed(mixed $a): int
5959
}
6060
if (is_object($a)) {
6161
$isOk = true;
62-
// @phpstan-ignore-next-line
62+
// @phpstan-ignore foreach.nonIterable
6363
foreach ($a as $item) {
6464
if ($item == 'red') {
6565
$isOk = false;
@@ -74,7 +74,7 @@ private function sumNonRed(mixed $a): int
7474
return 0;
7575
}
7676
$sum = 0;
77-
// @phpstan-ignore-next-line
77+
// @phpstan-ignore foreach.nonIterable
7878
foreach ($a as $item) {
7979
$sum += $this->sumNonRed($item);
8080
}

src/Aoc2016/Aoc2016Day08.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -147,7 +147,7 @@ public function simulate(Instruction $instr): void
147147
}
148148
return;
149149
}
150-
// @phpstan-ignore-next-line
150+
// @phpstan-ignore equal.alwaysTrue
151151
if ($instr->verb == InstructionVerb::RotateColumn) {
152152
for ($i = 0; $i < $instr->y; ++$i) {
153153
$temp = $this->grid[self::MAX_Y - 1][$instr->x];

src/Aoc2017/Aoc2017Day18.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -50,13 +50,13 @@ public function solve(array $input): array
5050
$wasComm = false;
5151
$thread0->execute();
5252
while (count($thread0->sndQueue) > 0) {
53-
// @phpstan-ignore-next-line
53+
// @phpstan-ignore assign.propertyType
5454
$thread1->rcvQueue[] = array_shift($thread0->sndQueue);
5555
$wasComm = true;
5656
}
5757
$thread1->execute();
5858
while (count($thread1->sndQueue) > 0) {
59-
// @phpstan-ignore-next-line
59+
// @phpstan-ignore assign.propertyType
6060
$thread0->rcvQueue[] = array_shift($thread1->sndQueue);
6161
$wasComm = true;
6262
}

src/Aoc2017/Aoc2017Day20.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -83,7 +83,7 @@ public function solve(array $input): array
8383
$collisions[$particle->id] = true;
8484
}
8585
if (count($collisions) > 0) {
86-
// @phpstan-ignore-next-line
86+
// @phpstan-ignore if.alwaysFalse
8787
if (self::DEBUG) {
8888
// @codeCoverageIgnoreStart
8989
echo '-- T = ' . $t . ': remaining particles = ' . count($particles) . PHP_EOL;

0 commit comments

Comments
 (0)