ConfigInspectorManager.php, convertConfigElementToList()
This set of nested for loop accidently works, despite the fact that $element is used in both loops
This is brittle code and will likely break, if there is any attempt to extend it..
public function convertConfigElementToList($schema) {
$list = array();
foreach ($schema as $key => $element) {
if ($element instanceof Element) {
$list[$key] = $element;
foreach ($this->convertConfigElementToList($element) as $sub_key => $element) {
$list[$key . '.' . $sub_key] = $element;
}
}
else {
$list[$key] = $element;
}
}
return $list;
}
It show up in a lint checker, under probably a bug as :-
The 'element' variable is used as a value by a foreach loop is already used in the same way by the outer foreach loop.
So the solution is cosmetic, that is why I have not graded it as a bug...it will only save the sanity of the next coder to ready this!
Comments
Comment #1
vijaycs85good catch!
Comment #2
gábor hojtsySuperb, thanks for finding this :)