minor #22281 Dont call sprintf() when no placeholders are used (nicolas-grekas)
This PR was merged into the 2.7 branch.
Discussion
----------
Dont call sprintf() when no placeholders are used
| Q | A
| ------------- | ---
| Branch? | 2.7
| Bug fix? | no
| New feature? | no
| BC breaks? | no
| Deprecations? | no
| Tests pass? | yes
| Fixed tickets | -
| License | MIT
| Doc PR | -
Commits
-------
4951d3c
Dont call sprintf() when no placeholders are used
This commit is contained in:
commit
405a1a4edc
@ -167,11 +167,11 @@ EOF
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (!$this->getApplication()->getKernel()->isDebug()) {
|
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'))) {
|
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();
|
$container = new ContainerBuilder();
|
||||||
|
@ -373,7 +373,7 @@ class Definition
|
|||||||
public function addMethodCall($method, array $arguments = array())
|
public function addMethodCall($method, array $arguments = array())
|
||||||
{
|
{
|
||||||
if (empty($method)) {
|
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);
|
$this->calls[] = array($method, $arguments);
|
||||||
|
|
||||||
|
@ -93,11 +93,11 @@ class YamlDumper extends Dumper
|
|||||||
}
|
}
|
||||||
|
|
||||||
if ($definition->isSynthetic()) {
|
if ($definition->isSynthetic()) {
|
||||||
$code .= sprintf(" synthetic: true\n");
|
$code .= " synthetic: true\n";
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($definition->isSynchronized(false)) {
|
if ($definition->isSynchronized(false)) {
|
||||||
$code .= sprintf(" synchronized: true\n");
|
$code .= " synchronized: true\n";
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($definition->getFactoryClass(false)) {
|
if ($definition->getFactoryClass(false)) {
|
||||||
@ -105,7 +105,7 @@ class YamlDumper extends Dumper
|
|||||||
}
|
}
|
||||||
|
|
||||||
if ($definition->isLazy()) {
|
if ($definition->isLazy()) {
|
||||||
$code .= sprintf(" lazy: true\n");
|
$code .= " lazy: true\n";
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($definition->getFactoryMethod(false)) {
|
if ($definition->getFactoryMethod(false)) {
|
||||||
|
@ -129,7 +129,7 @@ class ParameterBag implements \IteratorAggregate, \Countable
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (null !== $currentKey) {
|
if (null !== $currentKey) {
|
||||||
throw new \InvalidArgumentException(sprintf('Malformed path. Path must end with "]".'));
|
throw new \InvalidArgumentException('Malformed path. Path must end with "]".');
|
||||||
}
|
}
|
||||||
|
|
||||||
return $value;
|
return $value;
|
||||||
|
@ -151,7 +151,7 @@ class Validator implements ValidatorInterface, Mapping\Factory\MetadataFactoryIn
|
|||||||
? '"'.$containingValue.'"'
|
? '"'.$containingValue.'"'
|
||||||
: 'the value of type '.gettype($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
|
// If $containingValue is passed as class name, take $value as root
|
||||||
|
Reference in New Issue
Block a user