Skip to content

Commit

Permalink
Add PHP 8.4 compatibility, add tests
Browse files Browse the repository at this point in the history
  • Loading branch information
Hlavtox authored and jolelievre committed Nov 20, 2024
1 parent 1ff44e3 commit 0602d11
Show file tree
Hide file tree
Showing 6 changed files with 39 additions and 11 deletions.
36 changes: 32 additions & 4 deletions .github/workflows/php.yml
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ jobs:
runs-on: ubuntu-latest
strategy:
matrix:
php-versions: ['7.2', '7.3', '7.4', '8.0', '8.1', '8.2']
php-versions: ['7.2', '7.3', '7.4', '8.0', '8.1', '8.2', '8.3', '8.4']
steps:
- name: Setup PHP
uses: shivammathur/setup-php@v2
Expand Down Expand Up @@ -52,7 +52,7 @@ jobs:
runs-on: ubuntu-latest
strategy:
matrix:
php-versions: ['7.2', '7.3', '7.4', '8.0', '8.1', '8.2']
php-versions: ['7.2', '7.3', '7.4', '8.0', '8.1', '8.2', '8.3', '8.4']
steps:
- name: Setup PHP
uses: shivammathur/setup-php@v2
Expand Down Expand Up @@ -81,8 +81,8 @@ jobs:
runs-on: ubuntu-latest
strategy:
matrix:
php-versions: ['7.2', '7.3', '7.4', '8.0', '8.1', '8.2']
symfony-http-client-versions: ['5.4', '6.0', '6.1', '6.2']
php-versions: ['7.2', '7.3', '7.4', '8.0', '8.1', '8.2', '8.3', '8.4']
symfony-http-client-versions: ['5.4', '6.0', '6.1', '6.2', '6.3', '6.4']
exclude:
- php-versions: '7.2'
symfony-http-client-versions: '6.0'
Expand All @@ -106,6 +106,34 @@ jobs:
symfony-http-client-versions: '6.2'
- php-versions: '8.0'
symfony-http-client-versions: '6.2'
- php-versions: '7.2'
symfony-http-client-versions: '6.3'
- php-versions: '7.3'
symfony-http-client-versions: '6.3'
- php-versions: '7.4'
symfony-http-client-versions: '6.3'
- php-versions: '8.0'
symfony-http-client-versions: '6.3'
- php-versions: '7.2'
symfony-http-client-versions: '6.4'
- php-versions: '7.3'
symfony-http-client-versions: '6.4'
- php-versions: '7.4'
symfony-http-client-versions: '6.4'
- php-versions: '8.0'
symfony-http-client-versions: '6.4'
- php-versions: '8.2'
symfony-http-client-versions: '5.4'
- php-versions: '8.2'
symfony-http-client-versions: '6.0'
- php-versions: '8.3'
symfony-http-client-versions: '5.4'
- php-versions: '8.3'
symfony-http-client-versions: '6.0'
- php-versions: '8.4'
symfony-http-client-versions: '5.4'
- php-versions: '8.4'
symfony-http-client-versions: '6.0'
steps:
- name: Setup PHP
uses: shivammathur/setup-php@v2
Expand Down
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 0602d11

Please sign in to comment.