|
3 | 3 |
|
4 | 4 | use App\Kernel;
|
5 | 5 | use Symfony\Bundle\FrameworkBundle\Console\Application;
|
6 |
| -use Symfony\Component\Console\Input\ArgvInput; |
7 |
| -use Symfony\Component\ErrorHandler\Debug; |
8 | 6 |
|
9 |
| -if (!in_array(PHP_SAPI, ['cli', 'phpdbg', 'embed'], true)) { |
10 |
| - echo 'Warning: The console should be invoked via the CLI version of PHP, not the '.PHP_SAPI.' SAPI'.PHP_EOL; |
| 7 | +if (!is_file(dirname(__DIR__).'/vendor/autoload_runtime.php')) { |
| 8 | + throw new LogicException('Symfony Runtime is missing. Try running "composer require symfony/runtime".'); |
11 | 9 | }
|
12 | 10 |
|
13 |
| -set_time_limit(0); |
| 11 | +require_once dirname(__DIR__).'/vendor/autoload_runtime.php'; |
14 | 12 |
|
15 |
| -require dirname(__DIR__).'/vendor/autoload.php'; |
| 13 | +return function (array $context) { |
| 14 | + $kernel = new Kernel($context['APP_ENV'], (bool) $context['APP_DEBUG']); |
16 | 15 |
|
17 |
| -if (!class_exists(Application::class)) { |
18 |
| - throw new LogicException('You need to add "symfony/framework-bundle" as a Composer dependency.'); |
19 |
| -} |
20 |
| - |
21 |
| -$input = new ArgvInput(); |
22 |
| -if (null !== $env = $input->getParameterOption(['--env', '-e'], null, true)) { |
23 |
| - putenv('APP_ENV='.$_SERVER['APP_ENV'] = $_ENV['APP_ENV'] = $env); |
24 |
| -} |
25 |
| - |
26 |
| -if ($input->hasParameterOption('--no-debug', true)) { |
27 |
| - putenv('APP_DEBUG='.$_SERVER['APP_DEBUG'] = $_ENV['APP_DEBUG'] = '0'); |
28 |
| -} |
29 |
| - |
30 |
| -require dirname(__DIR__).'/config/bootstrap.php'; |
31 |
| - |
32 |
| -if ($_SERVER['APP_DEBUG']) { |
33 |
| - umask(0000); |
34 |
| - |
35 |
| - if (class_exists(Debug::class)) { |
36 |
| - Debug::enable(); |
37 |
| - } |
38 |
| -} |
39 |
| - |
40 |
| -$kernel = new Kernel($_SERVER['APP_ENV'], (bool) $_SERVER['APP_DEBUG']); |
41 |
| -$application = new Application($kernel); |
42 |
| -$application->run($input); |
| 16 | + return new Application($kernel); |
| 17 | +}; |
0 commit comments