Skip to content

Commit e854f88

Browse files
committed
Add support for PHP 8.0
1 parent 6f25ca9 commit e854f88

File tree

5 files changed

+23
-11
lines changed

5 files changed

+23
-11
lines changed

.github/workflows/build.yml

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -66,14 +66,17 @@ jobs:
6666
- name: PHPCS check
6767
run: vendor/bin/phpcs
6868

69-
- name: Psalm static analysis on PHP 7.4
70-
if: matrix.php-version == '7.4'
69+
- name: Psalm static analysis
7170
run: vendor/bin/psalm --no-progress
7271

73-
- name: PHPUnit run on PHP 7.4
72+
- name: PHPUnit run with coverage on PHP 7.4
7473
if: matrix.php-version == '7.4'
7574
run: vendor/bin/phpunit --coverage-clover=coverage.clover
7675

76+
- name: PHPUnit run without coverage on PHP 8.0
77+
if: matrix.php-version == '8.0'
78+
run: vendor/bin/phpunit
79+
7780
- name: Code coverage on PHP 7.4
7881
if: matrix.php-version == '7.4'
7982
run: |

composer.json

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -19,17 +19,17 @@
1919
"docs": "https://httpsoft.org/docs/error-handler"
2020
},
2121
"require": {
22-
"php": "^7.4",
22+
"php": "^7.4|^8.0",
2323
"httpsoft/http-response": "^1.0",
2424
"psr/http-message": "^1.0",
2525
"psr/http-server-handler": "^1.0",
2626
"psr/http-server-middleware": "^1.0"
2727
},
2828
"require-dev": {
2929
"httpsoft/http-request": "^1.0",
30-
"phpunit/phpunit": "^9.1",
30+
"phpunit/phpunit": "^9.3",
3131
"squizlabs/php_codesniffer": "^3.5",
32-
"vimeo/psalm": "^3.12"
32+
"vimeo/psalm": "^3.14"
3333
},
3434
"autoload": {
3535
"psr-4": {

tests/ErrorHandlerMiddlewareTest.php

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@
2121

2222
use const E_ERROR;
2323
use const E_NOTICE;
24+
use const E_WARNING;
2425

2526
class ErrorHandlerMiddlewareTest extends TestCase implements ResponseStatusCodeInterface
2627
{
@@ -116,7 +117,10 @@ public function testWithErrorRequestHandlerAndWithoutCaughtError(): void
116117

117118
public function testWithErrorRequestHandlerAndWithCaughtError(): void
118119
{
119-
$response = $this->errorHandler->process($this->request, $this->createErrorRequestHandler(E_NOTICE));
120+
$response = $this->errorHandler->process(
121+
$this->request,
122+
$this->createErrorRequestHandler(E_NOTICE | E_WARNING)
123+
);
120124
$this->assertInstanceOf(ResponseInterface::class, $response);
121125
$this->assertSame(self::STATUS_INTERNAL_SERVER_ERROR, $response->getStatusCode());
122126
$this->assertSame(self::PHRASES[self::STATUS_INTERNAL_SERVER_ERROR], $response->getReasonPhrase());
@@ -154,7 +158,10 @@ public function testWithErrorRequestHandlerAndWithAdditionOfListeners(): void
154158
{
155159
$this->errorHandler->addListener($firstListener = new FirstErrorListener());
156160
$this->errorHandler->addListener($secondListener = new SecondErrorListener());
157-
$response = $this->errorHandler->process($this->request, $this->createErrorRequestHandler(E_NOTICE));
161+
$response = $this->errorHandler->process(
162+
$this->request,
163+
$this->createErrorRequestHandler(E_NOTICE | E_WARNING)
164+
);
158165

159166
$this->assertInstanceOf(ResponseInterface::class, $response);
160167
$this->assertSame(self::STATUS_INTERNAL_SERVER_ERROR, $response->getStatusCode());

tests/ErrorHandlerTest.php

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@
2121

2222
use const E_ERROR;
2323
use const E_NOTICE;
24+
use const E_WARNING;
2425

2526
class ErrorHandlerTest extends TestCase implements ResponseStatusCodeInterface
2627
{
@@ -111,7 +112,7 @@ public function testWithErrorRequestHandlerAndWithoutCaughtError(): void
111112

112113
public function testWithErrorRequestHandlerAndWithCaughtError(): void
113114
{
114-
$errorHandler = $this->createWithErrorRequestHandler(E_NOTICE);
115+
$errorHandler = $this->createWithErrorRequestHandler(E_NOTICE | E_WARNING);
115116
$response = $errorHandler->handle($this->request);
116117
$this->assertInstanceOf(ResponseInterface::class, $response);
117118
$this->assertSame(self::STATUS_INTERNAL_SERVER_ERROR, $response->getStatusCode());
@@ -150,7 +151,7 @@ public function testWithThrowableRequestHandlerAndWithAdditionOfListeners(): voi
150151

151152
public function testWithErrorRequestHandlerAndWithAdditionOfListeners(): void
152153
{
153-
$errorHandler = $this->createWithErrorRequestHandler(E_NOTICE);
154+
$errorHandler = $this->createWithErrorRequestHandler(E_NOTICE | E_WARNING);
154155
$errorHandler->addListener($firstListener = new FirstErrorListener());
155156
$errorHandler->addListener($secondListener = new SecondErrorListener());
156157
$response = $errorHandler->handle($this->request);

tests/TestAsset/ErrorRequestHandler.php

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,8 @@ class ErrorRequestHandler implements RequestHandlerInterface
1919
*/
2020
public function handle(ServerRequestInterface $request): ResponseInterface
2121
{
22-
$variable = $undefined;
22+
$array = [];
23+
$array['undefined'];
2324
return ResponseFactory::create();
2425
}
2526
}

0 commit comments

Comments
 (0)