Skip to content

Commit f5b8be4

Browse files
committed
Add and fix return types
1 parent 18920ba commit f5b8be4

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

src/GoogleTranslate.php

+3-3
Original file line numberDiff line numberDiff line change
@@ -179,7 +179,7 @@ public function setTokenProvider(TokenProviderInterface $tokenProvider): self
179179
*
180180
* @return string|null Last detected source language
181181
*/
182-
public function getLastDetectedSource()
182+
public function getLastDetectedSource(): ?string
183183
{
184184
return $this->lastDetectedSource;
185185
}
@@ -196,7 +196,7 @@ public function getLastDetectedSource()
196196
* @throws ErrorException If the HTTP request fails
197197
* @throws UnexpectedValueException If received data cannot be decoded
198198
*/
199-
public static function trans(string $string, string $target = 'en', string $source = null, array $options = [], TokenProviderInterface $tokenProvider = null)
199+
public static function trans(string $string, string $target = 'en', string $source = null, array $options = [], TokenProviderInterface $tokenProvider = null): ?string
200200
{
201201
return (new self)
202202
->setTokenProvider($tokenProvider ?? new GoogleTokenGenerator)
@@ -217,7 +217,7 @@ public static function trans(string $string, string $target = 'en', string $sour
217217
* @throws ErrorException If the HTTP request fails
218218
* @throws UnexpectedValueException If received data cannot be decoded
219219
*/
220-
public function translate(string $string): string
220+
public function translate(string $string): ?string
221221
{
222222
/*
223223
* if source lang and target lang are the same

0 commit comments

Comments
 (0)