diff --git a/.editorconfig b/.editorconfig new file mode 100644 index 0000000..a7c44dd --- /dev/null +++ b/.editorconfig @@ -0,0 +1,15 @@ +root = true + +[*] +charset = utf-8 +indent_size = 4 +indent_style = space +end_of_line = lf +insert_final_newline = true +trim_trailing_whitespace = true + +[*.md] +trim_trailing_whitespace = false + +[*.{yml,yaml}] +indent_size = 2 diff --git a/.gitattributes b/.gitattributes new file mode 100644 index 0000000..946ed92 --- /dev/null +++ b/.gitattributes @@ -0,0 +1,13 @@ +# Path-based git attributes +# https://www.kernel.org/pub/software/scm/git/docs/gitattributes.html + +# Ignore all test and documentation with "export-ignore". +/.gitattributes export-ignore +/.gitignore export-ignore +/phpunit.xml.dist export-ignore +/tests export-ignore +/.editorconfig export-ignore +/.php_cs export-ignore +/.github export-ignore +/psalm.xml export-ignore + diff --git a/README.md b/README.md index a979162..72f71c5 100644 --- a/README.md +++ b/README.md @@ -28,7 +28,7 @@ Install this package via [Composer](https://getcomposer.org/). composer require stichoza/google-translate-php ``` -> Note: **PHP 7.1 or later** is required. For older versoins, use `^3.2` version of this package (see [old docs](https://github.com/Stichoza/google-translate-php/tree/3.2#google-translate-php)). +> Note: **PHP 7.1 or later** is required. For older versions, use `^3.2` version of this package (see [old docs](https://github.com/Stichoza/google-translate-php/tree/3.2#google-translate-php)). ## Basic Usage @@ -143,7 +143,7 @@ use Stichoza\GoogleTranslate\Tokens\TokenProviderInterface; class MyTokenGenerator implements TokenProviderInterface { - public function generateToken(string $source, string $target, string $text) : string + public function generateToken(string $source, string $target, string $text): string { // Your code here } @@ -182,15 +182,15 @@ In addition, `translate()` and `trans()` methods will return `null` if there is - `403 Forbidden` response: This is not an issue with this package. Google Translate itself has some problems when it comes to translating some characters and HTML entities. See https://github.com/Stichoza/google-translate-php/issues/119#issuecomment-558078133 - + ## Disclaimer This package is developed for educational purposes only. Do not depend on this package as it may break anytime as it is based on crawling the Google Translate website. Consider buying [Official Google Translate API](https://cloud.google.com/translate/) for other types of usage. ## Donation -If this package helped you reduce your time to develop something, or it solved any major problems you had, feel free give me a cup of coffee :) +If this package helped you reduce your time to develop something, or it solved any major problems you had, feel free to give me a cup of coffee :) - [Patreon](https://www.patreon.com/stichoza) - [PayPal](https://paypal.me/stichoza) - + diff --git a/phpunit.xml b/phpunit.xml index 4e88f4d..bc4d05c 100644 --- a/phpunit.xml +++ b/phpunit.xml @@ -7,11 +7,10 @@ convertNoticesToExceptions="true" convertWarningsToExceptions="true" processIsolation="false" - stopOnFailure="false" - syntaxCheck="false"> + stopOnFailure="false"> ./tests/ - \ No newline at end of file + diff --git a/tests/TranslationTest.php b/tests/TranslationTest.php index b661ead..bfc4487 100644 --- a/tests/TranslationTest.php +++ b/tests/TranslationTest.php @@ -42,6 +42,6 @@ public function testRawResponse() { $rawResult = $this->tr->getResponse('cat'); - $this->assertTrue(is_array($rawResult), 'Method getResponse() should return an array.'); + $this->assertIsArray($rawResult, 'Method getResponse() should return an array'); } }