Skip to content

Commit

Permalink
Run php-cs-fixer
Browse files Browse the repository at this point in the history
  • Loading branch information
ackintosh committed Dec 1, 2021
1 parent ddf0912 commit 435bb98
Show file tree
Hide file tree
Showing 12 changed files with 65 additions and 25 deletions.
2 changes: 1 addition & 1 deletion examples/server/redirect.php
Original file line number Diff line number Diff line change
Expand Up @@ -12,4 +12,4 @@
$url = 'http://'.$_SERVER['HTTP_HOST'].'/server/redirect.php?redirects='.$redirects.'&current='.++$current;
header('Status: 301 Moved Permanently', false, 301);
header('Location: '.$url);
exit;
exit;
1 change: 0 additions & 1 deletion src/Ganesha/Context.php
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
<?php
namespace Ackintosh\Ganesha;


use Ackintosh\Ganesha\Storage\Adapter\SlidingTimeWindowInterface;
use Ackintosh\Ganesha\Storage\Adapter\TumblingTimeWindowInterface;
use Ackintosh\Ganesha\Storage\AdapterInterface;
Expand Down
2 changes: 1 addition & 1 deletion src/Ganesha/HttpClient/FailureDetectorInterface.php
Original file line number Diff line number Diff line change
Expand Up @@ -14,4 +14,4 @@ public function isFailureResponse(ResponseInterface $response, array $requestOpt
* @return string[]
*/
public function getOptionKeys(): array;
}
}
2 changes: 1 addition & 1 deletion src/Ganesha/HttpClient/HostTrait.php
Original file line number Diff line number Diff line change
Expand Up @@ -22,4 +22,4 @@ public static function extractHostFromUrl(string $url): string

return $host;
}
}
}
2 changes: 1 addition & 1 deletion src/Ganesha/HttpClient/TransportFailureDetector.php
Original file line number Diff line number Diff line change
Expand Up @@ -35,4 +35,4 @@ public function isFailureResponse(ResponseInterface $response, array $requestOpt
return true;
}
}
}
}
4 changes: 3 additions & 1 deletion src/Ganesha/Storage/Adapter/Apcu.php
Original file line number Diff line number Diff line change
Expand Up @@ -196,7 +196,9 @@ public function reset(): void
{
$keyPrefix = preg_quote($this->storageKeys->prefix(), '/');
$keySuffixes = array_map(
function (string $s) { return preg_quote($s, '/'); },
function (string $s) {
return preg_quote($s, '/');
},
[
$this->storageKeys->success(),
$this->storageKeys->failure(),
Expand Down
2 changes: 1 addition & 1 deletion src/Ganesha/Storage/Adapter/Redis.php
Original file line number Diff line number Diff line change
Expand Up @@ -180,7 +180,7 @@ public function reset(): void

/**
* @param string $service
*
*
* @throws StorageException
*/
private function removeExpiredElements(string $service): void
Expand Down
2 changes: 1 addition & 1 deletion tests/Ackintosh/Ganesha/BuilderTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -26,4 +26,4 @@ public function withCountStrategy()
Builder::withCountStrategy()
);
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,8 @@ protected function setUp(): void
*/
abstract protected function getRedisConnection();

private function createAdapterWithMock(MockObject $mock): Redis {
private function createAdapterWithMock(MockObject $mock): Redis
{
$adapter = new Redis($mock);
$adapter->setContext($this->context);
return $adapter;
Expand Down
32 changes: 25 additions & 7 deletions tests/Ackintosh/Ganesha/Strategy/Count/BuilderTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -12,13 +12,31 @@ class BuilderTest extends TestCase
public function storageKeys()
{
$storageKeys = new class implements StorageKeysInterface {
public function prefix(): string { return "test"; }
public function success(): string { return "test"; }
public function failure(): string { return "test"; }
public function rejection(): string { return "test"; }
public function lastFailureTime(): string { return "test"; }
public function status(): string { return "test"; }
public function prefix(): string
{
return "test";
}
public function success(): string
{
return "test";
}
public function failure(): string
{
return "test";
}
public function rejection(): string
{
return "test";
}
public function lastFailureTime(): string
{
return "test";
}
public function status(): string
{
return "test";
}
};
$this->assertInstanceOf('Ackintosh\Ganesha\Strategy\Count\Builder', (new Builder)->storageKeys($storageKeys));
}
}
}
32 changes: 25 additions & 7 deletions tests/Ackintosh/Ganesha/Strategy/Rate/BuilderTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -12,13 +12,31 @@ class BuilderTest extends TestCase
public function storageKeys()
{
$storageKeys = new class implements StorageKeysInterface {
public function prefix(): string { return "test"; }
public function success(): string { return "test"; }
public function failure(): string { return "test"; }
public function rejection(): string { return "test"; }
public function lastFailureTime(): string { return "test"; }
public function status(): string { return "test"; }
public function prefix(): string
{
return "test";
}
public function success(): string
{
return "test";
}
public function failure(): string
{
return "test";
}
public function rejection(): string
{
return "test";
}
public function lastFailureTime(): string
{
return "test";
}
public function status(): string
{
return "test";
}
};
$this->assertInstanceOf('Ackintosh\Ganesha\Strategy\Rate\Builder', (new Builder)->storageKeys($storageKeys));
}
}
}
6 changes: 4 additions & 2 deletions tests/Ackintosh/Ganesha/Traits/BuildGaneshaTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,8 @@ class BuildGaneshaTest extends TestCase
/**
* @test
*/
public function validateThrowsExceptionWhenRequirementsAreNotSatisfied() {
public function validateThrowsExceptionWhenRequirementsAreNotSatisfied()
{
$this->expectExceptionMessage('adapter is required');
$this->expectException(\LogicException::class);

Expand All @@ -21,7 +22,8 @@ public function validateThrowsExceptionWhenRequirementsAreNotSatisfied() {
/**
* @test
*/
public function validateThrowsExceptionWhenAdapterRequirementsAreNotSatisfied() {
public function validateThrowsExceptionWhenAdapterRequirementsAreNotSatisfied()
{
$this->expectExceptionMessage("Ackintosh\Ganesha\Storage\Adapter\Redis doesn't support expected Strategy: supportCountStrategy");
$this->expectException(\InvalidArgumentException::class);

Expand Down

0 comments on commit 435bb98

Please sign in to comment.