Skip to content

Commit dd7a923

Browse files
authored
Merge pull request #14 from lcobucci/upgrade-dependencies
Upgrade dependencies
2 parents fd9f555 + 29f71b0 commit dd7a923

10 files changed

+35
-58
lines changed

Diff for: .scrutinizer.yml

+1-1
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ build:
66
rabbitmq: false
77
mongodb: false
88
php:
9-
version: 7.3
9+
version: 7.4
1010

1111
cache:
1212
disabled: false

Diff for: .travis.yml

+1-3
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,7 @@ sudo: false
33
language: php
44

55
php:
6-
- 7.3
7-
- 7.4snapshot
6+
- 7.4
87
- nightly
98

109
cache:
@@ -22,7 +21,6 @@ script:
2221

2322
jobs:
2423
allow_failures:
25-
- php: 7.4snapshot
2624
- php: nightly
2725

2826
include:

Diff for: composer.json

+13-12
Original file line numberDiff line numberDiff line change
@@ -11,24 +11,25 @@
1111
],
1212
"keywords": ["PSR-15", "RFC-7807", "error handling"],
1313
"require": {
14-
"php": "^7.3",
15-
"ext-json": "^1.7",
14+
"php": "^7.4 || ^8.0",
15+
"ext-json": "*",
1616
"fig/http-message-util": "^1.1",
17-
"lcobucci/content-negotiation-middleware": "^2.0",
17+
"lcobucci/content-negotiation-middleware": "^2.2",
1818
"psr/http-factory": "^1.0",
1919
"psr/http-server-middleware": "^1.0",
2020
"psr/log": "^1.1"
2121
},
2222
"require-dev": {
23-
"infection/infection": "^0.13",
24-
"lcobucci/coding-standard": "^3.0",
25-
"phpstan/phpstan": "^0.11",
26-
"phpstan/phpstan-deprecation-rules": "^0.11",
27-
"phpstan/phpstan-phpunit": "^0.11",
28-
"phpstan/phpstan-strict-rules": "^0.11",
29-
"phpunit/phpunit": "^8.2",
30-
"squizlabs/php_codesniffer": "^3.4",
31-
"zendframework/zend-diactoros": "^2.0"
23+
"infection/infection": "^0.15",
24+
"laminas/laminas-diactoros": "^2.2",
25+
"lcobucci/coding-standard": "^4.0",
26+
"phpstan/extension-installer": "^1.0",
27+
"phpstan/phpstan": "^0.12",
28+
"phpstan/phpstan-deprecation-rules": "^0.12",
29+
"phpstan/phpstan-phpunit": "^0.12",
30+
"phpstan/phpstan-strict-rules": "^0.12",
31+
"phpunit/phpunit": "^9.0",
32+
"squizlabs/php_codesniffer": "^3.5"
3233
},
3334
"autoload": {
3435
"psr-4": {

Diff for: phpstan.neon.dist

-6
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,3 @@
1-
includes:
2-
- vendor/phpstan/phpstan-phpunit/extension.neon
3-
- vendor/phpstan/phpstan-phpunit/rules.neon
4-
- vendor/phpstan/phpstan-deprecation-rules/rules.neon
5-
- vendor/phpstan/phpstan-strict-rules/rules.neon
6-
71
parameters:
82
level: 7
93
paths:

Diff for: src/DebugInfoStrategy/NoTrace.php

+3
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,9 @@ public function extractDebugInfo(Throwable $error): ?array
2626
return $debugInfo;
2727
}
2828

29+
/**
30+
* @return Generator<array<string, string|int>>
31+
*/
2932
private function streamStack(?Throwable $previous): Generator
3033
{
3134
if ($previous === null) {

Diff for: src/ErrorConversionMiddleware.php

+3-14
Original file line numberDiff line numberDiff line change
@@ -24,20 +24,9 @@ final class ErrorConversionMiddleware implements MiddlewareInterface
2424

2525
private const STATUS_URL = 'https://httpstatuses.com/';
2626

27-
/**
28-
* @var ResponseFactoryInterface
29-
*/
30-
private $responseFactory;
31-
32-
/**
33-
* @var DebugInfoStrategy
34-
*/
35-
private $debugInfoStrategy;
36-
37-
/**
38-
* @var StatusCodeExtractionStrategy
39-
*/
40-
private $statusCodeExtractor;
27+
private ResponseFactoryInterface $responseFactory;
28+
private DebugInfoStrategy $debugInfoStrategy;
29+
private StatusCodeExtractionStrategy $statusCodeExtractor;
4130

4231
public function __construct(
4332
ResponseFactoryInterface $responseFactory,

Diff for: src/ErrorLoggingMiddleware.php

+1-4
Original file line numberDiff line numberDiff line change
@@ -12,10 +12,7 @@
1212

1313
final class ErrorLoggingMiddleware implements MiddlewareInterface
1414
{
15-
/**
16-
* @var LoggerInterface
17-
*/
18-
private $logger;
15+
private LoggerInterface $logger;
1916

2017
public function __construct(LoggerInterface $logger)
2118
{

Diff for: src/StatusCodeExtractionStrategy/ClassMap.php

+4-2
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ final class ClassMap implements StatusCodeExtractionStrategy
2424
/**
2525
* @var array<string, int>
2626
*/
27-
private $conversionMap;
27+
private array $conversionMap;
2828

2929
/**
3030
* @param array<string, int> $conversionMap
@@ -42,6 +42,8 @@ public function extractStatusCode(Throwable $error): int
4242
}
4343
}
4444

45-
return $error->getCode() ?: StatusCodeInterface::STATUS_INTERNAL_SERVER_ERROR;
45+
$code = $error->getCode();
46+
47+
return $code !== 0 ? $code : StatusCodeInterface::STATUS_INTERNAL_SERVER_ERROR;
4648
}
4749
}

Diff for: tests/ErrorConversionMiddlewareTest.php

+6-13
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,9 @@
44
namespace Lcobucci\ErrorHandling\Tests;
55

66
use Fig\Http\Message\StatusCodeInterface;
7+
use Laminas\Diactoros\Response;
8+
use Laminas\Diactoros\ResponseFactory;
9+
use Laminas\Diactoros\ServerRequest;
710
use Lcobucci\ContentNegotiation\UnformattedResponse;
811
use Lcobucci\ErrorHandling\DebugInfoStrategy;
912
use Lcobucci\ErrorHandling\DebugInfoStrategy\NoDebugInfo;
@@ -16,9 +19,6 @@
1619
use Psr\Http\Server\RequestHandlerInterface;
1720
use RuntimeException;
1821
use Throwable;
19-
use Zend\Diactoros\Response;
20-
use Zend\Diactoros\ResponseFactory;
21-
use Zend\Diactoros\ServerRequest;
2222

2323
/**
2424
* @coversDefaultClass \Lcobucci\ErrorHandling\ErrorConversionMiddleware
@@ -29,15 +29,8 @@
2929
*/
3030
final class ErrorConversionMiddlewareTest extends TestCase
3131
{
32-
/**
33-
* @var ResponseFactory
34-
*/
35-
private $responseFactory;
36-
37-
/**
38-
* @var ClassMap
39-
*/
40-
private $statusCodeExtractor;
32+
private ResponseFactory $responseFactory;
33+
private ClassMap $statusCodeExtractor;
4134

4235
/**
4336
* @before
@@ -94,7 +87,7 @@ public function processShouldConvertTheExceptionIntoAnUnformattedResponseWithThe
9487
}
9588

9689
/**
97-
* @return array<string, array<Throwable|array<string, mixed>>>
90+
* @return array<string, array<Throwable|int|array<string, mixed>>>
9891
*/
9992
public function possibleConversions(): iterable
10093
{

Diff for: tests/ErrorLoggingMiddlewareTest.php

+3-3
Original file line numberDiff line numberDiff line change
@@ -3,14 +3,14 @@
33

44
namespace Lcobucci\ErrorHandling\Tests;
55

6+
use Laminas\Diactoros\Response;
7+
use Laminas\Diactoros\ServerRequest;
68
use Lcobucci\ErrorHandling\ErrorLoggingMiddleware;
79
use PHPUnit\Framework\MockObject\MockObject;
810
use PHPUnit\Framework\TestCase;
911
use Psr\Http\Server\RequestHandlerInterface;
1012
use Psr\Log\LoggerInterface;
1113
use RuntimeException;
12-
use Zend\Diactoros\Response;
13-
use Zend\Diactoros\ServerRequest;
1414

1515
/**
1616
* @coversDefaultClass \Lcobucci\ErrorHandling\ErrorLoggingMiddleware
@@ -20,7 +20,7 @@ final class ErrorLoggingMiddlewareTest extends TestCase
2020
/**
2121
* @var LoggerInterface&MockObject
2222
*/
23-
private $logger;
23+
private LoggerInterface $logger;
2424

2525
/**
2626
* @before

0 commit comments

Comments
 (0)