Skip to content

Commit d14b313

Browse files
kalessilfabpot
authored andcommitted
[2.3] Static Code Analysis for Components
1 parent 95e3cbe commit d14b313

File tree

4 files changed

+6
-6
lines changed

4 files changed

+6
-6
lines changed

Container.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -536,6 +536,6 @@ public static function camelize($id)
536536
*/
537537
public static function underscore($id)
538538
{
539-
return strtolower(preg_replace(array('/([A-Z]+)([A-Z][a-z])/', '/([a-z\d])([A-Z])/'), array('\\1_\\2', '\\1_\\2'), strtr($id, '_', '.')));
539+
return strtolower(preg_replace(array('/([A-Z]+)([A-Z][a-z])/', '/([a-z\d])([A-Z])/'), array('\\1_\\2', '\\1_\\2'), str_replace('_', '.', $id)));
540540
}
541541
}

Extension/Extension.php

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -91,9 +91,7 @@ public function getConfiguration(array $config, ContainerBuilder $container)
9191
$container->addResource(new FileResource($r->getFileName()));
9292

9393
if (!method_exists($class, '__construct')) {
94-
$configuration = new $class();
95-
96-
return $configuration;
94+
return new $class();
9795
}
9896
}
9997
}

Loader/XmlFileLoader.php

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -91,8 +91,9 @@ private function parseImports(SimpleXMLElement $xml, $file)
9191
return;
9292
}
9393

94+
$defaultDirectory = dirname($file);
9495
foreach ($imports as $import) {
95-
$this->setCurrentDir(dirname($file));
96+
$this->setCurrentDir($defaultDirectory);
9697
$this->import((string) $import['resource'], null, (bool) $import->getAttributeAsPhp('ignore-errors'), $file);
9798
}
9899
}

Loader/YamlFileLoader.php

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -94,12 +94,13 @@ private function parseImports($content, $file)
9494
throw new InvalidArgumentException(sprintf('The "imports" key should contain an array in %s. Check your YAML syntax.', $file));
9595
}
9696

97+
$defaultDirectory = dirname($file);
9798
foreach ($content['imports'] as $import) {
9899
if (!is_array($import)) {
99100
throw new InvalidArgumentException(sprintf('The values in the "imports" key should be arrays in %s. Check your YAML syntax.', $file));
100101
}
101102

102-
$this->setCurrentDir(dirname($file));
103+
$this->setCurrentDir($defaultDirectory);
103104
$this->import($import['resource'], null, isset($import['ignore_errors']) ? (bool) $import['ignore_errors'] : false, $file);
104105
}
105106
}

0 commit comments

Comments
 (0)