Rector is a FLOSS tool that instantly upgrades and refactors the PHP code of any PHP 5.3+ code.
https://github.com/rectorphp/rector
Documentation:
https://getrector.com/documentation
Configuration to be tested (please feel free to update as you test more):
```
<?php
// generated using `vendor/bin/rector init`
declare(strict_types=1);
use Rector\CodeQuality\Rector\Class_\InlineConstructorDefaultToPropertyRector;
use Rector\Config\RectorConfig;
use Rector\Set\ValueObject\LevelSetList;
use Rector\Core\ValueObject\PhpVersion;
return static function (RectorConfig $rectorConfig): void {
$rectorConfig->paths([
__DIR__ . '/conf',
__DIR__ . '/externals',
__DIR__ . '/resources',
__DIR__ . '/scripts',
__DIR__ . '/src',
__DIR__ . '/support',
__DIR__ . '/webroot',
]);
// https://getrector.com/documentation/import-names
// $rectorConfig->importNames();
$rectorConfig->phpVersion(PhpVersion::PHP_55);
$rectorConfig->sets( [
LevelSetList::UP_TO_PHP_81,
] );
};
```
To run it locally:
```
vendor/bin/rector process
```
WARNING: This could melt your CPU; nuke your storage; kill polar bears. Don't think that Greta Thunberg will be happy about this. Try only on an SSD. Try on `arcanist` first, not on Phorge.
Online demo:
https://getrector.com/demo
== Running on Arcanist ===
Some errors that maybe should be addressed when tryin to execute `vendor/bin/rector process` in Arcanist:
```
[ERROR] Could not process "arcanist/src/config/option/ArcanistAliasesConfigOption.php" file, due to:
"System error: "Syntax error, unexpected T_STRING, expecting T_VARIABLE6"
Run Rector with "--debug" option and post the report here: https://github.com/rectorphp/rector/issues/new". On line: 54
```
For the records line 54 is just the end of the file. There are multiple errors like that.