Skip to content

Commit bd2bf7e

Browse files
committed
Prefix all sprintf() calls
1 parent 690a40c commit bd2bf7e

File tree

3 files changed

+9
-9
lines changed

3 files changed

+9
-9
lines changed

ServiceLocatorTrait.php

+5-5
Original file line numberDiff line numberDiff line change
@@ -90,16 +90,16 @@ private function createNotFoundException(string $id): NotFoundExceptionInterface
9090
} else {
9191
$last = array_pop($alternatives);
9292
if ($alternatives) {
93-
$message = sprintf('only knows about the "%s" and "%s" services.', implode('", "', $alternatives), $last);
93+
$message = \sprintf('only knows about the "%s" and "%s" services.', implode('", "', $alternatives), $last);
9494
} else {
95-
$message = sprintf('only knows about the "%s" service.', $last);
95+
$message = \sprintf('only knows about the "%s" service.', $last);
9696
}
9797
}
9898

9999
if ($this->loading) {
100-
$message = sprintf('The service "%s" has a dependency on a non-existent service "%s". This locator %s', end($this->loading), $id, $message);
100+
$message = \sprintf('The service "%s" has a dependency on a non-existent service "%s". This locator %s', end($this->loading), $id, $message);
101101
} else {
102-
$message = sprintf('Service "%s" not found: the current service locator %s', $id, $message);
102+
$message = \sprintf('Service "%s" not found: the current service locator %s', $id, $message);
103103
}
104104

105105
return new class($message) extends \InvalidArgumentException implements NotFoundExceptionInterface {
@@ -108,7 +108,7 @@ private function createNotFoundException(string $id): NotFoundExceptionInterface
108108

109109
private function createCircularReferenceException(string $id, array $path): ContainerExceptionInterface
110110
{
111-
return new class(sprintf('Circular reference detected for service "%s", path: "%s".', $id, implode(' -> ', $path))) extends \RuntimeException implements ContainerExceptionInterface {
111+
return new class(\sprintf('Circular reference detected for service "%s", path: "%s".', $id, implode(' -> ', $path))) extends \RuntimeException implements ContainerExceptionInterface {
112112
};
113113
}
114114
}

ServiceMethodsSubscriberTrait.php

+2-2
Original file line numberDiff line numberDiff line change
@@ -42,11 +42,11 @@ public static function getSubscribedServices(): array
4242
}
4343

4444
if ($method->isStatic() || $method->isAbstract() || $method->isGenerator() || $method->isInternal() || $method->getNumberOfRequiredParameters()) {
45-
throw new \LogicException(sprintf('Cannot use "%s" on method "%s::%s()" (can only be used on non-static, non-abstract methods with no parameters).', SubscribedService::class, self::class, $method->name));
45+
throw new \LogicException(\sprintf('Cannot use "%s" on method "%s::%s()" (can only be used on non-static, non-abstract methods with no parameters).', SubscribedService::class, self::class, $method->name));
4646
}
4747

4848
if (!$returnType = $method->getReturnType()) {
49-
throw new \LogicException(sprintf('Cannot use "%s" on methods without a return type in "%s::%s()".', SubscribedService::class, $method->name, self::class));
49+
throw new \LogicException(\sprintf('Cannot use "%s" on methods without a return type in "%s::%s()".', SubscribedService::class, $method->name, self::class));
5050
}
5151

5252
/* @var SubscribedService $attribute */

ServiceSubscriberTrait.php

+2-2
Original file line numberDiff line numberDiff line change
@@ -46,11 +46,11 @@ public static function getSubscribedServices(): array
4646
}
4747

4848
if ($method->isStatic() || $method->isAbstract() || $method->isGenerator() || $method->isInternal() || $method->getNumberOfRequiredParameters()) {
49-
throw new \LogicException(sprintf('Cannot use "%s" on method "%s::%s()" (can only be used on non-static, non-abstract methods with no parameters).', SubscribedService::class, self::class, $method->name));
49+
throw new \LogicException(\sprintf('Cannot use "%s" on method "%s::%s()" (can only be used on non-static, non-abstract methods with no parameters).', SubscribedService::class, self::class, $method->name));
5050
}
5151

5252
if (!$returnType = $method->getReturnType()) {
53-
throw new \LogicException(sprintf('Cannot use "%s" on methods without a return type in "%s::%s()".', SubscribedService::class, $method->name, self::class));
53+
throw new \LogicException(\sprintf('Cannot use "%s" on methods without a return type in "%s::%s()".', SubscribedService::class, $method->name, self::class));
5454
}
5555

5656
/* @var SubscribedService $attribute */

0 commit comments

Comments
 (0)