Skip to content

Commit 4c92975

Browse files
committed
phpstan: Upgrade to version 2
https://github.com/phpstan/phpstan/blob/2.1.x/UPGRADING.md Required also bumping Rector since it uses PHPStan internally.
1 parent 1d7cdf3 commit 4c92975

File tree

3 files changed

+10
-25
lines changed

3 files changed

+10
-25
lines changed

composer.json

+3-3
Original file line numberDiff line numberDiff line change
@@ -33,9 +33,9 @@
3333
"friendsofphp/php-cs-fixer": "^3.0",
3434
"monolog/monolog": "^1.24|^2.1",
3535
"symfony/phpunit-bridge": "^4.4|^5.3|^6.0",
36-
"phpstan/phpstan": "^1.3",
37-
"phpstan/phpstan-phpunit": "^1.0",
38-
"rector/rector": "^0.15.0"
36+
"phpstan/phpstan": "^2.0",
37+
"phpstan/phpstan-phpunit": "^2.0",
38+
"rector/rector": "^2.0.0"
3939
},
4040
"suggest": {
4141
"ext-tidy": "Used to clean up given HTML and to avoid problems with bad HTML structure."

phpstan.dist.neon

-2
Original file line numberDiff line numberDiff line change
@@ -8,8 +8,6 @@ parameters:
88
bootstrapFiles:
99
- vendor/bin/.phpunit/phpunit/vendor/autoload.php
1010

11-
checkMissingIterableValueType: false
12-
1311
includes:
1412
- vendor/phpstan/phpstan-phpunit/extension.neon
1513
- vendor/phpstan/phpstan-phpunit/rules.neon

rector.php

+7-20
Original file line numberDiff line numberDiff line change
@@ -3,29 +3,16 @@
33
declare(strict_types=1);
44

55
use Rector\Config\RectorConfig;
6-
use Rector\Core\ValueObject\PhpVersion;
76
use Rector\Set\ValueObject\LevelSetList;
87

9-
return static function (RectorConfig $rectorConfig): void {
10-
// paths to refactor; solid alternative to CLI arguments
11-
$rectorConfig->paths([
8+
return RectorConfig::configure()
9+
->withPaths([
1210
__DIR__ . '/src',
1311
__DIR__ . '/tests',
14-
]);
15-
16-
// Path to phpstan with extensions, that PHPSTan in Rector uses to determine types
17-
$rectorConfig->phpstanConfig(__DIR__ . '/phpstan.neon');
18-
19-
$rectorConfig->bootstrapFiles([
12+
])
13+
->withBootstrapFiles([
2014
__DIR__ . '/vendor/bin/.phpunit/phpunit/vendor/autoload.php',
2115
__DIR__ . '/vendor/autoload.php',
22-
]);
23-
24-
// Define what rule sets will be applied
25-
$rectorConfig->sets([
26-
LevelSetList::UP_TO_PHP_74,
27-
]);
28-
29-
// is your PHP version different from the one your refactor to?
30-
$rectorConfig->phpVersion(PhpVersion::PHP_74);
31-
};
16+
])
17+
->withSets([LevelSetList::UP_TO_PHP_74])
18+
;

0 commit comments

Comments
 (0)