diff --git a/resources/helpers.php b/resources/helpers.php index 55ee80f..c25b5ed 100644 --- a/resources/helpers.php +++ b/resources/helpers.php @@ -97,7 +97,13 @@ function array_undot(array $dotNotationArray) { $array = []; foreach ($dotNotationArray as $key => $value) { - array_set($array, $key, $value); + // if there is a space after the dot, this could legitimately be + // a single key and not nested. + if (count(explode('. ', $key)) > 1) { + $array[$key] = $value; + } else { + array_set($array, $key, $value); + } } return $array; diff --git a/src/Drivers/File.php b/src/Drivers/File.php index a650dbd..98ce87d 100644 --- a/src/Drivers/File.php +++ b/src/Drivers/File.php @@ -277,7 +277,7 @@ private function saveGroupTranslations($language, $group, $translations) */ private function saveNamespacedGroupTranslations($language, $group, $translations) { - list($namespace, $group) = explode('::', $group); + [$namespace, $group] = explode('::', $group); $directory = "{$this->languageFilesPath}".DIRECTORY_SEPARATOR.'vendor'.DIRECTORY_SEPARATOR."{$namespace}".DIRECTORY_SEPARATOR."{$language}"; if (! $this->disk->exists($directory)) { diff --git a/src/Scanner.php b/src/Scanner.php index ab2b4e6..846056c 100644 --- a/src/Scanner.php +++ b/src/Scanner.php @@ -47,7 +47,7 @@ public function findTranslations() if (preg_match_all("/$matchingPattern/siU", $file->getContents(), $matches)) { foreach ($matches[2] as $key) { if (preg_match("/(^[a-zA-Z0-9:_-]+([.][^\1)\ ]+)+$)/siU", $key, $arrayMatches)) { - list($file, $k) = explode('.', $arrayMatches[0], 2); + [$file, $k] = explode('.', $arrayMatches[0], 2); $results['group'][$file][$k] = ''; continue; } else {