-
-
Notifications
You must be signed in to change notification settings - Fork 14
/
Copy pathecs.php
54 lines (45 loc) · 2.14 KB
/
ecs.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
<?php
declare(strict_types=1);
use PhpCsFixer\Fixer\ClassNotation\ClassAttributesSeparationFixer;
use SlevomatCodingStandard\Sniffs\TypeHints\ParameterTypeHintSniff;
use SlevomatCodingStandard\Sniffs\TypeHints\PropertyTypeHintSniff;
use SlevomatCodingStandard\Sniffs\TypeHints\ReturnTypeHintSniff;
use Symplify\EasyCodingStandard\Config\ECSConfig;
use Symplify\EasyCodingStandard\ValueObject\Option;
use Symplify\EasyCodingStandard\ValueObject\Set\SetList;
return static function (ECSConfig $containerConfigurator): void {
$containerConfigurator->import(SetList::PSR_12);
$containerConfigurator->import(SetList::SYMPLIFY);
$containerConfigurator->import(SetList::COMMON);
$containerConfigurator->import(SetList::CLEAN_CODE);
$containerConfigurator->ruleWithConfiguration(ClassAttributesSeparationFixer::class, [
'elements' => [
'const' => 'only_if_meta',
'property' => 'one',
'method' => 'one',
],
]);
// disable features not available pn PHP 7.4
$typeHintsConfig = [
'enableMixedTypeHint' => false,
'enableUnionTypeHint' => false,
'enableIntersectionTypeHint' => false,
'enableStandaloneNullTrueFalseTypeHints' => false,
];
$containerConfigurator->ruleWithConfiguration(PropertyTypeHintSniff::class, $typeHintsConfig);
$containerConfigurator->ruleWithConfiguration(ParameterTypeHintSniff::class, $typeHintsConfig);
$containerConfigurator->ruleWithConfiguration(ReturnTypeHintSniff::class, $typeHintsConfig + [
'enableNeverTypeHint' => false,
]);
$containerConfigurator->skip([
PropertyTypeHintSniff::class . '.MissingTraversableTypeHintSpecification' => null,
ParameterTypeHintSniff::class . '.MissingTraversableTypeHintSpecification' => null,
ReturnTypeHintSniff::class . '.MissingTraversableTypeHintSpecification' => null,
]);
$containerConfigurator->parameters()
->set(Option::PARALLEL, false);
$containerConfigurator->cacheDirectory('/tmp/ecs');
$containerConfigurator->paths(
[__DIR__ . '/src', __DIR__ . '/tests', __DIR__ . '/ecs.php', __DIR__ . '/rector.php']
);
};