Skip to content

Commit 9a9ba27

Browse files
kalessilfabpot
authored andcommitted
[2.3] Static Code Analysis for Components
1 parent d7e8b0b commit 9a9ba27

File tree

4 files changed

+4
-4
lines changed

4 files changed

+4
-4
lines changed

Compiler/ResolveDefinitionTemplatesPass.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ public function process(ContainerBuilder $container)
3939
$this->compiler = $container->getCompiler();
4040
$this->formatter = $this->compiler->getLoggingFormatter();
4141

42-
foreach (array_keys($container->getDefinitions()) as $id) {
42+
foreach ($container->getDefinitions() as $id => $definition) {
4343
// yes, we are specifically fetching the definition from the
4444
// container to ensure we are not operating on stale data
4545
$definition = $container->getDefinition($id);

Container.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -312,7 +312,7 @@ public function get($id, $invalidBehavior = self::EXCEPTION_ON_INVALID_REFERENCE
312312
}
313313

314314
$alternatives = array();
315-
foreach (array_keys($this->services) as $key) {
315+
foreach ($this->services as $key => $associatedService) {
316316
$lev = levenshtein($id, $key);
317317
if ($lev <= strlen($id) / 3 || false !== strpos($key, $id)) {
318318
$alternatives[] = $key;

Loader/YamlFileLoader.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -304,7 +304,7 @@ private function validate($content, $file)
304304
throw new InvalidArgumentException(sprintf('The service file "%s" is not valid. It should contain an array. Check your YAML syntax.', $file));
305305
}
306306

307-
foreach (array_keys($content) as $namespace) {
307+
foreach ($content as $namespace => $data) {
308308
if (in_array($namespace, array('imports', 'parameters', 'services'))) {
309309
continue;
310310
}

ParameterBag/ParameterBag.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -98,7 +98,7 @@ public function get($name)
9898
}
9999

100100
$alternatives = array();
101-
foreach (array_keys($this->parameters) as $key) {
101+
foreach ($this->parameters as $key => $parameterValue) {
102102
$lev = levenshtein($name, $key);
103103
if ($lev <= strlen($name) / 3 || false !== strpos($key, $name)) {
104104
$alternatives[] = $key;

0 commit comments

Comments
 (0)