Skip to content

Commit 81dc8e3

Browse files
mpajunennicolas-grekas
authored andcommitted
Replace is_callable checks with type hints
Also removes tests checking the exceptions thrown from the removed is_callable checks.
1 parent d3926d0 commit 81dc8e3

File tree

1 file changed

+3
-9
lines changed

1 file changed

+3
-9
lines changed

PluralizationRules.php

Lines changed: 3 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -189,12 +189,10 @@ public static function get($number, $locale)
189189
/**
190190
* Overrides the default plural rule for a given locale.
191191
*
192-
* @param string $rule A PHP callable
193-
* @param string $locale The locale
194-
*
195-
* @throws \LogicException
192+
* @param callable $rule A PHP callable
193+
* @param string $locale The locale
196194
*/
197-
public static function set($rule, $locale)
195+
public static function set(callable $rule, $locale)
198196
{
199197
if ('pt_BR' === $locale) {
200198
// temporary set a locale for brazilian
@@ -205,10 +203,6 @@ public static function set($rule, $locale)
205203
$locale = substr($locale, 0, -strlen(strrchr($locale, '_')));
206204
}
207205

208-
if (!is_callable($rule)) {
209-
throw new \LogicException('The given rule can not be called');
210-
}
211-
212206
self::$rules[$locale] = $rule;
213207
}
214208
}

0 commit comments

Comments
 (0)