Files
Christian Flothmann 6ce0699909 Merge branch '6.4' into 7.1
* 6.4: (23 commits)
  add translations for the Slug constraint
  [Messenger] Fix `TransportMessageIdStamp` not always added
  [DoctrineBridge] Fix compatibility to Doctrine persistence 2.5 in Doctrine Bridge 6.4 to avoid Projects stuck on 6.3
  [PropertyInfo] Fix add missing composer conflict
  [ErrorHandler] Don't trigger "internal" deprecations for anonymous LazyClosure instances
  [VarDumper] Fix displaying closure's "this" from anonymous classes
  [Doctrine][Messenger] Prevents multiple TransportMessageIdStamp being stored in envelope
  [HttpKernel] Don't override existing LoggerInterface autowiring alias in LoggerPass
  reject inline notations followed by invalid content
  [Security] Fix triggering session tracking from ContextListener
  [AssetMapper] add leading slash to public prefix
  fix: modify Exception message parameter order
  [Yaml] Fix parsing of unquoted strings in Parser::lexUnquotedString() to ignore spaces
  Update exception.css
  Bump Symfony version to 6.4.18
  Update VERSION for 6.4.17
  Update CONTRIBUTORS for 6.4.17
  Update CHANGELOG for 6.4.17
  Fix exception thrown by YamlEncoder
  [AssetMapper] Fix JavaScript compiler create self-referencing imports
  ...
2025-01-07 10:23:14 +01:00

48 lines
1.5 KiB
PHP

<?php
/*
* This file is part of the Symfony package.
*
* (c) Fabien Potencier <fabien@symfony.com>
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
namespace Symfony\Component\HttpKernel\DependencyInjection;
use Psr\Log\LoggerInterface;
use Symfony\Component\DependencyInjection\Compiler\CompilerPassInterface;
use Symfony\Component\DependencyInjection\ContainerBuilder;
use Symfony\Component\DependencyInjection\Reference;
use Symfony\Component\HttpFoundation\RequestStack;
use Symfony\Component\HttpKernel\Log\Logger;
/**
* Registers the default logger if necessary.
*
* @author Kévin Dunglas <dunglas@gmail.com>
*/
class LoggerPass implements CompilerPassInterface
{
public function process(ContainerBuilder $container): void
{
if (!$container->has(LoggerInterface::class)) {
$container->setAlias(LoggerInterface::class, 'logger');
}
if ($container->has('logger')) {
return;
}
if ($debug = $container->getParameter('kernel.debug')) {
$debug = $container->hasParameter('kernel.runtime_mode.web')
? $container->getParameter('kernel.runtime_mode.web')
: !\in_array(\PHP_SAPI, ['cli', 'phpdbg', 'embed'], true);
}
$container->register('logger', Logger::class)
->setArguments([null, null, null, new Reference(RequestStack::class), $debug]);
}
}