diff --git a/Controller/ControllerResolver.php b/Controller/ControllerResolver.php index 22907ce58f..4bf258416f 100644 --- a/Controller/ControllerResolver.php +++ b/Controller/ControllerResolver.php @@ -85,7 +85,7 @@ public function getController(Request $request) try { $callable = $this->createController($controller); } catch (\InvalidArgumentException $e) { - throw new \InvalidArgumentException(sprintf('The controller for URI "%s" is not callable. %s', $request->getPathInfo(), $e->getMessage())); + throw new \InvalidArgumentException(sprintf('The controller for URI "%s" is not callable. %s', $request->getPathInfo(), $e->getMessage()), 0, $e); } if (!\is_callable($callable)) { diff --git a/EventListener/DebugHandlersListener.php b/EventListener/DebugHandlersListener.php index 8ed6a10e52..dcb54ea891 100644 --- a/EventListener/DebugHandlersListener.php +++ b/EventListener/DebugHandlersListener.php @@ -66,6 +66,9 @@ public function __construct(callable $exceptionHandler = null, LoggerInterface $ */ public function configure(Event $event = null) { + if ($event instanceof ConsoleEvent && !\in_array(\PHP_SAPI, ['cli', 'phpdbg'], true)) { + return; + } if (!$event instanceof KernelEvent ? !$this->firstCall : !$event->isMasterRequest()) { return; } @@ -146,7 +149,7 @@ public static function getSubscribedEvents() { $events = [KernelEvents::REQUEST => ['configure', 2048]]; - if ('cli' === \PHP_SAPI && \defined('Symfony\Component\Console\ConsoleEvents::COMMAND')) { + if (\defined('Symfony\Component\Console\ConsoleEvents::COMMAND')) { $events[ConsoleEvents::COMMAND] = ['configure', 2048]; } diff --git a/Kernel.php b/Kernel.php index 828ba08406..0b21ee8996 100644 --- a/Kernel.php +++ b/Kernel.php @@ -76,11 +76,11 @@ abstract class Kernel implements KernelInterface, RebootableInterface, Terminabl private static $freshCache = []; - const VERSION = '4.4.4'; - const VERSION_ID = 40404; + const VERSION = '4.4.5'; + const VERSION_ID = 40405; const MAJOR_VERSION = 4; const MINOR_VERSION = 4; - const RELEASE_VERSION = 4; + const RELEASE_VERSION = 5; const EXTRA_VERSION = ''; const END_OF_MAINTENANCE = '11/2022'; @@ -228,7 +228,7 @@ public function getBundles() public function getBundle($name) { if (!isset($this->bundles[$name])) { - $class = \get_class($this); + $class = static::class; $class = 'c' === $class[0] && 0 === strpos($class, "class@anonymous\0") ? get_parent_class($class).'@anonymous' : $class; throw new \InvalidArgumentException(sprintf('Bundle "%s" does not exist or it is not enabled. Maybe you forgot to add it in the registerBundles() method of your %s.php file?', $name, $class)); @@ -473,7 +473,7 @@ protected function build(ContainerBuilder $container) */ protected function getContainerClass() { - $class = \get_class($this); + $class = static::class; $class = 'c' === $class[0] && 0 === strpos($class, "class@anonymous\0") ? get_parent_class($class).str_replace('.', '_', ContainerBuilder::hash($class)) : $class; $class = $this->name.str_replace('\\', '_', $class).ucfirst($this->environment).($this->debug ? 'Debug' : '').'Container'; @@ -510,7 +510,7 @@ protected function initializeContainer() $cachePath = $cache->getPath(); // Silence E_WARNING to ignore "include" failures - don't use "@" to prevent silencing fatal errors - $errorLevel = error_reporting(\E_ALL ^ \E_WARNING); + $errorLevel = error_reporting(E_ALL ^ E_WARNING); try { if (file_exists($cachePath) && \is_object($this->container = include $cachePath) diff --git a/Log/Logger.php b/Log/Logger.php index c27bb3f070..6ea3b464f0 100644 --- a/Log/Logger.php +++ b/Log/Logger.php @@ -101,6 +101,6 @@ private function format(string $level, string $message, array $context): string $message = strtr($message, $replacements); } - return sprintf('%s [%s] %s', date(\DateTime::RFC3339), $level, $message).\PHP_EOL; + return sprintf('%s [%s] %s', date(\DateTime::RFC3339), $level, $message).PHP_EOL; } } diff --git a/Tests/DataCollector/RequestDataCollectorTest.php b/Tests/DataCollector/RequestDataCollectorTest.php index 269b6211ee..0948c508c7 100644 --- a/Tests/DataCollector/RequestDataCollectorTest.php +++ b/Tests/DataCollector/RequestDataCollectorTest.php @@ -99,7 +99,7 @@ public function provideControllerCallables() '"Regular" callable', [$this, 'testControllerInspection'], [ - 'class' => RequestDataCollectorTest::class, + 'class' => self::class, 'method' => 'testControllerInspection', 'file' => __FILE__, 'line' => $r1->getStartLine(), diff --git a/Tests/Log/LoggerTest.php b/Tests/Log/LoggerTest.php index c562af1bcb..5c7da41957 100644 --- a/Tests/Log/LoggerTest.php +++ b/Tests/Log/LoggerTest.php @@ -186,7 +186,7 @@ public function testContextExceptionKeyCanBeExceptionOrOtherValues() public function testFormatter() { $this->logger = new Logger(LogLevel::DEBUG, $this->tmpFile, function ($level, $message, $context) { - return json_encode(['level' => $level, 'message' => $message, 'context' => $context]).\PHP_EOL; + return json_encode(['level' => $level, 'message' => $message, 'context' => $context]).PHP_EOL; }); $this->logger->error('An error', ['foo' => 'bar']);