From 8191468929f47b4598e9592aff2853b196f537a9 Mon Sep 17 00:00:00 2001 From: "Alexander M. Turek" Date: Thu, 20 Jun 2024 17:52:34 +0200 Subject: [PATCH] Prefix all sprintf() calls --- Debug/TraceableEventDispatcher.php | 2 +- DependencyInjection/RegisterListenersPass.php | 8 ++++---- GenericEvent.php | 2 +- 3 files changed, 6 insertions(+), 6 deletions(-) diff --git a/Debug/TraceableEventDispatcher.php b/Debug/TraceableEventDispatcher.php index 72ce526..8330ce1 100644 --- a/Debug/TraceableEventDispatcher.php +++ b/Debug/TraceableEventDispatcher.php @@ -110,7 +110,7 @@ public function dispatch(object $event, ?string $eventName = null): object $currentRequestHash = $this->currentRequestHash = $this->requestStack && ($request = $this->requestStack->getCurrentRequest()) ? spl_object_hash($request) : ''; if (null !== $this->logger && $event instanceof StoppableEventInterface && $event->isPropagationStopped()) { - $this->logger->debug(sprintf('The "%s" event is already stopped. No listeners have been called.', $eventName)); + $this->logger->debug(\sprintf('The "%s" event is already stopped. No listeners have been called.', $eventName)); } $this->preProcess($eventName); diff --git a/DependencyInjection/RegisterListenersPass.php b/DependencyInjection/RegisterListenersPass.php index 29a76bb..a0267ce 100644 --- a/DependencyInjection/RegisterListenersPass.php +++ b/DependencyInjection/RegisterListenersPass.php @@ -88,7 +88,7 @@ public function process(ContainerBuilder $container): void if (null !== ($class = $container->getDefinition($id)->getClass()) && ($r = $container->getReflectionClass($class, false)) && !$r->hasMethod($event['method'])) { if (!$r->hasMethod('__invoke')) { - throw new InvalidArgumentException(sprintf('None of the "%s" or "__invoke" methods exist for the service "%s". Please define the "method" attribute on "kernel.event_listener" tags.', $event['method'], $id)); + throw new InvalidArgumentException(\sprintf('None of the "%s" or "__invoke" methods exist for the service "%s". Please define the "method" attribute on "kernel.event_listener" tags.', $event['method'], $id)); } $event['method'] = '__invoke'; @@ -123,10 +123,10 @@ public function process(ContainerBuilder $container): void $class = $def->getClass(); if (!$r = $container->getReflectionClass($class)) { - throw new InvalidArgumentException(sprintf('Class "%s" used for service "%s" cannot be found.', $class, $id)); + throw new InvalidArgumentException(\sprintf('Class "%s" used for service "%s" cannot be found.', $class, $id)); } if (!$r->isSubclassOf(EventSubscriberInterface::class)) { - throw new InvalidArgumentException(sprintf('Service "%s" must implement interface "%s".', $id, EventSubscriberInterface::class)); + throw new InvalidArgumentException(\sprintf('Service "%s" must implement interface "%s".', $id, EventSubscriberInterface::class)); } $class = $r->name; @@ -178,7 +178,7 @@ private function getEventFromTypeDeclaration(ContainerBuilder $container, string || $type->isBuiltin() || Event::class === ($name = $type->getName()) ) { - throw new InvalidArgumentException(sprintf('Service "%s" must define the "event" attribute on "kernel.event_listener" tags.', $id)); + throw new InvalidArgumentException(\sprintf('Service "%s" must define the "event" attribute on "kernel.event_listener" tags.', $id)); } return $name; diff --git a/GenericEvent.php b/GenericEvent.php index 2ac654f..87f61ad 100644 --- a/GenericEvent.php +++ b/GenericEvent.php @@ -56,7 +56,7 @@ public function getArgument(string $key): mixed return $this->arguments[$key]; } - throw new \InvalidArgumentException(sprintf('Argument "%s" not found.', $key)); + throw new \InvalidArgumentException(\sprintf('Argument "%s" not found.', $key)); } /**