Skip to content

Commit

Permalink
Add and fix return types
Browse files Browse the repository at this point in the history
  • Loading branch information
Stichoza committed Feb 11, 2020
1 parent 18920ba commit f5b8be4
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions src/GoogleTranslate.php
Original file line number Diff line number Diff line change
Expand Up @@ -179,7 +179,7 @@ public function setTokenProvider(TokenProviderInterface $tokenProvider): self
*
* @return string|null Last detected source language
*/
public function getLastDetectedSource()
public function getLastDetectedSource(): ?string
{
return $this->lastDetectedSource;
}
Expand All @@ -196,7 +196,7 @@ public function getLastDetectedSource()
* @throws ErrorException If the HTTP request fails
* @throws UnexpectedValueException If received data cannot be decoded
*/
public static function trans(string $string, string $target = 'en', string $source = null, array $options = [], TokenProviderInterface $tokenProvider = null)
public static function trans(string $string, string $target = 'en', string $source = null, array $options = [], TokenProviderInterface $tokenProvider = null): ?string
{
return (new self)
->setTokenProvider($tokenProvider ?? new GoogleTokenGenerator)
Expand All @@ -217,7 +217,7 @@ public static function trans(string $string, string $target = 'en', string $sour
* @throws ErrorException If the HTTP request fails
* @throws UnexpectedValueException If received data cannot be decoded
*/
public function translate(string $string): string
public function translate(string $string): ?string
{
/*
* if source lang and target lang are the same
Expand Down

0 comments on commit f5b8be4

Please sign in to comment.