Skip to content
This repository was archived by the owner on Jul 6, 2024. It is now read-only.

Commit 7d39a1e

Browse files
author
Dominik Zogg
committed
php 8.0 min version
1 parent 640562f commit 7d39a1e

25 files changed

+80
-225
lines changed

.github/workflows/ci.yml

-23
Original file line numberDiff line numberDiff line change
@@ -7,29 +7,6 @@ on:
77
- cron: '0 0 * * *'
88

99
jobs:
10-
php74-min:
11-
name: PHP 7.4 (--prefer-lowest)
12-
runs-on: ubuntu-20.04
13-
steps:
14-
- name: checkout
15-
uses: actions/checkout@v2
16-
- name: composer test
17-
uses: docker://chubbyphp/ci-php74:latest
18-
env:
19-
COMPOSER_ARGS: "--prefer-lowest"
20-
COVERALLS_REPO_TOKEN: ${{ secrets.GITHUB_TOKEN }}
21-
STRYKER_DASHBOARD_API_KEY: ${{ secrets.STRYKER_DASHBOARD_API_KEY }}
22-
php74:
23-
name: PHP 7.4
24-
runs-on: ubuntu-20.04
25-
steps:
26-
- name: checkout
27-
uses: actions/checkout@v2
28-
- name: composer test
29-
uses: docker://chubbyphp/ci-php74:latest
30-
env:
31-
COVERALLS_REPO_TOKEN: ${{ secrets.GITHUB_TOKEN }}
32-
STRYKER_DASHBOARD_API_KEY: ${{ secrets.STRYKER_DASHBOARD_API_KEY }}
3310
php80:
3411
name: PHP 8.0
3512
runs-on: ubuntu-20.04

LICENSE

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
Copyright (c) 2021 Dominik Zogg
1+
Copyright (c) 2022 Dominik Zogg
22

33
Permission is hereby granted, free of charge, to any person obtaining a copy
44
of this software and associated documentation files (the "Software"), to deal

README.md

+7-7
Original file line numberDiff line numberDiff line change
@@ -25,21 +25,21 @@ A simple http handler implementation for API.
2525

2626
## Requirements
2727

28-
* php: ^7.4|^8.0
29-
* chubbyphp/chubbyphp-deserialization: ^3.0
30-
* chubbyphp/chubbyphp-negotiation: ^1.7
31-
* chubbyphp/chubbyphp-serialization: ^3.0
28+
* php: ^8.0
29+
* chubbyphp/chubbyphp-deserialization: ^3.4.1
30+
* chubbyphp/chubbyphp-negotiation: ^1.9
31+
* chubbyphp/chubbyphp-serialization: ^3.2
3232
* psr/http-factory: ^1.0.1
3333
* psr/http-message: ^1.0.1
3434
* psr/http-server-middleware: ^1.0.1
35-
* psr/log: ^1.1.3
35+
* psr/log: ^1.1.4|^2.0|^3.0
3636

3737
## Installation
3838

