8000 minor #22281 Dont call sprintf() when no placeholders are used (nicol… · symfony/symfony@405a1a4 · GitHub
[go: up one dir, main page]

Skip to content

Commit 405a1a4

Browse files
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
2 parents a2cd63c + 4951d3c commit 405a1a4

File tree

5 files changed

+8
-8
lines changed

5 files changed

+8
-8
lines changed

src/Symfony/Bundle/FrameworkBundle/Command/ContainerDebugCommand.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -167,11 +167,11 @@ protected function getContainerBuilder()
167167
}
168168

169169
if (!$this->getApplication()->getKernel()->isDebug()) {
170-
throw new \LogicException(sprintf('Debug information about the container is only available in debug mode.'));
170+
throw new \LogicException('Debug information about the container is only available in debug mode.');
171171
}
172172

173173
if (!is_file($cachedFile = $this->getContainer()->getParameter('debug.container.dump'))) {
174-
throw new \LogicException(sprintf('Debug information about the container could not be found. Please clear the cache and try again.'));
174+
throw new \LogicException('Debug information about the container could not be found. Please clear the cache and try again.');
175175
}
176176

177177
$container = new ContainerBuilder();

src/Symfony/Component/DependencyInjection/Definition.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -373,7 +373,7 @@ public function setMethodCalls(array $calls = array())
373373
public function addMethodCall($method, array $arguments = array())
374374
{
375375
if (empty($method)) {
376-
throw new InvalidArgumentException(sprintf('Method name cannot be empty.'));
376+
throw new InvalidArgumentException('Method name cannot be empty.');
377377
}
378378
$this->calls[] = array($method, $arguments);
379379

8000

src/Symfony/Component/DependencyInjection/Dumper/YamlDumper.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -93,19 +93,19 @@ private function addService($id, $definition)
9393
}
9494

9595
if ($definition->isSynthetic()) {
96-
$code .= sprintf(" synthetic: true\n");
96+
$code .= " synthetic: true\n";
9797
}
9898

9999
if ($definition->isSynchronized(false)) {
100-
$code .= sprintf(" synchronized: true\n");
100+
$code .= " synchronized: true\n";
101101
}
102102

103103
if ($definition->getFactoryClass(false)) {
104104
$code .= sprintf(" factory_class: %s\n", $this->dumper->dump($definition->getFactoryClass(false)));
105105
}
106106

107107
if ($definition->isLazy()) {
108-
$code .= sprintf(" lazy: true\n");
108+
$code .= " lazy: true\n";
109109
}
110110

111111
if ($definition->getFactoryMethod(false)) {

src/Symfony/Component/HttpFoundation/ParameterBag.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -129,7 +129,7 @@ public function get($path, $default = null, $deep = false)
129129
}
130130

131131
if (null !== $currentKey) {
132-
throw new \InvalidArgumentException(sprintf('Malformed path. Path must end with "]".'));
132+
throw new \InvalidArgumentException('Malformed path. Path must end with "]".');
133133
}
134134

135135
return $value;

src/Symfony/Component/Validator/Validator.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -151,7 +151,7 @@ public function validatePropertyValue($containingValue, $property, $value, $grou
151151
? '"'.$containingValue.'"'
152152
: 'the value of type '.gettype($containingValue);
153153

154-
throw new ValidatorException(sprintf('The metadata for '.$valueAsString.' does not support properties.'));
154+
throw new ValidatorException(sprintf('The metadata for %s does not support properties.', $valueAsString));
155155
}
156156

157157
// If $containingValue is passed as class name, take $value as root

0 commit comments

Comments
 (0)
0