Skip to content

Commit 4a80390

Browse files
committed
fixed cs
1 parent 415dfc4 commit 4a80390

File tree

13 files changed

+14
-17
lines changed

13 files changed

+14
-17
lines changed

.php-cs-fixer.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010
return (new PhpCsFixer\Config())
1111
->setRiskyAllowed(true)
1212
->setRules([
13-
'@PHP74Migration' => true,
13+
'@PHP81Migration' => true,
1414
'@PhpCsFixer' => true,
1515
'@Symfony' => true,
1616
'@Symfony:risky' => true,

src/Client.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ final class Client implements ClientInterface
1616
private HttpClientInterface $client;
1717
private LoggerInterface $logger;
1818

19-
public function __construct(array $options = [], LoggerInterface $logger = null, HttpClientInterface $client = null)
19+
public function __construct(array $options = [], ?LoggerInterface $logger = null, ?HttpClientInterface $client = null)
2020
{
2121
if (!$client) {
2222
$options['base_uri'] = DsnResolver::resolve($options);
@@ -27,7 +27,7 @@ public function __construct(array $options = [], LoggerInterface $logger = null,
2727
$this->logger = $logger ?? new NullLogger();
2828
}
2929

30-
public function get(string $url = null, array $options = []): ConsulResponse
30+
public function get(?string $url = null, array $options = []): ConsulResponse
3131
{
3232
return $this->doRequest('GET', $url, $options);
3333
}

src/ClientInterface.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44

55
interface ClientInterface
66
{
7-
public function get(string $url = null, array $options = []): ConsulResponse;
7+
public function get(?string $url = null, array $options = []): ConsulResponse;
88

99
public function head(string $url, array $options = []): ConsulResponse;
1010

src/Helper/LockHandler.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ final class LockHandler
1414

1515
private $sessionId;
1616

17-
public function __construct($key, $value = null, Session $session = null, KV $kv = null)
17+
public function __construct($key, $value = null, ?Session $session = null, ?KV $kv = null)
1818
{
1919
$this->key = $key;
2020
$this->value = $value;

src/Helper/MultiLockHandler.php

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,6 @@
44

55
use Consul\Services\KV;
66
use Consul\Services\Session;
7-
use Exception;
87

98
class MultiLockHandler
109
{
@@ -45,7 +44,7 @@ public function lock(): bool
4544

4645
$lockedResources[] = $resource;
4746
}
48-
} catch (Exception $e) {
47+
} catch (\Exception $e) {
4948
$result = false;
5049
} finally {
5150
if (!$result) {

src/Helper/MultiSemaphore.php

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,6 @@
55
use Consul\Helper\MultiSemaphore\Resource;
66
use Consul\Services\KV;
77
use Consul\Services\Session;
8-
use RuntimeException;
98

109
class MultiSemaphore
1110
{
@@ -34,7 +33,7 @@ public function getResources(): array
3433
public function acquire(): bool
3534
{
3635
if (null !== $this->sessionId) {
37-
throw new RuntimeException('Resources are acquired already');
36+
throw new \RuntimeException('Resources are acquired already');
3837
}
3938

4039
// Start a session

src/Services/Agent.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ final class Agent
1111
{
1212
private ClientInterface $client;
1313

14-
public function __construct(ClientInterface $client = null)
14+
public function __construct(?ClientInterface $client = null)
1515
{
1616
$this->client = $client ?: new Client();
1717
}

src/Services/Catalog.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ final class Catalog
1111
{
1212
private ClientInterface $client;
1313

14-
public function __construct(ClientInterface $client = null)
14+
public function __construct(?ClientInterface $client = null)
1515
{
1616
$this->client = $client ?: new Client();
1717
}

src/Services/Health.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ final class Health
1111
{
1212
private ClientInterface $client;
1313

14-
public function __construct(ClientInterface $client = null)
14+
public function __construct(?ClientInterface $client = null)
1515
{
1616
$this->client = $client ?: new Client();
1717
}

src/Services/KV.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ final class KV
1111
{
1212
private ClientInterface $client;
1313

14-
public function __construct(ClientInterface $client = null)
14+
public function __construct(?ClientInterface $client = null)
1515
{
1616
$this->client = $client ?: new Client();
1717
}

0 commit comments

Comments
 (0)