Skip to content
Snippets Groups Projects
Commit 617ded69 authored by Reiter, Christoph's avatar Reiter, Christoph :snake:
Browse files

Re-run symfony recipes to get updated bootstrap/kernel/console scripts

composer recipes:install symfony/console --force
composer recipes:install symfony/framework-bundle --force

This gets rid of a few deprecation warnings
parent a87b2ff0
No related branches found
No related tags found
No related merge requests found
Pipeline #27164 passed
...@@ -12,6 +12,7 @@ ...@@ -12,6 +12,7 @@
###> symfony/phpunit-bridge ### ###> symfony/phpunit-bridge ###
.phpunit .phpunit
.phpunit.result.cache
/phpunit.xml /phpunit.xml
###< symfony/phpunit-bridge ### ###< symfony/phpunit-bridge ###
......
...@@ -4,14 +4,19 @@ ...@@ -4,14 +4,19 @@
use App\Kernel; use App\Kernel;
use Symfony\Bundle\FrameworkBundle\Console\Application; use Symfony\Bundle\FrameworkBundle\Console\Application;
use Symfony\Component\Console\Input\ArgvInput; use Symfony\Component\Console\Input\ArgvInput;
use Symfony\Component\Dotenv\Dotenv;
use Symfony\Component\ErrorHandler\Debug; use Symfony\Component\ErrorHandler\Debug;
if (!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;
}
set_time_limit(0); set_time_limit(0);
require dirname(__DIR__).'/vendor/autoload.php'; require dirname(__DIR__).'/vendor/autoload.php';
if (!class_exists(Application::class)) { if (!class_exists(Application::class) || !class_exists(Dotenv::class)) {
throw new RuntimeException('You need to add "symfony/framework-bundle" as a Composer dependency.'); throw new LogicException('You need to add "symfony/framework-bundle" and "symfony/dotenv" as Composer dependencies.');
} }
$input = new ArgvInput(); $input = new ArgvInput();
...@@ -23,7 +28,7 @@ if ($input->hasParameterOption('--no-debug', true)) { ...@@ -23,7 +28,7 @@ if ($input->hasParameterOption('--no-debug', true)) {
putenv('APP_DEBUG='.$_SERVER['APP_DEBUG'] = $_ENV['APP_DEBUG'] = '0'); putenv('APP_DEBUG='.$_SERVER['APP_DEBUG'] = $_ENV['APP_DEBUG'] = '0');
} }
require dirname(__DIR__).'/config/bootstrap.php'; (new Dotenv())->bootEnv(dirname(__DIR__).'/.env');
if ($_SERVER['APP_DEBUG']) { if ($_SERVER['APP_DEBUG']) {
umask(0000); umask(0000);
......
<?php
declare(strict_types=1);
use Symfony\Component\Dotenv\Dotenv;
require dirname(__DIR__).'/vendor/autoload.php';
// Load cached env vars if the .env.local.php file exists
// Run "composer dump-env prod" to create it (requires symfony/flex >=1.2)
if (is_array($env = @include dirname(__DIR__).'/.env.local.php')) {
foreach ($env as $k => $v) {
$_ENV[$k] = $_ENV[$k] ?? (isset($_SERVER[$k]) && 0 !== strpos($k, 'HTTP_') ? $_SERVER[$k] : $v);
}
} elseif (!class_exists(Dotenv::class)) {
throw new RuntimeException('Please run "composer require symfony/dotenv" to load the ".env" files configuring the application.');
} else {
// load all the .env files
(new Dotenv(false))->loadEnv(dirname(__DIR__).'/.env');
}
$_SERVER += $_ENV;
$_SERVER['APP_ENV'] = $_ENV['APP_ENV'] = ($_SERVER['APP_ENV'] ?? $_ENV['APP_ENV'] ?? null) ?: 'dev';
$_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';
<?php
declare(strict_types=1);
if (file_exists(dirname(__DIR__).'/var/cache/prod/App_KernelProdContainer.preload.php')) {
require dirname(__DIR__).'/var/cache/prod/App_KernelProdContainer.preload.php';
}
...@@ -3,31 +3,18 @@ ...@@ -3,31 +3,18 @@
declare(strict_types=1); declare(strict_types=1);
use App\Kernel; use App\Kernel;
use Symfony\Component\Dotenv\Dotenv;
use Symfony\Component\ErrorHandler\Debug; use Symfony\Component\ErrorHandler\Debug;
use Symfony\Component\HttpFoundation\Request; use Symfony\Component\HttpFoundation\Request;
// FPM renames all environment variables! require dirname(__DIR__).'/vendor/autoload.php';
if (isset($_SERVER['REDIRECT_APP_ENV'])) {
$_SERVER['APP_ENV'] = $_SERVER['REDIRECT_APP_ENV'];
}
require dirname(__DIR__).'/config/bootstrap.php'; (new Dotenv())->bootEnv(dirname(__DIR__).'/.env');
if ($_SERVER['APP_DEBUG']) { if ($_SERVER['APP_DEBUG']) {
umask(0000); umask(0000);
Debug::enable(); Debug::enable();
} else {
// Set a dummy dumper handler to avoid left over dump() commands breaking production
\Symfony\Component\VarDumper\VarDumper::setHandler(function ($var) {});
}
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']); $kernel = new Kernel($_SERVER['APP_ENV'], (bool) $_SERVER['APP_DEBUG']);
......
...@@ -5,46 +5,36 @@ declare(strict_types=1); ...@@ -5,46 +5,36 @@ declare(strict_types=1);
namespace App; namespace App;
use Symfony\Bundle\FrameworkBundle\Kernel\MicroKernelTrait; use Symfony\Bundle\FrameworkBundle\Kernel\MicroKernelTrait;
use Symfony\Component\Config\Loader\LoaderInterface; use Symfony\Component\DependencyInjection\Loader\Configurator\ContainerConfigurator;
use Symfony\Component\Config\Resource\FileResource;
use Symfony\Component\DependencyInjection\ContainerBuilder;
use Symfony\Component\HttpKernel\Kernel as BaseKernel; use Symfony\Component\HttpKernel\Kernel as BaseKernel;
use Symfony\Component\Routing\RouteCollectionBuilder; use Symfony\Component\Routing\Loader\Configurator\RoutingConfigurator;
class Kernel extends BaseKernel class Kernel extends BaseKernel
{ {
use MicroKernelTrait; use MicroKernelTrait;
private const CONFIG_EXTS = '.{php,xml,yaml,yml}'; protected function configureContainer(ContainerConfigurator $container): void
public function registerBundles(): iterable
{ {
$contents = require $this->getProjectDir().'/config/bundles.php'; $container->import('../config/{packages}/*.yaml');
foreach ($contents as $class => $envs) { $container->import('../config/{packages}/'.$this->environment.'/*.yaml');
if ($envs[$this->environment] ?? $envs['all'] ?? false) {
yield new $class(); if (is_file(\dirname(__DIR__).'/config/services.yaml')) {
} $container->import('../config/services.yaml');
$container->import('../config/{services}_'.$this->environment.'.yaml');
} elseif (is_file($path = \dirname(__DIR__).'/config/services.php')) {
(require $path)($container->withPath($path), $this);
} }
} }
protected function configureContainer(ContainerBuilder $container, LoaderInterface $loader): void protected function configureRoutes(RoutingConfigurator $routes): void
{ {
$container->addResource(new FileResource($this->getProjectDir().'/config/bundles.php')); $routes->import('../config/{routes}/'.$this->environment.'/*.yaml');
$container->setParameter('container.dumper.inline_class_loader', true); $routes->import('../config/{routes}/*.yaml');
$confDir = $this->getProjectDir().'/config';
$loader->load($confDir.'/{packages}/*'.self::CONFIG_EXTS, 'glob');
$loader->load($confDir.'/{packages}/'.$this->environment.'/**/*'.self::CONFIG_EXTS, 'glob');
$loader->load($confDir.'/{services}'.self::CONFIG_EXTS, 'glob');
$loader->load($confDir.'/{services}_'.$this->environment.self::CONFIG_EXTS, 'glob');
}
protected function configureRoutes(RouteCollectionBuilder $routes): void if (is_file(\dirname(__DIR__).'/config/routes.yaml')) {
{ $routes->import('../config/routes.yaml');
$confDir = $this->getProjectDir().'/config'; } elseif (is_file($path = \dirname(__DIR__).'/config/routes.php')) {
(require $path)($routes->withPath($path), $this);
$routes->import($confDir.'/{routes}/'.$this->environment.'/**/*'.self::CONFIG_EXTS, '/', 'glob'); }
$routes->import($confDir.'/{routes}/*'.self::CONFIG_EXTS, '/', 'glob');
$routes->import($confDir.'/{routes}'.self::CONFIG_EXTS, '/', 'glob');
} }
} }
...@@ -227,16 +227,15 @@ ...@@ -227,16 +227,15 @@
"version": "v4.4.16" "version": "v4.4.16"
}, },
"symfony/console": { "symfony/console": {
"version": "4.4", "version": "5.1",
"recipe": { "recipe": {
"repo": "github.com/symfony/recipes", "repo": "github.com/symfony/recipes",
"branch": "master", "branch": "master",
"version": "4.4", "version": "5.1",
"ref": "ea8c0eda34fda57e7d5cd8cbd889e2a387e3472c" "ref": "c6d02bdfba9da13c22157520e32a602dbee8a75c"
}, },
"files": [ "files": [
"bin/console", "bin/console"
"config/bootstrap.php"
] ]
}, },
"symfony/contracts": { "symfony/contracts": {
...@@ -300,15 +299,14 @@ ...@@ -300,15 +299,14 @@
] ]
}, },
"symfony/framework-bundle": { "symfony/framework-bundle": {
"version": "4.4", "version": "5.2",
"recipe": { "recipe": {
"repo": "github.com/symfony/recipes", "repo": "github.com/symfony/recipes",
"branch": "master", "branch": "master",
"version": "4.4", "version": "5.2",
"ref": "2257d2a1754c7840f49ad04e1d529c402415f4b5" "ref": "6ec87563dcc85cd0c48856dcfbfc29610506d250"
}, },
"files": [ "files": [
"config/bootstrap.php",
"config/packages/cache.yaml", "config/packages/cache.yaml",
"config/packages/framework.yaml", "config/packages/framework.yaml",
"config/packages/test/framework.yaml", "config/packages/test/framework.yaml",
...@@ -360,12 +358,12 @@ ...@@ -360,12 +358,12 @@
"version": "v4.4.16" "version": "v4.4.16"
}, },
"symfony/phpunit-bridge": { "symfony/phpunit-bridge": {
"version": "4.3", "version": "5.1",
"recipe": { "recipe": {
"repo": "github.com/symfony/recipes", "repo": "github.com/symfony/recipes",
"branch": "master", "branch": "master",
"version": "4.3", "version": "5.1",
"ref": "6d0e35f749d5f4bfe1f011762875275cd3f9874f" "ref": "bf16921ef8309a81d9f046e9b6369c46bcbd031f"
}, },
"files": [ "files": [
".env.test", ".env.test",
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment