-
Notifications
You must be signed in to change notification settings - Fork 0
/
rector.php
58 lines (46 loc) · 2.01 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
<?php
/**
* This file is part of the streak-bundle package.
*
* (C) Alan Gabriel Bem <[email protected]>
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
declare(strict_types=1);
use Rector\CodeQuality\Rector\FuncCall\SingleInArrayToCompareRector;
use Rector\CodeQuality\Rector\FuncCall\UnwrapSprintfOneArgumentRector;
use Rector\Core\Configuration\Option;
use Rector\PHPUnit\Set\PHPUnitSetList;
use Rector\Set\ValueObject\SetList;
use Symfony\Component\DependencyInjection\Loader\Configurator\ContainerConfigurator;
return static function (ContainerConfigurator $configurator): void {
// get parameters
$parameters = $configurator->parameters();
// Define what rule sets will be applied
$configurator->import(PHPUnitSetList::PHPUNIT_91);
$configurator->import(PHPUnitSetList::PHPUNIT_CODE_QUALITY);
$configurator->import(PHPUnitSetList::PHPUNIT_EXCEPTION);
$configurator->import(PHPUnitSetList::PHPUNIT_MOCK);
$configurator->import(PHPUnitSetList::PHPUNIT_SPECIFIC_METHOD);
$configurator->import(PHPUnitSetList::PHPUNIT_YIELD_DATA_PROVIDER);
$configurator->import(SetList::CODE_QUALITY);
$configurator->import(SetList::EARLY_RETURN);
$configurator->import(SetList::PHP_74);
$configurator->import(SetList::PHP_80);
// $configurator->import(SetList::PRIVATIZATION);
$parameters->set(Option::SKIP, [
]);
// skip root namespace classes, like \DateTime or \Exception [default: true]
$parameters->set(Option::IMPORT_SHORT_CLASSES, true);
// paths to refactor; solid alternative to CLI arguments
$parameters->set(Option::PATHS, [
__DIR__ . '/src',
]);
// Run Rector only on changed files
$parameters->set(Option::ENABLE_CACHE, true);
$parameters->set(Option::CACHE_DIR, __DIR__ . '/build/.rector');
$services = $configurator->services();
$services->set(UnwrapSprintfOneArgumentRector::class);
$services->set(SingleInArrayToCompareRector::class);
};