Test Failed
Push — master ( c4a6de...2fae60 )
by Alexander
15:33 queued 13:07
created

ConsoleApplicationRunner::runBootstrap()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 3
Code Lines 1

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
eloc 1
c 1
b 0
f 0
dl 0
loc 3
rs 10
cc 1
nc 1
nop 2
1
<?php
2
3
declare(strict_types=1);
4
5
namespace App\Runner;
6
7
use Error;
8
use ErrorException;
9
use Exception;
10
use Psr\Container\ContainerInterface;
11
use Yiisoft\Config\Config;
12
use Yiisoft\Di\Container;
13
use Yiisoft\Factory\Exception\CircularReferenceException;
0 ignored issues
show
Bug introduced by
The type Yiisoft\Factory\Exceptio...cularReferenceException was not found. Maybe you did not declare it correctly or list all dependencies?

The issue could also be caused by a filter entry in the build configuration. If the path has been excluded in your configuration, e.g. excluded_paths: ["lib/*"], you can move it to the dependency path list as follows:

filter:
    dependency_paths: ["lib/*"]

For further information see https://scrutinizer-ci.com/docs/tools/php/php-scrutinizer/#list-dependency-paths

Loading history...
14
use Yiisoft\Factory\Exception\InvalidConfigException;
0 ignored issues
show
Bug introduced by
The type Yiisoft\Factory\Exception\InvalidConfigException was not found. Maybe you did not declare it correctly or list all dependencies?

The issue could also be caused by a filter entry in the build configuration. If the path has been excluded in your configuration, e.g. excluded_paths: ["lib/*"], you can move it to the dependency path list as follows:

filter:
    dependency_paths: ["lib/*"]

For further information see https://scrutinizer-ci.com/docs/tools/php/php-scrutinizer/#list-dependency-paths

Loading history...
15
use Yiisoft\Factory\Exception\NotFoundException;
0 ignored issues
show
Bug introduced by
The type Yiisoft\Factory\Exception\NotFoundException was not found. Maybe you did not declare it correctly or list all dependencies?

The issue could also be caused by a filter entry in the build configuration. If the path has been excluded in your configuration, e.g. excluded_paths: ["lib/*"], you can move it to the dependency path list as follows:

filter:
    dependency_paths: ["lib/*"]

For further information see https://scrutinizer-ci.com/docs/tools/php/php-scrutinizer/#list-dependency-paths

Loading history...
16
use Yiisoft\Factory\Exception\NotInstantiableException;
0 ignored issues
show
Bug introduced by
The type Yiisoft\Factory\Exception\NotInstantiableException was not found. Maybe you did not declare it correctly or list all dependencies?

The issue could also be caused by a filter entry in the build configuration. If the path has been excluded in your configuration, e.g. excluded_paths: ["lib/*"], you can move it to the dependency path list as follows:

filter:
    dependency_paths: ["lib/*"]

For further information see https://scrutinizer-ci.com/docs/tools/php/php-scrutinizer/#list-dependency-paths

Loading history...
17
use Yiisoft\Yii\Console\Application;
18
use Yiisoft\Yii\Console\Output\ConsoleBufferedOutput;
19
20
final class ConsoleApplicationRunner
21
{
22
    /**
23
     * @throws CircularReferenceException|ErrorException|Exception|InvalidConfigException|NotFoundException
24
     * @throws NotInstantiableException
25
     */
26
    public function run(): void
27
    {
28
        $config = new Config(
29
            dirname(__DIR__, 2),
30
            '/config/packages', // Configs path.
31
            null,
32
            [
33
                'params',
34
                'events',
35
                'events-web',
36
                'events-console',
37
            ],
38
        );
39
40
        $container = new Container(
41
            $config->get('console'),
42
            $config->get('providers-console')
43
        );
44
45
        $container = $container->get(ContainerInterface::class);
46
47
        // Run bootstrap
48
        $this->runBootstrap($container, $config->get('bootstrap-console'));
49
50
        /** @var Application */
51
        $application = $container->get(Application::class);
52
        $exitCode = 1;
53
54
        try {
55
            $application->start();
56
            $exitCode = $application->run(null, new ConsoleBufferedOutput());
57
        } catch (Error $error) {
58
            $application->renderThrowable($error, new ConsoleBufferedOutput());
59
        } finally {
60
            $application->shutdown($exitCode);
61
            exit($exitCode);
0 ignored issues
show
Best Practice introduced by
Using exit here is not recommended.

In general, usage of exit should be done with care and only when running in a scripting context like a CLI script.

Loading history...
62
        }
63
    }
64
65
    private function runBootstrap(ContainerInterface $container, array $bootstrapList): void
66
    {
67
        (new BootstrapRunner($container, $bootstrapList))->run();
68
    }
69
}
70