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
declare(strict_types=1);
use Rector\Config\RectorConfig;
use Rector\Set\ValueObject\LevelSetList;
use Rector\Core\ValueObject\PhpVersion;
return static function (RectorConfig $rectorConfig): void {
$rectorConfig->paths([
__DIR__ . '/externals',
__DIR__ . '/scripts',
__DIR__ . '/src',
__DIR__ . '/support',
]);
// https://getrector.com/documentation/import-names
// $rectorConfig->importNames();
// https://we.phorge.it/book/phorge/article/installation_guide/
$rectorConfig->phpVersion(PhpVersion::PHP_55);
$rectorConfig->skip([
// for some reasons we want long "array()" instead of "[]"...
// https://we.phorge.it/book/contrib/article/php_coding_standards/
Rector\Php54\Rector\Array_\LongArrayToShortArrayRector:class,
]);
$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.