Skip to content

Commit

Permalink
Bump Rector v2 (#48)
Browse files Browse the repository at this point in the history
* Update for PHPStan 2.0

* Bump to PHPStan 2

* tidy up

---------

Co-authored-by: Carlos Granados <[email protected]>
Co-authored-by: Tomas Votruba <[email protected]>
  • Loading branch information
3 people authored Dec 12, 2024
1 parent 7c6d267 commit 2ce1475
Show file tree
Hide file tree
Showing 10 changed files with 22 additions and 19 deletions.
10 changes: 5 additions & 5 deletions .github/workflows/downgraded_release.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -20,12 +20,12 @@ jobs:

- uses: "ramsey/composer-install@v2"

# downgrade /src to PHP 7.2
- run: vendor/bin/rector process src --config build/rector-downgrade-php-72.php --ansi
# downgrade /src to PHP 7.4
- run: vendor/bin/rector process src --config build/rector-downgrade-php-74.php --ansi
- run: vendor/bin/ecs check src --fix --ansi

# copy PHP 7.2 composer
- run: cp build/composer-php-72.json composer.json
# copy PHP 7.4 composer
- run: cp build/composer-php-74.json composer.json

# clear the dev files
- run: rm -rf build .github tests stubs ecs.php phpstan.neon phpunit.xml
Expand All @@ -42,7 +42,7 @@ jobs:
run: |
# separate a "git add" to add untracked (new) files too
git add --all
git commit -m "release PHP 7.2 downgraded"
git commit -m "release PHP 7.4 downgraded"
# force push tag, so there is only 1 version
git tag "${GITHUB_REF#refs/tags/}" --force
Expand Down
4 changes: 2 additions & 2 deletions build/composer-php-72.json → build/composer-php-74.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,8 @@
"license": "MIT",
"keywords": ["static analysis", "phpstan-extension"],
"require": {
"php": "^7.2 || ^8.0",
"phpstan/phpstan": "^1.9.3",
"php": "^7.4 || ^8.0",
"phpstan/phpstan": "^2.0",
"nette/utils": "^3.2 || ^4.0"
},
"autoload": {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,5 +6,5 @@
use Rector\Set\ValueObject\DowngradeLevelSetList;

return static function (RectorConfig $rectorConfig): void {
$rectorConfig->sets([DowngradeLevelSetList::DOWN_TO_PHP_72]);
$rectorConfig->sets([DowngradeLevelSetList::DOWN_TO_PHP_74]);
};
12 changes: 6 additions & 6 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,15 +6,15 @@
"keywords": ["static analysis", "phpstan-extension"],
"require": {
"php": "^8.2",
"phpstan/phpstan": "^1.10.67"
"phpstan/phpstan": "^2.0.3"
},
"require-dev": {
"phpstan/extension-installer": "^1.3",
"phpunit/phpunit": "^10.5",
"symplify/easy-coding-standard": "^12.1",
"rector/rector": "^1.0.4",
"phpstan/extension-installer": "^1.4",
"phpunit/phpunit": "^11.5",
"symplify/easy-coding-standard": "^12.4",
"rector/rector": "^2.0",
"tracy/tracy": "^2.10",
"tomasvotruba/unused-public": "^0.2"
"tomasvotruba/unused-public": "^2.0"
},
"autoload": {
"psr-4": {
Expand Down
3 changes: 3 additions & 0 deletions phpstan.neon
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,9 @@ parameters:
ignoreErrors:
- identifier: missingType.generics

# used in tests
- message: '#Public constant "TomasVotruba\\TypeCoverage\\(.*?)::ERROR_MESSAGE" is never#'

excludePaths:
- "*/Fixture/*"
- "*/Source/*"
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ public static function setUpBeforeClass(): void

/**
* @param string[] $filePaths
* @param mixed[] $expectedErrorsWithLines
* @param list<array{0: string, 1: int, 2?: string|null}> $expectedErrorsWithLines
*/
#[DataProvider('provideData')]
public function testRule(array $filePaths, array $expectedErrorsWithLines): void
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ final class DeclareCoverageRuleTest extends RuleTestCase
{
/**
* @param string[] $filePaths
* @param mixed[] $expectedErrorsWithLines
* @param list<array{0: string, 1: int, 2?: string|null}> $expectedErrorsWithLines
*/
#[DataProvider('provideData')]
public function testRule(array $filePaths, array $expectedErrorsWithLines): void
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ final class ParamTypeCoverageRuleTest extends RuleTestCase
{
/**
* @param string[] $filePaths
* @param mixed[] $expectedErrorsWithLines
* @param list<array{0: string, 1: int, 2?: string|null}> $expectedErrorsWithLines
*/
#[DataProvider('provideData')]
public function testRule(array $filePaths, array $expectedErrorsWithLines): void
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ final class PropertyTypeCoverageRuleTest extends RuleTestCase
{
/**
* @param string[] $filePaths
* @param mixed[] $expectedErrorsWithLines
* @param list<array{0: string, 1: int, 2?: string|null}> $expectedErrorsWithLines
*/
#[DataProvider('provideData')]
public function testRule(array $filePaths, array $expectedErrorsWithLines): void
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ final class ReturnTypeCoverageRuleTest extends RuleTestCase
{
/**
* @param string[] $filePaths
* @param mixed[] $expectedErrorsWithLines
* @param list<array{0: string, 1: int, 2?: string|null}> $expectedErrorsWithLines
*/
#[DataProvider('provideData')]
public function testRule(array $filePaths, array $expectedErrorsWithLines): void
Expand Down

0 comments on commit 2ce1475

Please sign in to comment.