diff --git a/.github/workflows/coding-standards.yml b/.github/workflows/coding-standards.yml index 636c442..d6322e5 100644 --- a/.github/workflows/coding-standards.yml +++ b/.github/workflows/coding-standards.yml @@ -15,6 +15,6 @@ jobs: name: "Coding Standards" uses: "doctrine/.github/.github/workflows/coding-standards.yml@1.3.0" with: - php-version: '8.0' + php-version: '8.1' composer-options: '--prefer-dist --ignore-platform-req=php' diff --git a/.github/workflows/continuous-integration.yml b/.github/workflows/continuous-integration.yml index 77642bc..c362142 100644 --- a/.github/workflows/continuous-integration.yml +++ b/.github/workflows/continuous-integration.yml @@ -19,18 +19,19 @@ jobs: fail-fast: false matrix: php-version: - - "8.0" - "8.1" + - "8.2" + - "8.3" dependencies: - "highest" optional-dependencies: - true - false include: - - php-version: "8.0" + - php-version: "8.1" dependencies: "lowest" optional-dependencies: false - - php-version: "8.0" + - php-version: "8.1" dependencies: "lowest" optional-dependencies: true diff --git a/.github/workflows/php.yml b/.github/workflows/php.yml index 6dcf060..39335a6 100644 --- a/.github/workflows/php.yml +++ b/.github/workflows/php.yml @@ -28,9 +28,3 @@ jobs: - name: Install dependencies run: composer install --prefer-dist --no-progress - - # Add a test script to composer.json, for instance: "test": "vendor/bin/phpunit" - # Docs: https://getcomposer.org/doc/articles/scripts.md - - # - name: Run test suite - # run: composer run-script test diff --git a/.github/workflows/static-analysis.yml b/.github/workflows/static-analysis.yml index c2f179d..4a3f43c 100644 --- a/.github/workflows/static-analysis.yml +++ b/.github/workflows/static-analysis.yml @@ -18,7 +18,7 @@ jobs: steps: - uses: shivammathur/setup-php@15c43e89cdef867065b0213be354c2841860869e with: - php-version: '8.0' + php-version: '8.1' - uses: actions/checkout@v2 - name: Install Dependencies run: composer install -q --no-ansi --no-interaction --no-scripts --no-progress --prefer-dist diff --git a/README.md b/README.md index 87fa5c6..a74d74d 100644 --- a/README.md +++ b/README.md @@ -2,7 +2,7 @@ [![Build Status](https://github.com/API-Skeletons/laravel-api-problem/actions/workflows/continuous-integration.yml/badge.svg)](https://github.com/API-Skeletons/laravel-api-problem/actions/workflows/continuous-integration.yml?query=branch%3Amain) [![Code Coverage](https://codecov.io/gh/API-Skeletons/laravel-api-problem/branch/main/graphs/badge.svg)](https://codecov.io/gh/API-Skeletons/laravel-api-problem/branch/main) -[![PHP Version](https://img.shields.io/badge/PHP-8.0%2b-blue)](https://img.shields.io/badge/PHP-8.0%2b-blue) +[![PHP Version](https://img.shields.io/badge/PHP-8.1%2b-blue)](https://img.shields.io/badge/PHP-8.1%2b-blue) [![Total Downloads](https://poser.pugx.org/api-skeletons/laravel-api-problem/downloads)](//packagist.org/packages/api-skeletons/laravel-api-problem) [![License](https://poser.pugx.org/api-skeletons/laravel-api-problem/license)](//packagist.org/packages/api-skeletons/laravel-api-problem) diff --git a/composer.json b/composer.json index 3ec6748..1306688 100644 --- a/composer.json +++ b/composer.json @@ -16,7 +16,10 @@ "chat": "https://gitter.im/API-Skeletons/open-source" }, "config": { - "sort-packages": true + "sort-packages": true, + "allow-plugins": { + "dealerdirect/phpcodesniffer-composer-installer": true + } }, "autoload": { "psr-4": { @@ -42,16 +45,22 @@ } }, "scripts": { - "test": "vendor/bin/phpcs && vendor/bin/phpunit && vendor/bin/psalm" + "test": [ + "vendor/bin/parallel-lint src test", + "vendor/bin/phpcs", + "vendor/bin/psalm", + "vendor/bin/phpunit" + ] }, "require": { - "php": "^8.0", + "php": "^8.1", "doctrine/instantiator": "^1.4", - "laravel/framework": "^8.0||^9.0" + "laravel/framework": "^8.0 || ^9.0 || ^10.0 || ^11.0" }, "require-dev": { - "doctrine/coding-standard": "^9.0", - "orchestra/testbench": "^6.23", + "doctrine/coding-standard": "^12.0", + "orchestra/testbench": "^7.41", + "php-parallel-lint/php-parallel-lint": "^1.4", "phpunit/phpunit": "^9.5", "vimeo/psalm": "^4.15" } diff --git a/src/ApiProblem.php b/src/ApiProblem.php index 49d1752..a65b16b 100644 --- a/src/ApiProblem.php +++ b/src/ApiProblem.php @@ -59,7 +59,7 @@ class ApiProblem /** * HTTP status for the error. */ - protected ?int $status = null; + protected int|null $status = null; /** * Normalized property names for overloading. @@ -123,7 +123,7 @@ class ApiProblem /** * Title of the error. */ - protected ?string $title; + protected string|null $title; /** * Create an instance using the provided information. If nothing is @@ -133,7 +133,7 @@ class ApiProblem * * @param string[] $additional */ - public function __construct(int|string $status, string|Throwable $detail, ?string $type = null, ?string $title = null, array $additional = []) + public function __construct(int|string $status, string|Throwable $detail, string|null $type = null, string|null $title = null, array $additional = []) { if ($detail instanceof ProblemExceptionInterface) { if ($type === null) { @@ -193,7 +193,7 @@ public function __get(string $name): mixed throw new InvalidArgumentException(sprintf( 'Invalid property name "%s"', - $name + $name, )); } @@ -277,7 +277,7 @@ protected function getDetail(): string * If an exception was provided, creates the status code from it; * otherwise, code as provided is used. */ - protected function getStatus(): ?int + protected function getStatus(): int|null { if ($this->detail instanceof Throwable || $this->detail instanceof Exception) { $this->status = (int) $this->createStatusFromException(); diff --git a/src/Exception/DomainException.php b/src/Exception/DomainException.php index fb82d92..af3b9ae 100644 --- a/src/Exception/DomainException.php +++ b/src/Exception/DomainException.php @@ -10,16 +10,14 @@ class DomainException extends \DomainException implements ExceptionInterface, ProblemExceptionInterface { - protected ?string $type = null; + protected string|null $type = null; /** @var string[] */ protected array $details = []; - protected ?string $title = null; + protected string|null $title = null; - /** - * @param string[] $details - */ + /** @param string[] $details */ public function setAdditionalDetails(array $details): self { $this->details = $details; @@ -46,12 +44,12 @@ public function getAdditionalDetails(): Traversable|array|null return $this->details; } - public function getType(): ?string + public function getType(): string|null { return $this->type; } - public function getTitle(): ?string + public function getTitle(): string|null { return $this->title; } diff --git a/src/Exception/ProblemExceptionInterface.php b/src/Exception/ProblemExceptionInterface.php index e0b8823..afa03ac 100644 --- a/src/Exception/ProblemExceptionInterface.php +++ b/src/Exception/ProblemExceptionInterface.php @@ -13,7 +13,7 @@ interface ProblemExceptionInterface { public function getAdditionalDetails(): array|Traversable|null; - public function getType(): ?string; + public function getType(): string|null; - public function getTitle(): ?string; + public function getTitle(): string|null; }