Skip to content

Commit

Permalink
Update php-cs-fixer issues
Browse files Browse the repository at this point in the history
  • Loading branch information
denisyukphp committed Mar 30, 2023
1 parent bd2f904 commit 4610cbf
Show file tree
Hide file tree
Showing 13 changed files with 16 additions and 94 deletions.
53 changes: 0 additions & 53 deletions .github/workflows/continuous-integration.yml

This file was deleted.

21 changes: 0 additions & 21 deletions LICENSE.txt

This file was deleted.

2 changes: 1 addition & 1 deletion src/Generator/Generator.php
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,8 @@

use Orangesoft\BackOff\Duration\DurationInterface;
use Orangesoft\BackOff\Duration\Nanoseconds;
use Orangesoft\BackOff\Strategy\StrategyInterface;
use Orangesoft\BackOff\Jitter\JitterInterface;
use Orangesoft\BackOff\Strategy\StrategyInterface;

final class Generator implements GeneratorInterface
{
Expand Down
8 changes: 2 additions & 6 deletions src/Retry/ExceptionClassifier/ExceptionClassifier.php
Original file line number Diff line number Diff line change
Expand Up @@ -12,19 +12,15 @@ final class ExceptionClassifier implements ExceptionClassifierInterface
public function __construct(
private array $classNames = [],
) {
if (0 === count($classNames)) {
if (0 === \count($classNames)) {
$this->classNames = [
\Error::class,
\Exception::class,
];
} else {
foreach ($classNames as $className) {
if (!class_exists($className) || !is_a($className, \Throwable::class, true)) {
throw new \InvalidArgumentException(
vsprintf('Exception class must be a class that exists and can be thrown, "%s" given.', [
get_debug_type($className),
])
);
throw new \InvalidArgumentException(vsprintf('Exception class must be a class that exists and can be thrown, "%s" given.', [get_debug_type($className)]));
}

$this->classNames[] = $className;
Expand Down
2 changes: 1 addition & 1 deletion src/Retry/Retry.php
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ public function call(callable $callback, array $args = []): mixed

$this->backOff->backOff($attempt, $throwable);

$attempt++;
++$attempt;

goto retrying;
}
Expand Down
2 changes: 1 addition & 1 deletion tests/ExponentialBackOffTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@

namespace Orangesoft\BackOff\Tests;

use Orangesoft\BackOff\ExponentialBackOff;
use Orangesoft\BackOff\Duration\Nanoseconds;
use Orangesoft\BackOff\ExponentialBackOff;
use Orangesoft\BackOff\Jitter\NullJitter;
use Orangesoft\BackOff\Sleeper\Sleeper;
use PHPUnit\Framework\TestCase;
Expand Down
6 changes: 3 additions & 3 deletions tests/Generator/GeneratorTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,12 +4,12 @@

namespace Orangesoft\BackOff\Tests\Generator;

use Orangesoft\BackOff\Generator\Generator;
use Orangesoft\BackOff\Duration\Nanoseconds;
use Orangesoft\BackOff\Generator\Generator;
use Orangesoft\BackOff\Jitter\EqualJitter;
use Orangesoft\BackOff\Jitter\NullJitter;
use Orangesoft\BackOff\Strategy\ConstantStrategy;
use Orangesoft\BackOff\Strategy\LinearStrategy;
use Orangesoft\BackOff\Jitter\NullJitter;
use Orangesoft\BackOff\Jitter\EqualJitter;
use PHPUnit\Framework\TestCase;

class GeneratorTest extends TestCase
Expand Down
2 changes: 1 addition & 1 deletion tests/LinearBackOffTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,9 @@

namespace Orangesoft\BackOff\Tests;

use Orangesoft\BackOff\LinearBackOff;
use Orangesoft\BackOff\Duration\Nanoseconds;
use Orangesoft\BackOff\Jitter\NullJitter;
use Orangesoft\BackOff\LinearBackOff;
use Orangesoft\BackOff\Sleeper\Sleeper;
use PHPUnit\Framework\TestCase;

Expand Down
6 changes: 3 additions & 3 deletions tests/Retry/RetryTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ public function testReturnValue(): void
exceptionClassifier: new ExceptionClassifier(),
);

$result = $retry->call(fn(int $a, int $b): int => $a + $b, [5, 10]);
$result = $retry->call(fn (int $a, int $b): int => $a + $b, [5, 10]);

$this->assertSame(15, $result);
}
Expand All @@ -34,7 +34,7 @@ public function testThrowException(): void

$this->expectExceptionObject($throwable);

$retry->call(fn() => throw $throwable);
$retry->call(fn () => throw $throwable);
}

public function testAttemptsCounter(): void
Expand All @@ -45,7 +45,7 @@ public function testAttemptsCounter(): void
);

try {
$retry->call(fn() => throw new \Exception());
$retry->call(fn () => throw new \Exception());
} catch (\Exception) {
$this->assertSame(3, $attemptsCounterBackOff->getLastAttempt());
}
Expand Down
2 changes: 1 addition & 1 deletion tests/Strategy/ConstantStrategyTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@

namespace Orangesoft\BackOff\Tests\Strategy;

use Orangesoft\BackOff\Strategy\ConstantStrategy;
use Orangesoft\BackOff\Duration\Nanoseconds;
use Orangesoft\BackOff\Strategy\ConstantStrategy;
use PHPUnit\Framework\TestCase;

class ConstantStrategyTest extends TestCase
Expand Down
2 changes: 1 addition & 1 deletion tests/Strategy/DecorrelatedStrategyTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@

namespace Orangesoft\BackOff\Tests\Strategy;

use Orangesoft\BackOff\Strategy\DecorrelatedStrategy;
use Orangesoft\BackOff\Duration\Nanoseconds;
use Orangesoft\BackOff\Strategy\DecorrelatedStrategy;
use PHPUnit\Framework\TestCase;

class DecorrelatedStrategyTest extends TestCase
Expand Down
2 changes: 1 addition & 1 deletion tests/Strategy/ExponentialStrategyTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@

namespace Orangesoft\BackOff\Tests\Strategy;

use Orangesoft\BackOff\Strategy\ExponentialStrategy;
use Orangesoft\BackOff\Duration\Nanoseconds;
use Orangesoft\BackOff\Strategy\ExponentialStrategy;
use PHPUnit\Framework\TestCase;

class ExponentialStrategyTest extends TestCase
Expand Down
2 changes: 1 addition & 1 deletion tests/Strategy/LinearStrategyTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@

namespace Orangesoft\BackOff\Tests\Strategy;

use Orangesoft\BackOff\Strategy\LinearStrategy;
use Orangesoft\BackOff\Duration\Nanoseconds;
use Orangesoft\BackOff\Strategy\LinearStrategy;
use PHPUnit\Framework\TestCase;

class LinearStrategyTest extends TestCase
Expand Down

0 comments on commit 4610cbf

Please sign in to comment.