-
Notifications
You must be signed in to change notification settings - Fork 172
/
Copy pathrector.php
69 lines (59 loc) · 1.97 KB
/
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
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
<?php
/**
* @file
* Rector config for DKAN.
*
* To use this file:
* - Require palantirnet/drupal-rector into your project root composer.json
* file: composer require --dev palantirnet/drupal-rector
* - Add the following to the script section of your project composer.json:
*
* "scripts": {
* "rector": "./vendor/bin/rector -c \
* ./docroot/modules/contrib/dkan/rector.php",
* "rector-dry-run": "./vendor/bin/rector -c \
* ./docroot/modules/contrib/dkan/rector.php --dry-run"
* }
*
* Now you can say: composer rector-dry-run, and eventually: composer rector.
*/
declare(strict_types=1);
use DrupalFinder\DrupalFinderComposerRuntime;
use DrupalRector\Set\Drupal10SetList;
use Rector\Config\RectorConfig;
use Rector\Php80\Rector\Class_\ClassPropertyAssignToConstructorPromotionRector;
use Rector\Set\ValueObject\SetList;
return static function (RectorConfig $rectorConfig): void {
// Rector-ize this repo.
$rectorConfig->paths([
__DIR__,
]);
$rectorConfig->sets([
Drupal10SetList::DRUPAL_10,
SetList::PHP_80,
SetList::DEAD_CODE,
]);
$rectorConfig->skip([
// Don't change the signature of these service classes.
// @todo Unskip these later.
'*/modules/datastore/src/Service/Info/ImportInfo.php',
'*/modules/frontend/src/Routing/RouteProvider.php',
'*/modules/frontend/src/Page.php',
ClassPropertyAssignToConstructorPromotionRector::class,
]);
$drupalFinder = new DrupalFinderComposerRuntime(__DIR__);
$drupalRoot = $drupalFinder->getDrupalRoot();
$rectorConfig->autoloadPaths([
$drupalRoot . '/core',
$drupalRoot . '/modules',
$drupalRoot . '/profiles',
$drupalRoot . '/themes',
]);
$rectorConfig->skip(['*/upgrade_status/tests/modules/*']);
$rectorConfig->fileExtensions([
'php', 'module', 'theme', 'install', 'profile', 'inc', 'engine',
]);
// @todo Add removeUnusedImports().
$rectorConfig->importNames(TRUE, FALSE);
$rectorConfig->importShortClasses(FALSE);
};