Skip to content

Commit

Permalink
Merge pull request #12 from Skysplit/fix-invalid-key
Browse files Browse the repository at this point in the history
Fix type-error in getMessage() if $item is null
  • Loading branch information
duxthefux authored Apr 24, 2020
2 parents eb95282 + 08442c4 commit a5d38b1
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion src/Translator.php
Original file line number Diff line number Diff line change
Expand Up @@ -260,10 +260,14 @@ public function getMessage(string $key, ?string $locale = null)

$locales = [$locale ?: $this->locale];

$message = null;

foreach ($locales as $locale) {
$this->load($namespace, $group, $locale);

$message = $this->getLine($namespace, $group, $locale, $item);
if ($item !== null) {
$message = $this->getLine($namespace, $group, $locale, $item);
}

if ($message !== null) {
break;
Expand Down

0 comments on commit a5d38b1

Please sign in to comment.