Passed
Push — issue/679 ( 2943ea )
by Tomas Norre
17:49 queued 02:16
created

anonymous()

Size

Total Lines 69
Code Lines 44

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
eloc 44
nc 1
nop 1
dl 0
loc 69
c 0
b 0
f 0

How to fix   Long Method   

Long Method

Small methods make your code easier to understand, in particular if combined with a good name. Besides, if your method is small, finding a good name is usually much easier.

For example, if you find yourself adding comments to a method's body, this is usually a good sign to extract the commented part to a new method, and use the comment as a starting point when coming up with a good name for this new method.

Commonly applied refactorings include:

1
<?php
2
3
declare(strict_types=1);
4
5
use PHP_CodeSniffer\Standards\Generic\Sniffs\Metrics\CyclomaticComplexitySniff;
6
use PhpCsFixer\Fixer\ArrayNotation\ArraySyntaxFixer;
7
use PhpCsFixer\Fixer\Import\NoLeadingImportSlashFixer;
8
use PhpCsFixer\Fixer\Import\NoUnusedImportsFixer;
9
use PhpCsFixer\Fixer\Import\OrderedImportsFixer;
10
use PhpCsFixer\Fixer\Operator\BinaryOperatorSpacesFixer;
11
use PhpCsFixer\Fixer\Operator\ConcatSpaceFixer;
12
use PhpCsFixer\Fixer\Operator\TernaryOperatorSpacesFixer;
13
use PhpCsFixer\Fixer\Operator\UnaryOperatorSpacesFixer;
14
use PhpCsFixer\Fixer\PhpUnit\PhpUnitStrictFixer;
15
use PhpCsFixer\Fixer\PhpUnit\PhpUnitTestAnnotationFixer;
16
use PhpCsFixer\Fixer\Phpdoc\AlignMultilineCommentFixer;
17
use PhpCsFixer\Fixer\Phpdoc\GeneralPhpdocAnnotationRemoveFixer;
18
use PhpCsFixer\Fixer\Phpdoc\NoBlankLinesAfterPhpdocFixer;
19
use PhpCsFixer\Fixer\Whitespace\NoExtraBlankLinesFixer;
20
use Symfony\Component\DependencyInjection\Loader\Configurator\ContainerConfigurator;
21
use Symplify\CodingStandard\Fixer\ArrayNotation\StandaloneLineInMultilineArrayFixer;
22
use Symplify\EasyCodingStandard\ValueObject\Option;
23
use Symplify\EasyCodingStandard\ValueObject\Set\SetList;
24
25
return static function (ContainerConfigurator $containerConfigurator): void {
26
    $parameters = $containerConfigurator->parameters();
27
28
    $parameters->set(
29
        Option::SETS,
0 ignored issues
show
Deprecated Code introduced by
The constant Symplify\EasyCodingStand...alueObject\Option::SETS has been deprecated: Use $containerConfigurator->import(...) instead ( Ignorable by Annotation )

If this is a false-positive, you can also ignore this issue in your code via the ignore-deprecated  annotation

29
        /** @scrutinizer ignore-deprecated */ Option::SETS,

This class constant has been deprecated. The supplier of the class has supplied an explanatory message.

The explanatory message should give you some clue as to whether and when the constant will be removed from the class and what other constant to use instead.

Loading history...
30
        [
31
            SetList::PSR_12,
32
            SetList::COMMON
33
        ]
34
    );
35
36
    $parameters->set(Option::SKIP,
37
        [
38
            __DIR__ . '/Tests/Acceptance/Support/_generated',
39
            'PhpCsFixer\Fixer\Whitespace\ArrayIndentationFixer' => null,
40
            'PhpCsFixer\Fixer\FunctionNotation\MethodArgumentSpaceFixer' => null,
41
            'PHP_CodeSniffer\Standards\Generic\Sniffs\CodeAnalysis\AssignmentInConditionSniff.FoundInWhileCondition' => null,
42
            PhpUnitStrictFixer::class => null,
43
            PhpUnitTestAnnotationFixer::class => null,
44
            'SlevomatCodingStandard\Sniffs\Classes\TraitUseSpacingSniff.IncorrectLinesCountAfterLastUse' => null,
45
            'Symplify\CodingStandard\Fixer\ArrayNotation\ArrayOpenerAndCloserNewlineFixer' => null,
46
            'Symplify\CodingStandard\Fixer\ArrayNotation\ArrayListItemNewlineFixer' => null,
47
            UnaryOperatorSpacesFixer::class => null,
48
            StandaloneLineInMultilineArrayFixer::class => null,
49
        ]
50
    );
51
52
    $parameters->set(
53
        Option::PATHS,
54
        [
55
            __DIR__ . '/Classes',
56
            __DIR__ . '/Configuration',
57
            __DIR__ . '/Tests',
58
        ]
59
    );
60
61
    $services = $containerConfigurator->services();
62
63
    $services->set(ArraySyntaxFixer::class)
64
        ->call('configure', [['syntax' => 'short']]);
65
66
    $services->set(ConcatSpaceFixer::class)
67
        ->call('configure', [['spacing' => 'one']]);
68
69
    $services->set(BinaryOperatorSpacesFixer::class)
70
        ->call('configure', [['default' => 'single_space']]);
71
72
    $services->set(NoExtraBlankLinesFixer::class);
73
74
    $services->set(TernaryOperatorSpacesFixer::class);
75
76
    $services->set(NoBlankLinesAfterPhpdocFixer::class);
77
78
    $services->set(AlignMultilineCommentFixer::class)
79
        ->call('configure', [['comment_type' => 'phpdocs_only']]);
80
81
    $services->set(GeneralPhpdocAnnotationRemoveFixer::class)
82
        ->call('configure', [['annotations' => ['author', 'since']]]);
83
84
    $services->set(NoLeadingImportSlashFixer::class);
85
86
    $services->set(NoUnusedImportsFixer::class);
87
88
    $services->set(OrderedImportsFixer::class)
89
        ->call('configure', [['imports_order' => ['class', 'const', 'function']]]);
90
91
    $services->set(CyclomaticComplexitySniff::class)
92
        ->property('complexity', 20)
93
        ->property('absoluteComplexity', 20);
94
};
95