Skip to content

Commit f232b6e

Browse files
committed
feat: apply finalize test case class and declare strict types
1 parent 2891310 commit f232b6e

14 files changed

Lines changed: 35 additions & 7 deletions

src/Exceptions/LanguagesRequestException.php

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
11
<?php
22

3+
declare(strict_types=1);
4+
35
namespace Stichoza\GoogleTranslate\Exceptions;
46

57
use ErrorException;

src/Exceptions/LargeTextException.php

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
11
<?php
22

3+
declare(strict_types=1);
4+
35
namespace Stichoza\GoogleTranslate\Exceptions;
46

57
use ErrorException;

src/Exceptions/RateLimitException.php

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
11
<?php
22

3+
declare(strict_types=1);
4+
35
namespace Stichoza\GoogleTranslate\Exceptions;
46

57
use ErrorException;

src/Exceptions/TranslationDecodingException.php

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
11
<?php
22

3+
declare(strict_types=1);
4+
35
namespace Stichoza\GoogleTranslate\Exceptions;
46

57
use UnexpectedValueException;

src/Exceptions/TranslationRequestException.php

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
11
<?php
22

3+
declare(strict_types=1);
4+
35
namespace Stichoza\GoogleTranslate\Exceptions;
46

57
use ErrorException;

src/GoogleTranslate.php

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
11
<?php
22

3+
declare(strict_types=1);
4+
35
namespace Stichoza\GoogleTranslate;
46

57
use DOMDocument;
@@ -26,7 +28,7 @@
2628
class GoogleTranslate
2729
{
2830
/**
29-
* @var \GuzzleHttp\Client HTTP Client
31+
* @var Client HTTP Client
3032
*/
3133
protected Client $client;
3234

src/Tokens/GoogleTokenGenerator.php

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
11
<?php
22

3+
declare(strict_types=1);
4+
35
namespace Stichoza\GoogleTranslate\Tokens;
46

57
/**
@@ -22,7 +24,7 @@ public function generateToken(string $source, string $target, string $text): str
2224
{
2325
$tkk = ['406398', 2087938574];
2426

25-
for ($d = [], $e = 0, $f = 0; $f < $this->length($text); $f++) {
27+
for ($d = [], $e = 0, $f = 0; $f < $this->length($text); ++$f) {
2628
$g = $this->charCodeAt($text, $f);
2729
if ($g < 128) {
2830
$d[$e++] = $g;

src/Tokens/SampleTokenGenerator.php

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
11
<?php
22

3+
declare(strict_types=1);
4+
35
namespace Stichoza\GoogleTranslate\Tokens;
46

57
/**

src/Tokens/TokenProviderInterface.php

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
11
<?php
22

3+
declare(strict_types=1);
4+
35
namespace Stichoza\GoogleTranslate\Tokens;
46

57
/**

tests/ExceptionTest.php

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
11
<?php
22

3+
declare(strict_types=1);
4+
35
namespace Stichoza\GoogleTranslate\Tests;
46

57
use ErrorException;
@@ -12,7 +14,7 @@
1214
use Stichoza\GoogleTranslate\GoogleTranslate;
1315
use UnexpectedValueException;
1416

15-
class ExceptionTest extends TestCase
17+
final class ExceptionTest extends TestCase
1618
{
1719
public GoogleTranslate $tr;
1820

0 commit comments

Comments
 (0)