Skip to content

Commit

Permalink
Implemented #8
Browse files Browse the repository at this point in the history
  • Loading branch information
olvlvl committed Aug 23, 2016
1 parent bf4f4b9 commit 0b1d2b3
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
4 changes: 2 additions & 2 deletions lib/DateTime/Shared.php
Original file line number Diff line number Diff line change
Expand Up @@ -346,15 +346,15 @@ public function change(array $options, $cascade = false)
*
* @return mixed
*
* @throws \RuntimeException if {@link $localizer} is not defined.
* @throws \LogicException if {@link $localizer} is not defined.
*/
public function localize($locale = 'en')
{
$localizer = DateTime::$localizer;

if (!$localizer)
{
throw new \RuntimeException("Localizer is not defined yet.");
throw new \LogicException("Localizer is not defined yet.");
}

return $localizer($this, $locale);
Expand Down
2 changes: 1 addition & 1 deletion tests/AbstractDateTimeTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -928,7 +928,7 @@ public function test_json_serialize()
}

/**
* @expectedException \RuntimeException
* @expectedException \LogicException
*/
public function test_localize_should_throw_an_exception_if_the_localizer_is_not_defined_yet()
{
Expand Down

0 comments on commit 0b1d2b3

Please sign in to comment.