Skip to content

Commit

Permalink
fix: strict types implementation for translate method
Browse files Browse the repository at this point in the history
  • Loading branch information
universe-42 committed Jan 10, 2019
1 parent c43b7f9 commit 0dbd10a
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion src/Translate/Translator.php
Expand Up @@ -77,7 +77,7 @@ public function setLocale(string $locale): TranslatorInterface
}


public function translate($message, int $count = NULL): string
public function translate($message, ...$parameters): string
{
// avoid processing for empty values
if ($message === NULL || $message === '') {
Expand All @@ -89,6 +89,8 @@ public function translate($message, int $count = NULL): string
$message = (string) $message;
}

$count = isset($parameters[0]) ? $parameters[0] : NULL;

// numbers are formatted using locale settings (count parameter is used to define decimals)
if (is_numeric($message)) {
return $this->formatNumber($message, (int) $count);
Expand Down

0 comments on commit 0dbd10a

Please sign in to comment.