-
Notifications
You must be signed in to change notification settings - Fork 37
Expand file tree
/
Copy pathrector.php
More file actions
97 lines (93 loc) · 4.65 KB
/
rector.php
File metadata and controls
97 lines (93 loc) · 4.65 KB
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
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
<?php
/**
* -------------------------------------------------------------------------
* Example plugin for GLPI
* -------------------------------------------------------------------------
*
* LICENSE
*
* This file is part of Example.
*
* Example is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* Example is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with Example. If not, see <http://www.gnu.org/licenses/>.
* -------------------------------------------------------------------------
* @copyright Copyright (C) 2006-2022 by Example plugin team.
* @license GPLv2 https://www.gnu.org/licenses/gpl-2.0.html
* @link https://github.com/pluginsGLPI/example
* -------------------------------------------------------------------------
*/
require_once __DIR__ . '/../../src/Plugin.php';
use Rector\Caching\ValueObject\Storage\FileCacheStorage;
use Rector\CodeQuality\Rector as CodeQuality;
use Rector\Config\RectorConfig;
use Rector\DeadCode\Rector as DeadCode;
use Rector\ValueObject\PhpVersion;
return RectorConfig::configure()
->withPaths([
__DIR__ . '/front',
__DIR__ . '/src',
])
->withPhpVersion(PhpVersion::PHP_82)
->withCache(
cacheClass: FileCacheStorage::class,
cacheDirectory: sys_get_temp_dir() . '/example-rector',
)
->withRootFiles()
->withParallel(timeoutSeconds: 300)
->withImportNames(removeUnusedImports: true)
->withRules([
CodeQuality\Assign\CombinedAssignRector::class,
CodeQuality\BooleanAnd\RemoveUselessIsObjectCheckRector::class,
CodeQuality\BooleanAnd\SimplifyEmptyArrayCheckRector::class,
CodeQuality\BooleanNot\ReplaceMultipleBooleanNotRector::class,
CodeQuality\Catch_\ThrowWithPreviousExceptionRector::class,
CodeQuality\Empty_\SimplifyEmptyCheckOnEmptyArrayRector::class,
CodeQuality\Expression\InlineIfToExplicitIfRector::class,
CodeQuality\Expression\TernaryFalseExpressionToIfRector::class,
CodeQuality\For_\ForRepeatedCountToOwnVariableRector::class,
CodeQuality\Foreach_\ForeachItemsAssignToEmptyArrayToAssignRector::class,
CodeQuality\Foreach_\ForeachToInArrayRector::class,
CodeQuality\Foreach_\SimplifyForeachToCoalescingRector::class,
CodeQuality\Foreach_\UnusedForeachValueToArrayKeysRector::class,
CodeQuality\FuncCall\ChangeArrayPushToArrayAssignRector::class,
CodeQuality\FuncCall\CompactToVariablesRector::class,
CodeQuality\FuncCall\InlineIsAInstanceOfRector::class,
CodeQuality\FuncCall\IsAWithStringWithThirdArgumentRector::class,
CodeQuality\FuncCall\RemoveSoleValueSprintfRector::class,
CodeQuality\FuncCall\SetTypeToCastRector::class,
CodeQuality\FuncCall\SimplifyFuncGetArgsCountRector::class,
CodeQuality\FuncCall\SimplifyInArrayValuesRector::class,
CodeQuality\FuncCall\SimplifyStrposLowerRector::class,
CodeQuality\FuncCall\UnwrapSprintfOneArgumentRector::class,
CodeQuality\Identical\BooleanNotIdenticalToNotIdenticalRector::class,
CodeQuality\Identical\SimplifyArraySearchRector::class,
CodeQuality\Identical\SimplifyConditionsRector::class,
CodeQuality\Identical\StrlenZeroToIdenticalEmptyStringRector::class,
CodeQuality\If_\CombineIfRector::class,
CodeQuality\If_\CompleteMissingIfElseBracketRector::class,
CodeQuality\If_\ConsecutiveNullCompareReturnsToNullCoalesceQueueRector::class,
CodeQuality\If_\ExplicitBoolCompareRector::class,
CodeQuality\If_\ShortenElseIfRector::class,
CodeQuality\If_\SimplifyIfElseToTernaryRector::class,
CodeQuality\If_\SimplifyIfNotNullReturnRector::class,
CodeQuality\If_\SimplifyIfNullableReturnRector::class,
CodeQuality\If_\SimplifyIfReturnBoolRector::class,
CodeQuality\Include_\AbsolutizeRequireAndIncludePathRector::class,
CodeQuality\LogicalAnd\AndAssignsToSeparateLinesRector::class,
CodeQuality\LogicalAnd\LogicalToBooleanRector::class,
CodeQuality\NotEqual\CommonNotEqualRector::class,
CodeQuality\Ternary\UnnecessaryTernaryExpressionRector::class,
DeadCode\Assign\RemoveUnusedVariableAssignRector::class,
])
->withPhpSets(php74: true) // apply PHP sets up to PHP 7.4
;