Skip to content

Commit

Permalink
Simplified key insertion logic
Browse files Browse the repository at this point in the history
  • Loading branch information
jaxwilko committed Jan 27, 2022
1 parent 1ca70f3 commit 4314dfe
Showing 1 changed file with 4 additions and 5 deletions.
9 changes: 4 additions & 5 deletions src/Config/ConfigFile.php
Original file line number Diff line number Diff line change
Expand Up @@ -212,11 +212,10 @@ protected function castArray(array $array): Array_
{
return ($caster = function ($array, $ast) use (&$caster) {
$useKeys = [];
$keys = array_keys($array);
for ($i = 0; $i < count($keys); $i++) {
$useKeys[$keys[$i]] = false;
if (!is_numeric($keys[$i]) || $keys[$i] !== $i) {
$useKeys[$keys[$i]] = true;
foreach (array_keys($array) as $i => $key) {
$useKeys[$key] = false;
if (!is_numeric($key) || $key !== $i) {
$useKeys[$key] = true;
}
}
foreach ($array as $key => $item) {
Expand Down

0 comments on commit 4314dfe

Please sign in to comment.