Dont call sprintf() when no placeholders are used

This commit is contained in:
Nicolas Grekas 2017-04-04 20:32:29 +02:00
parent a2cd63c885
commit 4951d3c962
5 changed files with 8 additions and 8 deletions

View File

@ -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();

View File

@ -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);

View File

@ -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)) {

View File

@ -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;

View File

@ -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