Skip to content

Commit

Permalink
chore: general improvements
Browse files Browse the repository at this point in the history
This commit adds configuration files `.gitattributes` and
`.editorconfig`

It also fixes some typos on README.md, remove a warning regarding
PHPUnit and also uses a dedicated PHPUnit assertion.
  • Loading branch information
chapeupreto committed Oct 7, 2021
1 parent 85039e0 commit fbe23db
Show file tree
Hide file tree
Showing 5 changed files with 36 additions and 9 deletions.
15 changes: 15 additions & 0 deletions .editorconfig
Original file line number Diff line number Diff line change
@@ -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
13 changes: 13 additions & 0 deletions .gitattributes
Original file line number Diff line number Diff line change
@@ -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

10 changes: 5 additions & 5 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down Expand Up @@ -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
}
Expand Down Expand Up @@ -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)

5 changes: 2 additions & 3 deletions phpunit.xml
Original file line number Diff line number Diff line change
Expand Up @@ -7,11 +7,10 @@
convertNoticesToExceptions="true"
convertWarningsToExceptions="true"
processIsolation="false"
stopOnFailure="false"
syntaxCheck="false">
stopOnFailure="false">
<testsuites>
<testsuite name="Application Test Suite">
<directory>./tests/</directory>
</testsuite>
</testsuites>
</phpunit>
</phpunit>
2 changes: 1 addition & 1 deletion tests/TranslationTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -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');
}
}

0 comments on commit fbe23db

Please sign in to comment.