Skip to content

Commit 400ef7a

Browse files
authored
Update dev tools (#995)
1 parent 4c6aeae commit 400ef7a

File tree

9 files changed

+324
-254
lines changed

9 files changed

+324
-254
lines changed

.dev-tools/composer.json

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,20 +1,20 @@
11
{
22
"type": "project",
33
"require": {
4-
"php": "^8.3",
5-
"ergebnis/composer-normalize": "^2.44",
6-
"infection/infection": "^0.29.8",
4+
"php": "^8.4",
5+
"ergebnis/composer-normalize": "^2.45",
6+
"infection/infection": "^0.29.10",
77
"kubawerlos/composer-smaller-lock": "^1.0.1",
8-
"kubawerlos/php-cs-fixer-config": "^4.1",
8+
"kubawerlos/php-cs-fixer-config": "^4.3",
99
"mi-schi/phpmd-extension": "^4.3",
1010
"phpmd/phpmd": "^2.15",
1111
"phpstan/extension-installer": "^1.4.3",
12-
"phpstan/phpstan": "^1.12.12",
13-
"phpstan/phpstan-phpunit": "^1.4.1",
14-
"phpstan/phpstan-strict-rules": "^1.6.1",
12+
"phpstan/phpstan": "^2.0.4",
13+
"phpstan/phpstan-phpunit": "^2.0.3",
14+
"phpstan/phpstan-strict-rules": "^2.0.1",
1515
"shipmonk/composer-dependency-analyser": "^1.8.1",
16-
"squizlabs/php_codesniffer": "^3.11.1",
17-
"tomasvotruba/type-coverage": "^1.0"
16+
"squizlabs/php_codesniffer": "^3.11.2",
17+
"tomasvotruba/type-coverage": "^2.0.1"
1818
},
1919
"autoload": {
2020
"psr-4": {

.dev-tools/composer.lock

Lines changed: 222 additions & 221 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

.dev-tools/infection.json

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,8 @@
1818
"customPath": "../vendor/phpunit/phpunit/phpunit"
1919
},
2020
"mutators": {
21+
"ArrayAll": true,
22+
"ArrayAny": true,
2123
"ArrayItem": true,
2224
"ArrayItemRemoval": {
2325
"settings": {

.dev-tools/phpstan.neon

Lines changed: 73 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,79 @@ includes:
55
parameters:
66
bootstrapFiles:
77
- ../vendor/autoload.php
8+
ignoreErrors:
9+
-
10+
message: '#^Method PhpCsFixerCustomFixers\\Analyzer\\Analysis\\ConstructorAnalysis\:\:getDuplicatesIndices\(\) should return array\<int, int\> but returns array\.$#'
11+
identifier: return.type
12+
count: 1
13+
path: ../src/Analyzer/Analysis/ConstructorAnalysis.php
14+
15+
-
16+
message: '#^Comparison operation "\>\=" between int\<80400, 80499\> and 70400 is always true\.$#'
17+
identifier: greaterOrEqual.alwaysTrue
18+
count: 1
19+
path: ../src/Fixer/NumericLiteralSeparatorFixer.php
20+
21+
-
22+
message: '#^Comparison operation "\>\=" between int\<80400, 80499\> and 80000 is always true\.$#'
23+
identifier: greaterOrEqual.alwaysTrue
24+
count: 1
25+
path: ../src/Fixer/PromotedConstructorPropertyFixer.php
26+
27+
-
28+
message: '#^Comparison operation "\>\=" between int\<80400, 80499\> and 80000 is always true\.$#'
29+
identifier: greaterOrEqual.alwaysTrue
30+
count: 1
31+
path: ../src/Fixer/StringableInterfaceFixer.php
32+
33+
-
34+
message: '#^Comparison operation "\>\=" between int\<80400, 80499\> and 70300 is always true\.$#'
35+
identifier: greaterOrEqual.alwaysTrue
36+
count: 1
37+
path: ../tests/Analyzer/FunctionAnalyzerTest.php
38+
39+
-
40+
message: '#^Parameter \#2 \$haystack of static method PHPUnit\\Framework\\Assert\:\:assertStringContainsString\(\) expects string, mixed given\.$#'
41+
identifier: argument.type
42+
count: 1
43+
path: ../tests/AutoReview/ChangelogTest.php
44+
45+
-
46+
message: '#^Method Tests\\AutoReview\\TestsCodeTest\:\:provideTestClassCases\(\) should return iterable\<string, array\{string, string\}\> but returns mixed\.$#'
47+
identifier: return.type
48+
count: 1
49+
path: ../tests/AutoReview/TestsCodeTest.php
50+
51+
-
52+
message: '#^Cannot call method check\(\) on mixed\.$#'
53+
identifier: method.nonObject
54+
count: 1
55+
path: ../tests/Fixer/AbstractFixerTestCase.php
56+
57+
-
58+
message: '#^Cannot call method lintSource\(\) on mixed\.$#'
59+
identifier: method.nonObject
60+
count: 1
61+
path: ../tests/Fixer/AbstractFixerTestCase.php
62+
63+
-
64+
message: '#^Comparison operation "\>\=" between int\<80400, 80499\> and 70300 is always true\.$#'
65+
identifier: greaterOrEqual.alwaysTrue
66+
count: 1
67+
path: ../tests/Fixer/NoUselessDirnameCallFixerTest.php
68+
69+
-
70+
message: '#^Comparison operation "\>\=" between int\<80400, 80499\> and 70400 is always true\.$#'
71+
identifier: greaterOrEqual.alwaysTrue
72+
count: 1
73+
path: ../tests/Fixer/PhpdocNoIncorrectVarAnnotationFixerTest.php
74+
75+
-
76+
message: '#^Method Tests\\FixersTest\:\:fixerNamesFromCollection\(\) should return array\<int, string\> but returns array\<string\>\.$#'
77+
identifier: return.type
78+
count: 1
79+
path: ../tests/FixersTest.php
80+
881
level: max
982
paths:
1083
- ../src

.github/workflows/ci.yaml

Lines changed: 10 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ jobs:
1919
- uses: actions/checkout@v4
2020
- uses: shivammathur/setup-php@v2
2121
with:
22-
php-version: '8.3'
22+
php-version: '8.4'
2323
extensions: none, curl, dom, json, mbstring, opcache, openssl, simplexml, tokenizer, xml, xmlwriter
2424
coverage: none
2525
- if: ${{ github.event_name != 'pull_request' }}
@@ -48,33 +48,35 @@ jobs:
4848
php-version: '8.1'
4949
- os: ubuntu-latest
5050
php-version: '8.2'
51+
- os: ubuntu-latest
52+
php-version: '8.3'
5153
- os: ubuntu-latest
5254
description: 'with calculating code coverage and Infection'
5355
calculate-coverage: true
5456
phpunit-flags: '--coverage-clover=./build/logs/clover.xml'
55-
php-version: '8.3'
57+
php-version: '8.4'
5658
FAST_LINT_TEST_CASES: 1
5759
- os: ubuntu-latest
5860
description: 'with PHP CS Fixer from master'
5961
with-php-cs-fixer-from-master: true
60-
php-version: '8.3'
62+
php-version: '8.4'
6163
- os: ubuntu-latest
6264
description: 'with shim package'
6365
use-shim-package: true
64-
php-version: '8.3'
66+
php-version: '8.4'
6567
- os: ubuntu-latest
6668
description: 'with bootstrap'
6769
with-bootstrap: true
68-
php-version: '8.3'
70+
php-version: '8.4'
6971
- os: macos-latest
7072
description: 'on macOS'
71-
php-version: '8.3'
73+
php-version: '8.4'
7274
- os: windows-latest
7375
description: 'on Windows'
74-
php-version: '8.3'
76+
php-version: '8.4'
7577
FAST_LINT_TEST_CASES: 1
7678
- os: ubuntu-latest
77-
php-version: '8.4'
79+
php-version: '8.5'
7880
runs-on: ${{ matrix.os }}
7981
timeout-minutes: 10
8082
env:

src/Fixer/NoDuplicatedImportsFixer.php

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -58,10 +58,8 @@ public function fix(\SplFileInfo $file, Tokens $tokens): void
5858
foreach ((new NamespacesAnalyzer())->getDeclarations($tokens) as $namespace) {
5959
$currentNamespaceUseDeclarations = \array_filter(
6060
$useDeclarations,
61-
static function (NamespaceUseAnalysis $useDeclaration) use ($namespace): bool {
62-
return $useDeclaration->getStartIndex() >= $namespace->getScopeStartIndex()
63-
&& $useDeclaration->getEndIndex() <= $namespace->getScopeEndIndex();
64-
},
61+
static fn (NamespaceUseAnalysis $useDeclaration): bool => $useDeclaration->getStartIndex() >= $namespace->getScopeStartIndex()
62+
&& $useDeclaration->getEndIndex() <= $namespace->getScopeEndIndex(),
6563
);
6664

6765
$foundDeclarations = [];

tests/Fixer/PhpUnitAssertArgumentsOrderFixerTest.php

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -38,14 +38,12 @@ public static function provideFixCases(): iterable
3838
{
3939
foreach (self::getFixCases() as $fixCase) {
4040
yield \array_map(
41-
static function (string $case): string {
42-
return \sprintf('<?php
41+
static fn (string $case): string => \sprintf('<?php
4342
class FooTest extends TestCase {
4443
public function testFoo() {
4544
%s
4645
}
47-
}', $case);
48-
},
46+
}', $case),
4947
$fixCase,
5048
);
5149
}

tests/Fixer/PhpUnitDedicatedAssertFixerTest.php

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -38,14 +38,12 @@ public static function provideFixCases(): iterable
3838
{
3939
foreach (self::getFixCases() as $name => $fixCase) {
4040
yield $name => \array_map(
41-
static function (string $case): string {
42-
return \sprintf('<?php
41+
static fn (string $case): string => \sprintf('<?php
4342
class FooTest extends TestCase {
4443
public function testFoo() {
4544
%s
4645
}
47-
}', $case);
48-
},
46+
}', $case),
4947
$fixCase,
5048
);
5149
}

tests/Fixer/PhpUnitNoUselessReturnFixerTest.php

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -38,14 +38,12 @@ public static function provideFixCases(): iterable
3838
{
3939
foreach (self::getFixCases() as $fixCase) {
4040
yield \array_map(
41-
static function (string $case): string {
42-
return \sprintf('<?php
41+
static fn (string $case): string => \sprintf('<?php
4342
class FooTest extends TestCase {
4443
public function testFoo() {
4544
%s
4645
}
47-
}', $case);
48-
},
46+
}', $case),
4947
$fixCase,
5048
);
5149
}

0 commit comments

Comments
 (0)