2020-07-16 13:07:08 +02:00
|
|
|
<?php
|
|
|
|
|
2021-05-09 20:15:43 +00:00
|
|
|
declare (strict_types=1);
|
2024-09-01 00:37:22 +00:00
|
|
|
namespace RectorPrefix202409;
|
2020-07-16 13:07:08 +02:00
|
|
|
|
2024-09-01 00:37:22 +00:00
|
|
|
use RectorPrefix202409\OndraM\CiDetector\CiDetector;
|
2024-01-02 02:40:38 +00:00
|
|
|
use Rector\Bootstrap\ExtensionConfigResolver;
|
2022-06-06 17:12:56 +00:00
|
|
|
use Rector\Caching\ValueObject\Storage\MemoryCacheStorage;
|
|
|
|
use Rector\Config\RectorConfig;
|
2022-06-07 08:22:29 +00:00
|
|
|
return static function (RectorConfig $rectorConfig) : void {
|
2022-05-27 13:38:07 +00:00
|
|
|
$rectorConfig->paths([]);
|
|
|
|
$rectorConfig->skip([]);
|
|
|
|
$rectorConfig->autoloadPaths([]);
|
|
|
|
$rectorConfig->bootstrapFiles([]);
|
2023-09-10 12:29:23 +00:00
|
|
|
$rectorConfig->parallel();
|
2022-12-03 10:17:25 +00:00
|
|
|
// to avoid autoimporting out of the box
|
2022-12-03 10:25:04 +00:00
|
|
|
$rectorConfig->importNames(\false, \false);
|
2023-02-08 15:30:12 +00:00
|
|
|
$rectorConfig->removeUnusedImports(\false);
|
2022-05-27 13:38:07 +00:00
|
|
|
$rectorConfig->importShortClasses();
|
2022-06-06 09:59:48 +00:00
|
|
|
$rectorConfig->indent(' ', 4);
|
2022-05-27 13:38:07 +00:00
|
|
|
$rectorConfig->fileExtensions(['php']);
|
|
|
|
$rectorConfig->cacheDirectory(\sys_get_temp_dir() . '/rector_cached_files');
|
2023-03-19 20:28:32 +00:00
|
|
|
$rectorConfig->containerCacheDirectory(\sys_get_temp_dir());
|
2022-05-27 13:38:07 +00:00
|
|
|
// use faster in-memory cache in CI.
|
|
|
|
// CI always starts from scratch, therefore IO intensive caching is not worth it
|
2023-08-15 22:27:51 +00:00
|
|
|
if ((new CiDetector())->isCiDetected()) {
|
2022-06-07 08:22:29 +00:00
|
|
|
$rectorConfig->cacheClass(MemoryCacheStorage::class);
|
2022-05-27 13:38:07 +00:00
|
|
|
}
|
2023-09-09 10:50:11 +00:00
|
|
|
// load internal rector-* extension configs
|
2022-06-07 08:22:29 +00:00
|
|
|
$extensionConfigResolver = new ExtensionConfigResolver();
|
2023-09-09 10:50:11 +00:00
|
|
|
foreach ($extensionConfigResolver->provide() as $extensionConfigFile) {
|
2022-09-01 09:30:44 +00:00
|
|
|
$rectorConfig->import($extensionConfigFile);
|
2021-03-19 21:29:10 +01:00
|
|
|
}
|
2024-03-28 16:05:42 +00:00
|
|
|
// use original php-parser printer to avoid BC break on fluent call
|
|
|
|
$rectorConfig->newLineOnFluentCall(\false);
|
2024-08-05 20:48:53 +00:00
|
|
|
// allow real paths in output formatters
|
|
|
|
$rectorConfig->reportingRealPath(\false);
|
2020-07-16 13:07:08 +02:00
|
|
|
};
|