forked from wenbinye/openapi-rector
-
Notifications
You must be signed in to change notification settings - Fork 0
/
rector.php
30 lines (26 loc) · 1001 Bytes
/
rector.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
<?php
declare(strict_types=1);
use Rector\Config\RectorConfig;
spl_autoload_register(static function ($class) {
if (str_starts_with($class, 'Utils\\Rector\\')) {
$parts = explode('\\', $class);
$file = __DIR__ . '/utils/rector/src/' . implode('/', array_slice($parts, 2)) . '.php';
echo $file, "\n";
if (file_exists($file)) {
include $file;
return true;
}
}
return false;
});
return static function (RectorConfig $rectorConfig): void {
$servicesConfigurator = $rectorConfig->services();
$servicesConfigurator->defaults()->public()->autowire()->autoconfigure();
$sourceRoot = __DIR__ . '/utils/rector/src';
$servicesConfigurator->load('Utils\\Rector\\', $sourceRoot)
->exclude([
$sourceRoot . '/OpenApiTagValueNode.php',
$sourceRoot . '/OpenApiTagAndAnnotationToAttribute.php'
]);
$rectorConfig->rule(\Utils\Rector\OpenapiAnnotationToAttributeRector::class);
};