Symfony Deprecation: Use Symfony\Component\ErrorHandler\Debug instead of Symfony\Component\Debug\Debug

This commit is contained in:
2019-11-28 13:06:40 +03:00
parent 00adca7cc7
commit af377618b1
3 changed files with 9 additions and 16 deletions

View File

@@ -4,7 +4,6 @@
use App\Kernel;
use Symfony\Bundle\FrameworkBundle\Console\Application;
use Symfony\Component\Console\Input\ArgvInput;
use Symfony\Component\Debug\Debug;
if (false === in_array(\PHP_SAPI, ['cli', 'phpdbg', 'embed'], true)) {
echo 'Warning: The console should be invoked via the CLI version of PHP, not the '.\PHP_SAPI.' SAPI'.\PHP_EOL;
@@ -28,13 +27,6 @@ if ($input->hasParameterOption('--no-debug', true)) {
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);

View File

@@ -1,6 +1,7 @@
<?php
use Symfony\Component\Dotenv\Dotenv;
use Symfony\Component\ErrorHandler\Debug;
require \dirname(__DIR__).'/vendor/autoload.php';
@@ -13,6 +14,13 @@ $_SERVER['APP_ENV'] = $_ENV['APP_ENV'] = ($_SERVER['APP_ENV'] ?? $_ENV['APP_ENV'
$_SERVER['APP_DEBUG'] = $_SERVER['APP_DEBUG'] ?? $_ENV['APP_DEBUG'] ?? 'prod' !== $_SERVER['APP_ENV'];
$_SERVER['APP_DEBUG'] = $_ENV['APP_DEBUG'] = (int) $_SERVER['APP_DEBUG'] || \filter_var($_SERVER['APP_DEBUG'], FILTER_VALIDATE_BOOLEAN) ? '1' : '0';
if ($_SERVER['APP_DEBUG']) {
\umask(0000);
if (\class_exists(Debug::class)) {
Debug::enable();
}
}
Premier\Enum\Doctrine\EnumType::register(App\Enum\Carcase::class, 'carcase_enum');
Premier\Enum\Doctrine\EnumType::register(App\Enum\CarTransmission::class, 'car_transmission_enum');
Premier\Enum\Doctrine\EnumType::register(App\Enum\CarWheelDrive::class, 'car_wheel_drive_enum');

View File

@@ -1,16 +1,9 @@
<?php
use App\Kernel;
use Symfony\Component\Debug\Debug;
use Symfony\Component\HttpFoundation\Request;
require \dirname(__DIR__).'/config/bootstrap.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);
}
@@ -19,7 +12,7 @@ if ($trustedHosts = $_SERVER['TRUSTED_HOSTS'] ?? $_ENV['TRUSTED_HOSTS'] ?? false
Request::setTrustedHosts([$trustedHosts]);
}
$kernel = new Kernel($_SERVER['APP_ENV'], (bool) $_SERVER['APP_DEBUG']);
$kernel = new App\Kernel($_SERVER['APP_ENV'], (bool) $_SERVER['APP_DEBUG']);
$request = Request::createFromGlobals();
$response = $kernel->handle($request);
$response->send();