mirror of
https://github.com/Sylius/Sylius.git
synced 2026-07-16 01:47:49 +00:00
minor #14511 [maintenance] - Use symfony runtime component (Ferror)
This PR was merged into the 1.12 branch. Discussion ---------- | Q | A | |-----------------|--------------------------------------------------------------| | Branch? | 1.12 <!-- see the comment below --> | | Bug fix? | no | | New feature? | no | | BC breaks? | no | | Deprecations? | no <!-- don't forget to update the UPGRADE-*.md file --> | | Related tickets | none | | License | MIT | <!-- - Bug fixes must be submitted against the 1.11 or 1.12 branch - Features and deprecations must be submitted against the 1.13 branch - Make sure that the correct base branch is set To be sure you are not breaking any Backward Compatibilities, check the documentation: https://docs.sylius.com/en/latest/book/organization/backward-compatibility-promise.html --> Commits -------9909a882f2[maintenance] - Use symfony runtime componentef027bf0e8enable runtime2e01cac440Move runtime to dev dependencies0c8b6ea1d7use str_starts_with function
This commit is contained in:
commit
2c26c3fcaa
5 changed files with 15 additions and 60 deletions
35
bin/console
35
bin/console
|
|
@ -3,36 +3,13 @@
|
|||
|
||||
use App\Kernel;
|
||||
use Symfony\Bundle\FrameworkBundle\Console\Application;
|
||||
use Symfony\Component\Console\Input\ArgvInput;
|
||||
use Symfony\Component\Debug\Debug;
|
||||
|
||||
set_time_limit(0);
|
||||
|
||||
require dirname(__DIR__).'/vendor/autoload.php';
|
||||
|
||||
if (!class_exists(Application::class)) {
|
||||
throw new RuntimeException('You need to add "symfony/framework-bundle" as a Composer dependency.');
|
||||
if (!is_file(dirname(__DIR__).'/vendor/autoload_runtime.php')) {
|
||||
throw new LogicException('Symfony Runtime is missing. Try running "composer require symfony/runtime".');
|
||||
}
|
||||
|
||||
$input = new ArgvInput();
|
||||
if (null !== $env = $input->getParameterOption(['--env', '-e'], null, true)) {
|
||||
putenv('APP_ENV='.$_SERVER['APP_ENV'] = $_ENV['APP_ENV'] = $env);
|
||||
}
|
||||
require_once dirname(__DIR__).'/vendor/autoload_runtime.php';
|
||||
|
||||
if ($input->hasParameterOption('--no-debug', true)) {
|
||||
putenv('APP_DEBUG='.$_SERVER['APP_DEBUG'] = $_ENV['APP_DEBUG'] = '0');
|
||||
}
|
||||
|
||||
require dirname(__DIR__).'/config/bootstrap.php';
|
||||
|
||||
if ($_SERVER['APP_DEBUG']) {
|
||||
umask(0000);
|
||||
|
||||
if (class_exists(Debug::class)) {
|
||||
Debug::enable();
|
||||
}
|
||||
}
|
||||
|
||||
$kernel = new Kernel($_SERVER['APP_ENV'], (bool) $_SERVER['APP_DEBUG']);
|
||||
$application = new Application($kernel);
|
||||
$application->run($input);
|
||||
return static function (array $context) {
|
||||
return new Application(new Kernel($context['APP_ENV'], (bool) $context['APP_DEBUG']));
|
||||
};
|
||||
|
|
|
|||
|
|
@ -223,6 +223,7 @@
|
|||
"symfony/debug-bundle": "^5.4 || ^6.0",
|
||||
"symfony/dotenv": "^5.4 || ^6.0",
|
||||
"symfony/flex": "^1.7",
|
||||
"symfony/runtime": "^5.4 || ^6.0",
|
||||
"symfony/web-profiler-bundle": "^5.4 || ^6.0",
|
||||
"symplify/monorepo-builder": "^11.0",
|
||||
"vimeo/psalm": "^4.19"
|
||||
|
|
@ -239,8 +240,9 @@
|
|||
},
|
||||
"sort-packages": true,
|
||||
"allow-plugins": {
|
||||
"dealerdirect/phpcodesniffer-composer-installer": false,
|
||||
"symfony/flex": true,
|
||||
"dealerdirect/phpcodesniffer-composer-installer": false
|
||||
"symfony/runtime": true
|
||||
}
|
||||
},
|
||||
"extra": {
|
||||
|
|
|
|||
|
|
@ -3,27 +3,9 @@
|
|||
declare(strict_types=1);
|
||||
|
||||
use App\Kernel;
|
||||
use Symfony\Component\ErrorHandler\Debug;
|
||||
use Symfony\Component\HttpFoundation\Request;
|
||||
|
||||
require dirname(__DIR__) . '/config/bootstrap.php';
|
||||
require_once dirname(__DIR__).'/vendor/autoload_runtime.php';
|
||||
|
||||
if ($_SERVER['APP_DEBUG']) {
|
||||
umask(0000);
|
||||
|
||||
Debug::enable();
|
||||
}
|
||||
|
||||
if ($trustedProxies = $_SERVER['TRUSTED_PROXIES'] ?? $_ENV['TRUSTED_PROXIES'] ?? false) {
|
||||
Request::setTrustedProxies(explode(',', $trustedProxies), Request::HEADER_X_FORWARDED_ALL ^ Request::HEADER_X_FORWARDED_HOST);
|
||||
}
|
||||
|
||||
if ($trustedHosts = $_SERVER['TRUSTED_HOSTS'] ?? $_ENV['TRUSTED_HOSTS'] ?? false) {
|
||||
Request::setTrustedHosts([$trustedHosts]);
|
||||
}
|
||||
|
||||
$kernel = new Kernel($_SERVER['APP_ENV'], (bool) $_SERVER['APP_DEBUG']);
|
||||
$request = Request::createFromGlobals();
|
||||
$response = $kernel->handle($request);
|
||||
$response->send();
|
||||
$kernel->terminate($request, $response);
|
||||
return static function (array $context) {
|
||||
return new Kernel($context['APP_ENV'], (bool) $context['APP_DEBUG']);
|
||||
};
|
||||
|
|
|
|||
|
|
@ -24,7 +24,7 @@ class Kernel extends BaseKernel
|
|||
|
||||
protected function getContainerBaseClass(): string
|
||||
{
|
||||
if ($this->isTestEnvironment() && class_exists(MockerContainer::class)) {
|
||||
if (class_exists(MockerContainer::class) && $this->isTestEnvironment()) {
|
||||
return MockerContainer::class;
|
||||
}
|
||||
|
||||
|
|
@ -33,6 +33,6 @@ class Kernel extends BaseKernel
|
|||
|
||||
private function isTestEnvironment(): bool
|
||||
{
|
||||
return 0 === strpos($this->getEnvironment(), 'test');
|
||||
return str_starts_with($this->getEnvironment(), 'test');
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -170,9 +170,6 @@
|
|||
"felixfbecker/language-server-protocol": {
|
||||
"version": "v1.4.0"
|
||||
},
|
||||
"fig/link-util": {
|
||||
"version": "1.1.0"
|
||||
},
|
||||
"friends-of-behat/mink": {
|
||||
"version": "v1.8.0"
|
||||
},
|
||||
|
|
@ -376,9 +373,6 @@
|
|||
"pagerfanta/pagerfanta": {
|
||||
"version": "v3.5.2"
|
||||
},
|
||||
"paragonie/random_compat": {
|
||||
"version": "v2.0.18"
|
||||
},
|
||||
"payum/iso4217": {
|
||||
"version": "1.0.1"
|
||||
},
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue