1
|
|
|
<?php |
2
|
|
|
|
3
|
|
|
declare(strict_types=1); |
4
|
|
|
|
5
|
|
|
namespace Yiisoft\Yii\Runner\Console; |
6
|
|
|
|
7
|
|
|
use ErrorException; |
8
|
|
|
use Exception; |
9
|
|
|
use Psr\Container\ContainerExceptionInterface; |
10
|
|
|
use Psr\Container\ContainerInterface; |
11
|
|
|
use Psr\Container\NotFoundExceptionInterface; |
12
|
|
|
use Throwable; |
13
|
|
|
use Yiisoft\Definitions\Exception\CircularReferenceException; |
14
|
|
|
use Yiisoft\Definitions\Exception\InvalidConfigException; |
15
|
|
|
use Yiisoft\Definitions\Exception\NotInstantiableException; |
16
|
|
|
use Yiisoft\Di\Container; |
17
|
|
|
use Yiisoft\Di\NotFoundException; |
18
|
|
|
use Yiisoft\Yii\Console\Application; |
19
|
|
|
use Yiisoft\Yii\Console\ExitCode; |
20
|
|
|
use Yiisoft\Yii\Console\Output\ConsoleBufferedOutput; |
21
|
|
|
use Yiisoft\Yii\Runner\ApplicationRunner; |
|
|
|
|
22
|
|
|
|
23
|
|
|
/** |
24
|
|
|
* `ConsoleApplicationRunner` runs the Yii console application. |
25
|
|
|
*/ |
26
|
|
|
final class ConsoleApplicationRunner extends ApplicationRunner |
27
|
|
|
{ |
28
|
|
|
/** |
29
|
|
|
* @param string $rootPath The absolute path to the project root. |
30
|
|
|
* @param bool $debug Whether the debug mode is enabled. |
31
|
|
|
* @param string|null $environment The environment name. |
32
|
|
|
*/ |
33
|
|
|
public function __construct(string $rootPath, bool $debug, ?string $environment) |
34
|
|
|
{ |
35
|
|
|
parent::__construct($rootPath, $debug, $environment); |
36
|
|
|
$this->bootstrapGroup = 'bootstrap-console'; |
|
|
|
|
37
|
|
|
$this->eventsGroup = 'events-console'; |
|
|
|
|
38
|
|
|
} |
39
|
|
|
|
40
|
|
|
/** |
41
|
|
|
* {@inheritDoc} |
42
|
|
|
* |
43
|
|
|
* @throws CircularReferenceException|ErrorException|Exception|InvalidConfigException |
44
|
|
|
* @throws ContainerExceptionInterface|NotFoundException|NotFoundExceptionInterface|NotInstantiableException |
45
|
|
|
*/ |
46
|
|
|
public function run(): void |
47
|
|
|
{ |
48
|
|
|
$config = $this->config ?? $this->createConfig(); |
49
|
|
|
$container = $this->container ?? $this->createContainer($config, 'console'); |
50
|
|
|
|
51
|
|
|
if ($container instanceof Container) { |
52
|
|
|
$container = $container->get(ContainerInterface::class); |
53
|
|
|
} |
54
|
|
|
|
55
|
|
|
$this->runBootstrap($config, $container); |
56
|
|
|
$this->checkEvents($config, $container); |
57
|
|
|
|
58
|
|
|
/** @var Application */ |
59
|
|
|
$application = $container->get(Application::class); |
60
|
|
|
$exitCode = ExitCode::UNSPECIFIED_ERROR; |
61
|
|
|
|
62
|
|
|
try { |
63
|
|
|
$application->start(); |
64
|
|
|
$exitCode = $application->run(null, new ConsoleBufferedOutput()); |
65
|
|
|
} catch (Throwable $throwable) { |
66
|
|
|
$application->renderThrowable($throwable, new ConsoleBufferedOutput()); |
67
|
|
|
} finally { |
68
|
|
|
$application->shutdown($exitCode); |
69
|
|
|
exit($exitCode); |
|
|
|
|
70
|
|
|
} |
71
|
|
|
} |
72
|
|
|
} |
73
|
|
|
|
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:For further information see https://scrutinizer-ci.com/docs/tools/php/php-scrutinizer/#list-dependency-paths