Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add phpstan-return annotation to translateText #41

Merged
merged 1 commit into from
Feb 16, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion src/Translator.php
Original file line number Diff line number Diff line change
Expand Up @@ -143,11 +143,12 @@ public function getGlossaryLanguages(): array

/**
* Translates specified text string or array of text strings into the target language.
* @param $texts string|string[] A single string or array of strings containing input texts to translate.
* @param string|string[] $texts A single string or array of strings containing input texts to translate.
* @param string|null $sourceLang Language code of input text language, or null to use auto-detection.
* @param string $targetLang Language code of language to translate into.
* @param array $options Translation options to apply. See \DeepL\TranslateTextOptions.
* @return TextResult|TextResult[] A TextResult or array of TextResult objects containing translated texts.
* @phpstan-return ($texts is array ? TextResult[] : TextResult)
JanEbbing marked this conversation as resolved.
Show resolved Hide resolved
* @throws DeepLException
* @see \DeepL\TranslateTextOptions
*/
Expand Down