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

Up to 8.1 min and new composer libraries #4

Merged
merged 1 commit into from
Apr 12, 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
2 changes: 1 addition & 1 deletion .github/workflows/coding-standards.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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'

7 changes: 4 additions & 3 deletions .github/workflows/continuous-integration.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down
6 changes: 0 additions & 6 deletions .github/workflows/php.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
2 changes: 1 addition & 1 deletion .github/workflows/static-analysis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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)

Expand Down
21 changes: 15 additions & 6 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -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": {
Expand All @@ -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"
}
Expand Down
10 changes: 5 additions & 5 deletions src/ApiProblem.php
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down Expand Up @@ -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
Expand All @@ -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) {
Expand Down Expand Up @@ -193,7 +193,7 @@ public function __get(string $name): mixed

throw new InvalidArgumentException(sprintf(
'Invalid property name "%s"',
$name
$name,
));
}

Expand Down Expand Up @@ -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();
Expand Down
12 changes: 5 additions & 7 deletions src/Exception/DomainException.php
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand All @@ -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;
}
Expand Down
4 changes: 2 additions & 2 deletions src/Exception/ProblemExceptionInterface.php
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}
Loading