3939
Through [Composer](http://getcomposer.org) as [chubbyphp/chubbyphp-api-http][1].
4040

4141
```sh
42-
composer require chubbyphp/chubbyphp-api-http "^4.1"
42+
composer require chubbyphp/chubbyphp-api-http "^4.2"
4343
```
4444

4545
## Usage
@@ -59,7 +59,7 @@ composer require chubbyphp/chubbyphp-api-http "^4.1"
5959

6060
## Copyright
6161

62-
Dominik Zogg 2021
62+
Dominik Zogg 2022
6363

6464
[1]: https://packagist.org/packages/chubbyphp/chubbyphp-api-http
6565
[2]: doc/ApiProblem/ApiProblem.md

composer.json

+20-16
Original file line numberDiff line numberDiff line change
@@ -10,28 +10,28 @@
1010
}
1111
],
1212
"require": {
13-
"php": "^7.4|^8.0",
14-
"chubbyphp/chubbyphp-deserialization": "^3.0",
15-
"chubbyphp/chubbyphp-negotiation": "^1.7",
16-
"chubbyphp/chubbyphp-serialization": "^3.0",
13+
"php": "^8.0",
14+
"chubbyphp/chubbyphp-deserialization": "^3.4.1",
15+
"chubbyphp/chubbyphp-negotiation": "^1.9",
16+
"chubbyphp/chubbyphp-serialization": "^3.2",
1717
"psr/http-factory": "^1.0.1",
1818
"psr/http-message": "^1.0.1",
1919
"psr/http-server-middleware": "^1.0.1",
20-
"psr/log": "^1.1.3"
20+
"psr/log": "^1.1.4|^2.0|^3.0"
2121
},
2222
"require-dev": {
23-
"chubbyphp/chubbyphp-container": "^1.4|^2.0",
23+
"chubbyphp/chubbyphp-container": "^2.1",
2424
"chubbyphp/chubbyphp-dev-helper": "dev-master",
25-
"chubbyphp/chubbyphp-laminas-config-factory": "^1.1.1",
25+
"chubbyphp/chubbyphp-laminas-config-factory": "^1.2",
2626
"chubbyphp/chubbyphp-mock": "^1.6.1",
27-
"infection/infection": "^0.25.3",
28-
"php-coveralls/php-coveralls": "^2.5.1",
27+
"infection/infection": "^0.26.5",
28+
"php-coveralls/php-coveralls": "^2.5.2",
2929
"phploc/phploc": "^7.0.2",
3030
"phpstan/extension-installer": "^1.1",
31-
"phpstan/phpstan": "^1.1.2",
32-
"phpunit/phpunit": "^9.5.10",
33-
"pimple/pimple": "^3.4",
34-
"psr/container": "^1.1.1|^2.0.1"
31+
"phpstan/phpstan": "^1.4.8",
32+
"phpunit/phpunit": "^9.5.17",
33+
"pimple/pimple": "^3.5",
34+
"psr/container": "^2.0.2"
3535
},
3636
"autoload": {
3737
"psr-4": { "Chubbyphp\\ApiHttp\\": "src/" }
@@ -40,11 +40,15 @@
4040
"psr-4": { "Chubbyphp\\Tests\\ApiHttp\\": "tests/" }
4141
},
4242
"config": {
43-
"sort-packages": true
43+
"sort-packages": true,
44+
"allow-plugins": {
45+
"infection/extension-installer": true,
46+
"phpstan/extension-installer": true
47+
}
4448
},
4549
"extra": {
4650
"branch-alias": {
47-
"dev-master": "4.1-dev"
51+
"dev-master": "4.2-dev"
4852
}
4953
},
5054
"scripts": {
@@ -59,7 +63,7 @@
5963
"@test:cs"
6064
],
6165
"test:cs": "mkdir -p build && PHP_CS_FIXER_IGNORE_ENV=1 vendor/bin/php-cs-fixer fix --dry-run --stop-on-violation --cache-file=build/phpcs.cache",
62-
"test:infection": "vendor/bin/infection --threads=$(nproc) --min-msi=98 --verbose --coverage=build/phpunit",
66+
"test:infection": "vendor/bin/infection --threads=$(nproc) --min-msi=63 --verbose --coverage=build/phpunit",
6367
"test:integration": "vendor/bin/phpunit --testsuite=Integration --cache-result-file=build/phpunit/result.cache",
6468
"test:lint": "mkdir -p build && find src tests -name '*.php' -print0 | xargs -0 -n1 -P$(nproc) php -l | tee build/phplint.log",
6569
"test:loc": "mkdir -p build && vendor/bin/phploc src | tee build/phploc.log",

infection.json

