Skip to content

Commit

Permalink
Extend Psalm type for parameters (#42)
Browse files Browse the repository at this point in the history
  • Loading branch information
Fantom409 committed Mar 26, 2021
1 parent 35a4493 commit 70397ac
Show file tree
Hide file tree
Showing 4 changed files with 7 additions and 0 deletions.
2 changes: 2 additions & 0 deletions src/CategorySource.php
Expand Up @@ -47,6 +47,8 @@ public function getMessage(string $id, string $locale, array $parameters = []):
*
* @param string $message Message to be formatted.
* @param array $parameters Parameters to use.
* @psalm-param array<array-key, mixed> $parameters
*
* @param string $locale Locale to use. Usually affects formatting numbers, dates etc.
*
* @return string Formatted message.
Expand Down
2 changes: 2 additions & 0 deletions src/MessageFormatterInterface.php
Expand Up @@ -14,6 +14,8 @@ interface MessageFormatterInterface
*
* @param string $message A message to format.
* @param array $parameters Parameters to replace in the message in `['name1' => 'value1', 'name2' => 'value2']` format.
* @psalm-param array<array-key, mixed> $parameters
*
* @param string $locale Locale to use when formatting. Usually affects formatting numbers, dates etc.
*
* @return string Formatted message.
Expand Down
1 change: 1 addition & 0 deletions src/Translator.php
Expand Up @@ -88,6 +88,7 @@ public function translate(
return $this->translateUsingCategorySources($id, $parameters, $category, $locale);
}

/** @psalm-param array<array-key, mixed> $parameters */
private function translateUsingCategorySources(
string $id,
array $parameters,
Expand Down
2 changes: 2 additions & 0 deletions src/TranslatorInterface.php
Expand Up @@ -36,6 +36,8 @@ public function getLocale(): string;
*
* @param string $id The ID of the message to be translated. It can be either artificial ID or the source message.
* @param array $parameters An array of parameters for the message.
* @psalm-param array<array-key, mixed> $parameters
*
* @param string|null $category The message category. Null means default category.
* @param string|null $locale The target locale. Null means default locale.
*
Expand Down

0 comments on commit 70397ac

Please sign in to comment.