Skip to content

Commit 2c551d2

Browse files
dantleechfabpot
authored andcommitted
Enforce sprintf for exceptions
1 parent 8f54044 commit 2c551d2

File tree

1 file changed

+4
-7
lines changed

1 file changed

+4
-7
lines changed

Command/ConfigDumpReferenceCommand.php

Lines changed: 4 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -84,7 +84,7 @@ protected function execute(InputInterface $input, OutputInterface $output)
8484
}
8585

8686
if (!$extension) {
87-
throw new \LogicException('No extensions with configuration available for "'.$name.'"');
87+
throw new \LogicException(sprintf('No extensions with configuration available for "%s"', $name));
8888
}
8989

9090
$message = 'Default configuration for "'.$name.'"';
@@ -100,7 +100,7 @@ protected function execute(InputInterface $input, OutputInterface $output)
100100
}
101101

102102
if (!$extension) {
103-
throw new \LogicException('No extension with alias "'.$name.'" is enabled');
103+
throw new \LogicException(sprintf('No extension with alias "%s" is enabled', $name));
104104
}
105105

106106
$message = 'Default configuration for extension with alias: "'.$name.'"';
@@ -109,14 +109,11 @@ protected function execute(InputInterface $input, OutputInterface $output)
109109
$configuration = $extension->getConfiguration(array(), $containerBuilder);
110110

111111
if (!$configuration) {
112-
throw new \LogicException('The extension with alias "'.$extension->getAlias().
113-
'" does not have it\'s getConfiguration() method setup');
112+
throw new \LogicException(sprintf('The extension with alias "%s" does not have it\'s getConfiguration() method setup', $extension->getAlias()));
114113
}
115114

116115
if (!$configuration instanceof ConfigurationInterface) {
117-
throw new \LogicException(
118-
'Configuration class "'.get_class($configuration).
119-
'" should implement ConfigurationInterface in order to be dumpable');
116+
throw new \LogicException(sprintf('Configuration class "%s" should implement ConfigurationInterface in order to be dumpable', get_class($configuration)));
120117
}
121118

122119
$output->writeln($message);

0 commit comments

Comments
 (0)