Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support for PHP 8.4 #16

Merged
merged 3 commits into from
Dec 11, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion .github/workflows/test.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ jobs:
strategy:
matrix:
php:
- "8.3"
- "8.4"

steps:
- name: "Checkout"
Expand Down Expand Up @@ -42,6 +42,7 @@ jobs:
php:
- 8.2
- 8.3
- 8.4
dependency-version: [prefer-stable]
exclude:
- os: ubuntu-20.04
Expand Down
16 changes: 0 additions & 16 deletions phpunit.xml.bak

This file was deleted.

2 changes: 1 addition & 1 deletion src/Certificate.php
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ public function __construct(
?string $passphrase = null,
bool|string $rootPath = true,
?string $signingPath = null,
string $signingPassphrase = null
?string $signingPassphrase = null
) {
$this->client = $clientPath;
$this->passphrase = $passphrase;
Expand Down
8 changes: 4 additions & 4 deletions src/Client.php
Original file line number Diff line number Diff line change
Expand Up @@ -36,17 +36,17 @@ class Client
protected ClientInterface $client;

public function __construct(
Certificate $certificate = null,
?Certificate $certificate = null,
string $endpoint = self::PRODUCTION_ENDPOINT,
ClientInterface $client = null
?ClientInterface $client = null
) {
$this->setup($certificate, $endpoint, $client);
}

public function setup(
Certificate $certificate = null,
?Certificate $certificate = null,
string $endpoint = self::PRODUCTION_ENDPOINT,
ClientInterface $client = null
?ClientInterface $client = null
): void {

if ($certificate) {
Expand Down
2 changes: 1 addition & 1 deletion src/Exceptions/InvalidUuidException.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@

class InvalidUuidException extends \InvalidArgumentException
{
public function __construct(string $message = null, int $code = 0)
public function __construct(?string $message = null, int $code = 0)
{
if (!$message) {
throw new $this('Invalid UUID ' . get_class($this), $code);
Expand Down
5 changes: 3 additions & 2 deletions src/Exceptions/ValidationException.php
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
use Olssonm\Swish\Error;
use Psr\Http\Message\RequestInterface;
use Psr\Http\Message\ResponseInterface;
use Throwable;

class ValidationException extends RequestException
{
Expand All @@ -22,8 +23,8 @@ class ValidationException extends RequestException
public function __construct(
string $message,
RequestInterface $request,
ResponseInterface $response = null,
\Throwable $previous = null,
?ResponseInterface $response = null,
?Throwable $previous = null,
array $handlerContext = []
) {

Expand Down
17 changes: 10 additions & 7 deletions src/Providers/SwishServiceProvider.php
Original file line number Diff line number Diff line change
Expand Up @@ -18,21 +18,24 @@ public function register(): void
$this->mergeConfigFrom($source, 'swish');

$this->app->singleton('swish', function (Container $app): Client {
$config = $app->get('config');
$certificate = new Certificate(
clientPath: $app['config']['swish.certificates.client'],
passphrase: $app['config']['swish.certificates.password'],
rootPath: $app['config']['swish.certificates.root'],
signingPath: $app['config']['swish.certificates.signing'],
signingPassphrase: $app['config']['swish.certificates.signing_password'],
clientPath: $config['swish.certificates.client'],
passphrase: $config['swish.certificates.password'],
rootPath: $config['swish.certificates.root'],
signingPath: $config['swish.certificates.signing'],
signingPassphrase: $config['swish.certificates.signing_password'],
);

return new Client($certificate, $app['config']['swish.endpoint']);
return new Client($certificate, $config['swish.endpoint']);
});

$this->app->alias('swish', Client::class);
}

/** @codeCoverageIgnore */
/**
* @return array<string>
*/
public function provides(): array
{
return ['swish'];
Expand Down
Loading