+6-3
Original file line numberDiff line numberDiff line change
@@ -6,9 +6,12 @@
66
},
77
"timeout": 10,
88
"logs": {
9-
"text": "build/phpinfection.log",
10-
"badge": {
11-
"branch": "master"
9+
"text": "build/phpinfection/infection.log",
10+
"html": "build/phpinfection/infection.html",
11+
"json": "build/phpinfection/infection.json",
12+
"summary": "build/phpinfection/summary.log",
13+
"stryker": {
14+
"report": "master"
1215
}
1316
},
1417
"mutators": {

src/ApiProblem/AbstractApiProblem.php

+5-20
Original file line numberDiff line numberDiff line change
@@ -6,28 +6,13 @@
66

77
abstract class AbstractApiProblem implements ApiProblemInterface
88
{
9-
protected string $type;
10-
11-
protected int $status;
12-
13-
protected string $title;
14-
15-
protected ?string $detail;
16-
17-
protected ?string $instance;
18-
199
public function __construct(
20-
string $type,
21-
int $status,
22-
string $title,
23-
?string $detail = null,
24-
?string $instance = null
10+
protected string $type,
11+
protected int $status,
12+
protected string $title,
13+
protected ?string $detail = null,
14+
protected ?string $instance = null
2515
) {
26-
$this->type = $type;
27-
$this->status = $status;
28-
$this->title = $title;
29-
$this->detail = $detail;
30-
$this->instance = $instance;
3116
}
3217

3318
public function getType(): string

src/ApiProblem/ClientError/BadRequest.php

+1-8
Original file line numberDiff line numberDiff line change
@@ -8,15 +8,10 @@
88

99
final class BadRequest extends AbstractApiProblem
1010
{
11-
/**
12-
* @var array<int, array<mixed>>
13-
*/
14-
private array $invalidParameters = [];
15-
1611
/**
1712
* @param array<int, array<mixed>> $invalidParameters
1813
*/
19-
public function __construct(array $invalidParameters, ?string $detail = null, ?string $instance = null)
14+
public function __construct(private array $invalidParameters, ?string $detail = null, ?string $instance = null)
2015
{
2116
parent::__construct(
2217
'https://tools.ietf.org/html/rfc2616#section-10.4.1',
@@ -25,8 +20,6 @@ public function __construct(array $invalidParameters, ?string $detail = null, ?s
2520
$detail,
2621
$instance
2722
);
28-
29-
$this->invalidParameters = $invalidParameters;
3023
}
3124

3225
/**

src/ApiProblem/ClientError/ExpectationFailed.php

+1-8
Original file line numberDiff line numberDiff line change
@@ -8,15 +8,10 @@
88

99
final class ExpectationFailed extends AbstractApiProblem
1010
{
11-
/**
12-
* @var array<int, string>
13-
*/
14-
private array $failedExpectations = [];
15-
1611
/**
1712
* @param array<int, string> $failedExpectations
1813
*/
19-
public function __construct(array $failedExpectations, ?string $detail = null, ?string $instance = null)
14+
public function __construct(private array $failedExpectations, ?string $detail = null, ?string $instance = null)
2015
{
2116
parent::__construct(
2217
'https://tools.ietf.org/html/rfc2616#section-10.4.18',
@@ -25,8 +20,6 @@ public function __construct(array $failedExpectations, ?string $detail = null, ?
2520
$detail,
2621
$instance
2722
);
28-
29-
$this->failedExpectations = $failedExpectations;
3023
}
3124

3225
/**

src/ApiProblem/ClientError/MethodNotAllowed.php

+6-12
Original file line numberDiff line numberDiff line change
@@ -8,29 +8,23 @@
88

99
final class MethodNotAllowed extends AbstractApiProblem
1010
{
11-
private string $method;
12-
13-
/**
14-
* @var array<int, string>
15-
*/
16-
private array $allowedMethods = [];
17-
1811
/**
1912
* @param string $method,
2013
* @param array<int, string> $allowedMethods
2114
*/
22-
public function __construct(string $method, array $allowedMethods, ?string $detail = null, ?string $instance = null)
23-
{
15+
public function __construct(
16+
private string $method,
17+
private array $allowedMethods,
18+
?string $detail = null,
19+
?string $instance = null
20+
) {
2421
parent::__construct(
2522
'https://tools.ietf.org/html/rfc2616#section-10.4.6',
2623
405,
2724
'Method Not Allowed',
2825
$detail,
2926
$instance
3027
);
31-
32-
$this->method = $method;
33-
$this->allowedMethods = $allowedMethods;
3428
}
3529

3630
/**

src/ApiProblem/ClientError/NotAcceptable.php

+2-12
Original file line numberDiff line numberDiff line change
@@ -8,19 +8,12 @@
88

99
final class NotAcceptable extends AbstractApiProblem
1010
{
11-
private string $accept;
12-
13-
/**
14-
* @var array<int, string>
15-
*/
16-
private array $acceptables = [];
17-
1811
/**
1912
* @param array<int, string> $acceptables
2013
*/
2114
public function __construct(
22-
string $accept,
23-
array $acceptables,
15+
private string $accept,
16+
private array $acceptables,
2417
?string $detail = null,
2518
?string $instance = null
2619
) {
@@ -31,9 +24,6 @@ public function __construct(
3124
$detail,
3225
$instance
3326
);
34-
35-
$this->accept = $accept;
36-
$this->acceptables = $acceptables;
3727
}
3828

3929
public function getAccept(): string

src/ApiProblem/ClientError/PaymentRequired.php

+1-8
Original file line numberDiff line numberDiff line change
@@ -8,15 +8,10 @@
88

99
final class PaymentRequired extends AbstractApiProblem
1010
{
11-
/**
12-
* @var array<int, string>
13-
*/
14-
private array $paymentTypes = [];
15-
1611
/**
1712
* @param array<int, string> $paymentTypes
1813
*/
19-
public function __construct(array $paymentTypes, ?string $detail = null, ?string $instance = null)
14+
public function __construct(private array $paymentTypes, ?string $detail = null, ?string $instance = null)
2015
{
2116
parent::__construct(
2217
'https://tools.ietf.org/html/rfc2616#section-10.4.3',
@@ -25,8 +20,6 @@ public function __construct(array $paymentTypes, ?string $detail = null, ?string
2520
$detail,
2621
$instance
2722
);
28-
29-
$this->paymentTypes = $paymentTypes;
3023
}
3124

3225
/**

src/ApiProblem/ClientError/PreconditionFailed.php

+1-8
Original file line numberDiff line numberDiff line change
@@ -8,15 +8,10 @@
88

99
final class PreconditionFailed extends AbstractApiProblem
1010
{
11-
/**
12-
* @var array<int, string>
13-
*/
14-
private array $failedPreconditions = [];
15-
1611
/**
1712
* @param array<int, string> $failedPreconditions
1813
*/
19-
public function __construct(array $failedPreconditions, ?string $detail = null, ?string $instance = null)
14+
public function __construct(private array $failedPreconditions, ?string $detail = null, ?string $instance = null)
2015
{
2116
parent::__construct(
2217
'https://tools.ietf.org/html/rfc2616#section-10.4.13',
@@ -25,8 +20,6 @@ public function __construct(array $failedPreconditions, ?string $detail = null,
2520
$detail,
2621
$instance
2722
);
28-
29-
$this->failedPreconditions = $failedPreconditions;
3023
}
3124

3225
/**

src/ApiProblem/ClientError/RequestEntityTooLarge.php

+1-5
Original file line numberDiff line numberDiff line change
@@ -8,9 +8,7 @@
88

99
final class RequestEntityTooLarge extends AbstractApiProblem
1010
{
11-
private int $maxContentLength;
12-
13-
public function __construct(int $maxContentLength, ?string $detail = null, ?string $instance = null)
11+
public function __construct(private int $maxContentLength, ?string $detail = null, ?string $instance = null)
1412
{
1513
parent::__construct(
1614
'https://tools.ietf.org/html/rfc2616#section-10.4.14',
@@ -19,8 +17,6 @@ public function __construct(int $maxContentLength, ?string $detail = null, ?stri
1917
$detail,
2018
$instance
2119
);
22-
23-
$this->maxContentLength = $maxContentLength;
2420
}
2521

2622
public function getMaxContentLength(): int

0 commit comments

Comments
 (0)