Skip to content

Commit

Permalink
Merge branch 'development'
Browse files Browse the repository at this point in the history
  • Loading branch information
natanfelles committed Mar 22, 2024
2 parents a822a2c + 34c2a03 commit 98ffe39
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 2 deletions.
7 changes: 5 additions & 2 deletions src/Language.php
Original file line number Diff line number Diff line change
Expand Up @@ -586,12 +586,15 @@ protected function reindex() : void
/**
* Sets the Fallback Level.
*
* @param FallbackLevel $level
* @param FallbackLevel|int $level
*
* @return static
*/
public function setFallbackLevel(FallbackLevel $level) : static
public function setFallbackLevel(FallbackLevel|int $level) : static
{
if (\is_int($level)) {
$level = FallbackLevel::from($level);
}
$this->fallbackLevel = $level;
return $this;
}
Expand Down
7 changes: 7 additions & 0 deletions tests/LanguageTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -133,6 +133,13 @@ public function testFallbackLevel() : void
self::assertSame(FallbackLevel::default, $this->language->getFallbackLevel());
$this->language->setFallbackLevel(FallbackLevel::none);
self::assertSame(FallbackLevel::none, $this->language->getFallbackLevel());
$this->language->setFallbackLevel(1);
self::assertSame(FallbackLevel::parent, $this->language->getFallbackLevel());
$this->expectException(\ValueError::class);
$this->expectExceptionMessage(
'5 is not a valid backing value for enum Framework\Language\FallbackLevel'
);
$this->language->setFallbackLevel(5);
}

public function testLang() : void
Expand Down

0 comments on commit 98ffe39

Please sign in to comment.