anonymous()
last analyzed

Size

Total Lines 52
Code Lines 38

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
eloc 38
nc 1
nop 1
dl 0
loc 52
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 MonorepoBuilder\MostRecentTagResolver;
6
use MonorepoBuilder\ProcessParser;
7
use MonorepoBuilder\TagParserInterface;
8
use MonorepoBuilder\ValidateVersionReleaseWorker;
9
use Symfony\Component\DependencyInjection\Loader\Configurator\ContainerConfigurator;
10
use Symplify\MonorepoBuilder\Contract\Git\TagResolverInterface;
11
use Symplify\MonorepoBuilder\ValueObject\Option;
12
use Symplify\MonorepoBuilder\Release\ReleaseWorker\AddTagToChangelogReleaseWorker;
13
use Symplify\MonorepoBuilder\Release\ReleaseWorker\PushNextDevReleaseWorker;
14
use Symplify\MonorepoBuilder\Release\ReleaseWorker\PushTagReleaseWorker;
15
use Symplify\MonorepoBuilder\Release\ReleaseWorker\SetCurrentMutualDependenciesReleaseWorker;
16
use Symplify\MonorepoBuilder\Release\ReleaseWorker\SetNextMutualDependenciesReleaseWorker;
17
use Symplify\MonorepoBuilder\Release\ReleaseWorker\TagVersionReleaseWorker;
18
use Symplify\MonorepoBuilder\Release\ReleaseWorker\UpdateBranchAliasReleaseWorker;
19
20
/**
21
 * Monorepo Builder additional fields
22
 *
23
 * @see https://github.com/symplify/symplify/issues/2061
24
 */
25
\register_shutdown_function(static function () {
26
    $dest = \json_decode(\file_get_contents(__DIR__ . '/composer.json'), true);
27
28
    $result = [
29
        'name'              => 'spiral/framework',
30
        'type'              => 'library',
31
        'description'       => $dest['description'] ?? '',
32
        'homepage'          => 'https://spiral.dev',
33
        'license'           => 'MIT',
34
        'funding' => [
35
            [
36
                'type' => 'github',
37
                'url' => 'https://github.com/sponsors/spiral',
38
            ],
39
        ],
40
        'support'           => [
41
            'issues' => 'https://github.com/spiral/framework/issues',
42
            'source' => 'https://github.com/spiral/framework',
43
        ],
44
        'authors'           => [
45
            [
46
                'name'  => 'Anton Titov (wolfy-j)',
47
                'email' => '[email protected]',
48
            ],
49
            [
50
                'name'  => 'Pavel Butchnev (butschster)',
51
                'email' => '[email protected]',
52
            ],
53
            [
54
                'name'  => 'Aleksei Gagarin (roxblnfk)',
55
                'email' => '[email protected]',
56
            ],
57
            [
58
                'name'  => 'Maksim Smakouz (msmakouz)',
59
                'email' => '[email protected]',
60
            ],
61
        ],
62
        'require'           => $dest['require'] ?? [],
63
        'autoload'          => $dest['autoload'] ?? [],
64
        'require-dev'       => $dest['require-dev'] ?? [],
65
        'autoload-dev'      => $dest['autoload-dev'] ?? [],
66
        'replace'           => $dest['replace'] ?? [],
67
        'scripts'           => $dest['scripts'] ?? [],
68
        'extra'             => $dest['extra'] ?? [],
69
        'config'            => $dest['config'] ?? [],
70
        'minimum-stability' => $dest['minimum-stability'] ?? 'dev',
71
        'prefer-stable'     => $dest['prefer-stable'] ?? true,
72
    ];
73
74
    $json = \json_encode($result, \JSON_PRETTY_PRINT | \JSON_UNESCAPED_SLASHES);
75
76
    \file_put_contents(__DIR__ . '/composer.json', $json . "\n");
77
});
78
79
80
return static function (ContainerConfigurator $containerConfigurator): void {
81
    $parameters = $containerConfigurator->parameters();
82
83
    $parameters->set(Option::PACKAGE_ALIAS_FORMAT, '<major>.<minor>.x-dev');
0 ignored issues
show
Deprecated Code introduced by
The constant Symplify\MonorepoBuilder...n::PACKAGE_ALIAS_FORMAT has been deprecated: Use MBConfig instead ( Ignorable by Annotation )

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

83
    $parameters->set(/** @scrutinizer ignore-deprecated */ Option::PACKAGE_ALIAS_FORMAT, '<major>.<minor>.x-dev');

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...
84
    $parameters->set(Option::PACKAGE_DIRECTORIES, ['src']);
0 ignored issues
show
Deprecated Code introduced by
The constant Symplify\MonorepoBuilder...on::PACKAGE_DIRECTORIES has been deprecated: Use MBConfig instead ( Ignorable by Annotation )

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

84
    $parameters->set(/** @scrutinizer ignore-deprecated */ Option::PACKAGE_DIRECTORIES, ['src']);

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...
85
86
    $parameters->set(Option::DATA_TO_APPEND, [
0 ignored issues
show
Deprecated Code introduced by
The constant Symplify\MonorepoBuilder...\Option::DATA_TO_APPEND has been deprecated: Use MBConfig instead ( Ignorable by Annotation )

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

86
    $parameters->set(/** @scrutinizer ignore-deprecated */ Option::DATA_TO_APPEND, [

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...
87
        'type'         => 'library',
88
        'autoload'     => [
89
            'files' => [
90
                'src/Framework/helpers.php',
91
            ],
92
            'psr-4' => [
93
                'Spiral\\' => 'src/Framework',
94
            ],
95
        ],
96
        'require'      => [
97
            'spiral/composer-publish-plugin' => '^1.0',
98
        ],
99
        'autoload-dev' => [
100
            'psr-4' => [
101
                'MonorepoBuilder\\'          => 'builder',
102
                'Spiral\\Tests\\Framework\\' => 'tests/Framework',
103
                'Spiral\\App\\'              => 'tests/app/src',
104
            ],
105
        ],
106
        'require-dev'  => [
107
            'phpunit/phpunit'           => '^10.5.41',
108
            'mockery/mockery'           => '^1.6.12',
109
            'spiral/code-style'         => '^2.2.2',
110
            'symplify/monorepo-builder' => '^10.3.3',
111
            'vimeo/psalm'               => '^6.0',
112
        ],
113
        'conflict' => [
114
            "spiral/roadrunner-bridge" => "<3.7",
115
            "spiral/sapi-bridge" => "<1.1"
116
        ],
117
    ]);
118
119
    $services = $containerConfigurator->services();
120
121
    $services->set(TagResolverInterface::class, MostRecentTagResolver::class);
122
    $services->set(TagParserInterface::class, ProcessParser::class)->autowire();
123
124
    # release workers - in order to execute
125
    $services->set(ValidateVersionReleaseWorker::class);
126
    $services->set(SetCurrentMutualDependenciesReleaseWorker::class);
127
    $services->set(AddTagToChangelogReleaseWorker::class);
128
    $services->set(TagVersionReleaseWorker::class);
129
    $services->set(PushTagReleaseWorker::class);
130
    $services->set(SetNextMutualDependenciesReleaseWorker::class);
131
    $services->set(UpdateBranchAliasReleaseWorker::class);
132
    $services->set(PushNextDevReleaseWorker::class);
133
};
134