Skip to content

Commit

Permalink
Fix Key::resolveParentKey traversal process (#151)
Browse files Browse the repository at this point in the history
  • Loading branch information
kaelansmith authored Jul 9, 2024
1 parent 349cb06 commit b75502f
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/Key.php
Original file line number Diff line number Diff line change
Expand Up @@ -58,14 +58,14 @@ public static function resolveParentKey(string|null $parentKey, string $key): st
$parentKeyPieces = explode('_', $parentKey);

while (count($parentKeyPieces) > 1) {
array_pop($parentKeyPieces);

$potentialParentKey = implode('_', $parentKeyPieces);
$potentialKey = $potentialParentKey . '_' . $key;

if (array_key_exists($potentialKey, self::$keys)) {
return $potentialParentKey;
}

array_pop($parentKeyPieces);
}

return $parentKey;
Expand Down

0 comments on commit b75502f

Please sign in to comment.