From 4951d3c96214a0cb80eeb868ec8e49cce954f7d3 Mon Sep 17 00:00:00 2001 From: Nicolas Grekas Date: Tue, 4 Apr 2017 20:32:29 +0200 Subject: [PATCH] Dont call sprintf() when no placeholders are used --- .../FrameworkBundle/Command/ContainerDebugCommand.php | 4 ++-- src/Symfony/Component/DependencyInjection/Definition.php | 2 +- .../Component/DependencyInjection/Dumper/YamlDumper.php | 6 +++--- src/Symfony/Component/HttpFoundation/ParameterBag.php | 2 +- src/Symfony/Component/Validator/Validator.php | 2 +- 5 files changed, 8 insertions(+), 8 deletions(-) diff --git a/src/Symfony/Bundle/FrameworkBundle/Command/ContainerDebugCommand.php b/src/Symfony/Bundle/FrameworkBundle/Command/ContainerDebugCommand.php index edfa6d9cc9..dd85c2456a 100644 --- a/src/Symfony/Bundle/FrameworkBundle/Command/ContainerDebugCommand.php +++ b/src/Symfony/Bundle/FrameworkBundle/Command/ContainerDebugCommand.php @@ -167,11 +167,11 @@ EOF } if (!$this->getApplication()->getKernel()->isDebug()) { - throw new \LogicException(sprintf('Debug information about the container is only available in debug mode.')); + throw new \LogicException('Debug information about the container is only available in debug mode.'); } if (!is_file($cachedFile = $this->getContainer()->getParameter('debug.container.dump'))) { - throw new \LogicException(sprintf('Debug information about the container could not be found. Please clear the cache and try again.')); + throw new \LogicException('Debug information about the container could not be found. Please clear the cache and try again.'); } $container = new ContainerBuilder(); diff --git a/src/Symfony/Component/DependencyInjection/Definition.php b/src/Symfony/Component/DependencyInjection/Definition.php index 49e4e1b0e2..aa76c96805 100644 --- a/src/Symfony/Component/DependencyInjection/Definition.php +++ b/src/Symfony/Component/DependencyInjection/Definition.php @@ -373,7 +373,7 @@ class Definition public function addMethodCall($method, array $arguments = array()) { if (empty($method)) { - throw new InvalidArgumentException(sprintf('Method name cannot be empty.')); + throw new InvalidArgumentException('Method name cannot be empty.'); } $this->calls[] = array($method, $arguments); diff --git a/src/Symfony/Component/DependencyInjection/Dumper/YamlDumper.php b/src/Symfony/Component/DependencyInjection/Dumper/YamlDumper.php index 1fa08e2b32..810e7539fe 100644 --- a/src/Symfony/Component/DependencyInjection/Dumper/YamlDumper.php +++ b/src/Symfony/Component/DependencyInjection/Dumper/YamlDumper.php @@ -93,11 +93,11 @@ class YamlDumper extends Dumper } if ($definition->isSynthetic()) { - $code .= sprintf(" synthetic: true\n"); + $code .= " synthetic: true\n"; } if ($definition->isSynchronized(false)) { - $code .= sprintf(" synchronized: true\n"); + $code .= " synchronized: true\n"; } if ($definition->getFactoryClass(false)) { @@ -105,7 +105,7 @@ class YamlDumper extends Dumper } if ($definition->isLazy()) { - $code .= sprintf(" lazy: true\n"); + $code .= " lazy: true\n"; } if ($definition->getFactoryMethod(false)) { diff --git a/src/Symfony/Component/HttpFoundation/ParameterBag.php b/src/Symfony/Component/HttpFoundation/ParameterBag.php index 4d082a8d2f..3436ee9337 100644 --- a/src/Symfony/Component/HttpFoundation/ParameterBag.php +++ b/src/Symfony/Component/HttpFoundation/ParameterBag.php @@ -129,7 +129,7 @@ class ParameterBag implements \IteratorAggregate, \Countable } if (null !== $currentKey) { - throw new \InvalidArgumentException(sprintf('Malformed path. Path must end with "]".')); + throw new \InvalidArgumentException('Malformed path. Path must end with "]".'); } return $value; diff --git a/src/Symfony/Component/Validator/Validator.php b/src/Symfony/Component/Validator/Validator.php index 4da27e7b37..feaec0d400 100644 --- a/src/Symfony/Component/Validator/Validator.php +++ b/src/Symfony/Component/Validator/Validator.php @@ -151,7 +151,7 @@ class Validator implements ValidatorInterface, Mapping\Factory\MetadataFactoryIn ? '"'.$containingValue.'"' : 'the value of type '.gettype($containingValue); - throw new ValidatorException(sprintf('The metadata for '.$valueAsString.' does not support properties.')); + throw new ValidatorException(sprintf('The metadata for %s does not support properties.', $valueAsString)); } // If $containingValue is passed as class name, take $value as root