diff --git a/.gitattributes b/.gitattributes index ed26f59d..ef421eb6 100644 --- a/.gitattributes +++ b/.gitattributes @@ -10,6 +10,7 @@ /phpunit.xml.dist export-ignore /psalm-baseline.xml export-ignore /psalm.xml.dist export-ignore +/rector.php export-ignore /renovate.json export-ignore /test/ export-ignore /psalm/ export-ignore diff --git a/composer.json b/composer.json index 371b97de..a4f19316 100644 --- a/composer.json +++ b/composer.json @@ -48,6 +48,7 @@ "php-http/psr7-integration-tests": "^1.3", "phpunit/phpunit": "^9.5.28", "psalm/plugin-phpunit": "^0.18.4", + "rector/rector": "^0.17.0", "vimeo/psalm": "^5.9" }, "provide": { diff --git a/composer.lock b/composer.lock index 9f009192..dde367f6 100644 --- a/composer.lock +++ b/composer.lock @@ -4,7 +4,7 @@ "Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies", "This file is @generated automatically" ], - "content-hash": "f5e2677fceaed39db15d93cacd111d2a", + "content-hash": "72fc5e2cc181ac465ae72dfc7f56a937", "packages": [ { "name": "psr/http-factory", @@ -1562,6 +1562,68 @@ }, "time": "2022-05-05T11:32:40+00:00" }, + { + "name": "phpstan/phpstan", + "version": "1.10.15", + "source": { + "type": "git", + "url": "https://github.com/phpstan/phpstan.git", + "reference": "762c4dac4da6f8756eebb80e528c3a47855da9bd" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/phpstan/phpstan/zipball/762c4dac4da6f8756eebb80e528c3a47855da9bd", + "reference": "762c4dac4da6f8756eebb80e528c3a47855da9bd", + "shasum": "" + }, + "require": { + "php": "^7.2|^8.0" + }, + "conflict": { + "phpstan/phpstan-shim": "*" + }, + "bin": [ + "phpstan", + "phpstan.phar" + ], + "type": "library", + "autoload": { + "files": [ + "bootstrap.php" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "description": "PHPStan - PHP Static Analysis Tool", + "keywords": [ + "dev", + "static analysis" + ], + "support": { + "docs": "https://phpstan.org/user-guide/getting-started", + "forum": "https://github.com/phpstan/phpstan/discussions", + "issues": "https://github.com/phpstan/phpstan/issues", + "security": "https://github.com/phpstan/phpstan/security/policy", + "source": "https://github.com/phpstan/phpstan-src" + }, + "funding": [ + { + "url": "https://github.com/ondrejmirtes", + "type": "github" + }, + { + "url": "https://github.com/phpstan", + "type": "github" + }, + { + "url": "https://tidelift.com/funding/github/packagist/phpstan/phpstan", + "type": "tidelift" + } + ], + "time": "2023-05-09T15:28:01+00:00" + }, { "name": "phpunit/php-code-coverage", "version": "9.2.26", @@ -2146,6 +2208,67 @@ }, "time": "2021-07-14T16:46:02+00:00" }, + { + "name": "rector/rector", + "version": "0.17.0", + "source": { + "type": "git", + "url": "https://github.com/rectorphp/rector.git", + "reference": "d8da002b107c9b64d464bb48101290d4d078df4b" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/rectorphp/rector/zipball/d8da002b107c9b64d464bb48101290d4d078df4b", + "reference": "d8da002b107c9b64d464bb48101290d4d078df4b", + "shasum": "" + }, + "require": { + "php": "^7.2|^8.0", + "phpstan/phpstan": "^1.10.15" + }, + "conflict": { + "rector/rector-doctrine": "*", + "rector/rector-downgrade-php": "*", + "rector/rector-phpunit": "*", + "rector/rector-symfony": "*" + }, + "bin": [ + "bin/rector" + ], + "type": "library", + "extra": { + "branch-alias": { + "dev-main": "0.15-dev" + } + }, + "autoload": { + "files": [ + "bootstrap.php" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "description": "Instant Upgrade and Automated Refactoring of any PHP code", + "keywords": [ + "automation", + "dev", + "migration", + "refactoring" + ], + "support": { + "issues": "https://github.com/rectorphp/rector/issues", + "source": "https://github.com/rectorphp/rector/tree/0.17.0" + }, + "funding": [ + { + "url": "https://github.com/tomasvotruba", + "type": "github" + } + ], + "time": "2023-06-01T09:42:59+00:00" + }, { "name": "sebastian/cli-parser", "version": "1.0.1", diff --git a/phpcs.xml b/phpcs.xml index 6ce2a0b0..2d3e8228 100644 --- a/phpcs.xml +++ b/phpcs.xml @@ -13,6 +13,7 @@ + rector.php src test diff --git a/psalm.xml.dist b/psalm.xml.dist index 28ed3276..885fedb7 100644 --- a/psalm.xml.dist +++ b/psalm.xml.dist @@ -10,6 +10,7 @@ errorBaseline="psalm-baseline.xml" > + diff --git a/rector.php b/rector.php new file mode 100644 index 00000000..8fb06624 --- /dev/null +++ b/rector.php @@ -0,0 +1,19 @@ +paths([ + __DIR__ . '/src', + __DIR__ . '/test', + ]); + + // Define set list to upgrade PHP + $rectorConfig->sets([ + LevelSetList::UP_TO_PHP_80, + ]); +};