Skip to content

Commit

Permalink
Fix PHP 8.4 compatibility
Browse files Browse the repository at this point in the history
  • Loading branch information
Hlavtox committed Nov 19, 2024
1 parent 1ff44e3 commit d7a6a21
Show file tree
Hide file tree
Showing 5 changed files with 7 additions and 7 deletions.
4 changes: 2 additions & 2 deletions src/AdvancedCircuitBreaker.php
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ public function __construct(
public function call(
$service,
array $serviceParameters = [],
callable $fallback = null
?callable $fallback = null
): string {
$transaction = $this->initTransaction($service);

Expand Down Expand Up @@ -124,7 +124,7 @@ public function setDefaultFallback(?callable $defaultFallback = null): self
/**
* {@inheritdoc}
*/
protected function callFallback(callable $fallback = null): string
protected function callFallback(?callable $fallback = null): string
{
return parent::callFallback(null !== $fallback ? $fallback : $this->defaultFallback);
}
Expand Down
2 changes: 1 addition & 1 deletion src/Client/SymfonyHttpClient.php
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@ class SymfonyHttpClient implements ClientInterface
*/
private $client;

public function __construct(array $defaultOptions = [], HttpClientInterface $client = null)
public function __construct(array $defaultOptions = [], ?HttpClientInterface $client = null)
{
$this->defaultOptions = $defaultOptions;
$this->client = $client;
Expand Down
2 changes: 1 addition & 1 deletion src/Contract/CircuitBreakerInterface.php
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ public function getState(): string;
* @param array $parameters the parameters for the request
* @param callable|null $fallback if the service is unavailable, rely on the fallback
*/
public function call(string $service, array $parameters = [], callable $fallback = null): string;
public function call(string $service, array $parameters = [], ?callable $fallback = null): string;

/**
* @return bool checks if the circuit breaker is open
Expand Down
4 changes: 2 additions & 2 deletions src/PartialCircuitBreaker.php
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@ public function __construct(
/**
* {@inheritdoc}
*/
abstract public function call(string $service, array $serviceParameters = [], callable $fallback = null): string;
abstract public function call(string $service, array $serviceParameters = [], ?callable $fallback = null): string;

/**
* {@inheritdoc}
Expand Down Expand Up @@ -108,7 +108,7 @@ public function isClosed(): bool
return State::CLOSED_STATE === $this->currentPlace->getState();
}

protected function callFallback(callable $fallback = null): string
protected function callFallback(?callable $fallback = null): string
{
if (null === $fallback) {
return '';
Expand Down
2 changes: 1 addition & 1 deletion src/SimpleCircuitBreaker.php
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ public function __construct(
public function call(
string $service,
array $serviceParameters = [],
callable $fallback = null
?callable $fallback = null
): string {
$transaction = $this->initTransaction($service);
try {
Expand Down

0 comments on commit d7a6a21

Please sign in to comment.