Skip to content

Commit 970c452

Browse files
authored
Drop support for php5 (#16)
1 parent 18d19ac commit 970c452

File tree

9 files changed

+19
-20
lines changed

9 files changed

+19
-20
lines changed

.travis.yml

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,6 @@
11
language: php
22

33
php:
4-
- 5.5
5-
- 5.6
6-
- 7.1
74
- 7.2
85

96
before_script:

composer.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -20,13 +20,13 @@
2020
}
2121
},
2222
"require": {
23-
"php": ">=5.5",
23+
"php": ">=7.2",
2424
"ext-json": "*",
2525
"guzzlehttp/guzzle": "6.*",
2626
"psr/log": "~1.0"
2727
},
2828
"require-dev": {
29-
"phpunit/phpunit": "4.*|5.*",
29+
"phpunit/phpunit": "7.*",
3030
"webthink/codesniffer": "1.*"
3131
},
3232
"scripts": {

src/Handler/ArrayHandler.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ public function __construct(LogLevelStrategyInterface $logLevelStrategy = null)
3535
* @param array $options
3636
* @return void
3737
*/
38-
public function log(LoggerInterface $logger, $value, array $options = [])
38+
public function log(LoggerInterface $logger, $value, array $options = []): void
3939
{
4040
if ($value instanceof ResponseInterface) {
4141
$context['response']['headers'] = $value->getHeaders();

src/Handler/HandlerInterface.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,5 +18,5 @@ interface HandlerInterface
1818
* @param array $options
1919
* @return void
2020
*/
21-
public function log(LoggerInterface $logger, $value, array $options = []);
21+
public function log(LoggerInterface $logger, $value, array $options = []): void;
2222
}

src/Handler/LogLevel/LogLevelStrategy.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ class LogLevelStrategy implements LogLevelStrategyInterface
3434
* @param array $options
3535
* @return string LogLevel
3636
*/
37-
public function getLevel($value, array $options = [])
37+
public function getLevel($value, array $options = []): string
3838
{
3939
$this->setOptions($options);
4040
if ($value instanceof \Exception) {
@@ -60,7 +60,7 @@ public function getLevel($value, array $options = [])
6060
* @param array $options
6161
* @return void
6262
*/
63-
private function setOptions(array $options)
63+
private function setOptions(array $options): void
6464
{
6565
if (!isset($options['log'])) {
6666
return;
@@ -82,7 +82,7 @@ private function setOptions(array $options)
8282
* @param ResponseInterface $response
8383
* @return string
8484
*/
85-
private function getResponseLevel(ResponseInterface $response)
85+
private function getResponseLevel(ResponseInterface $response): string
8686
{
8787
$code = $response->getStatusCode();
8888
if ($code === 0) {

src/Handler/StringHandler.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ public function __construct(LogLevelStrategyInterface $logLevelStrategy = null)
3535
* @param array $options
3636
* @return void
3737
*/
38-
public function log(LoggerInterface $logger, $value, array $options = [])
38+
public function log(LoggerInterface $logger, $value, array $options = []): void
3939
{
4040
$level = $this->logLevelStrategy->getLevel($value, $options);
4141
if ($value instanceof MessageInterface) {

src/Middleware/LoggerMiddleware.php

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -51,8 +51,8 @@ class LoggerMiddleware
5151
public function __construct(
5252
LoggerInterface $logger,
5353
HandlerInterface $handler = null,
54-
$onExceptionOnly = false,
55-
$logStatistics = false
54+
bool $onExceptionOnly = false,
55+
bool $logStatistics = false
5656
) {
5757
$this->logger = $logger;
5858
$this->onExceptionOnly = $onExceptionOnly;
@@ -64,9 +64,9 @@ public function __construct(
6464
* Called when the middleware is handled by the client.
6565
*
6666
* @param callable $handler
67-
* @return Closure
67+
* @return callable
6868
*/
69-
public function __invoke(callable $handler)
69+
public function __invoke(callable $handler): callable
7070
{
7171
return function (RequestInterface $request, array $options) use ($handler) {
7272
$this->setOptions($options);
@@ -94,7 +94,7 @@ public function __invoke(callable $handler)
9494
* @param array $options
9595
* @return Closure
9696
*/
97-
private function handleSuccess(RequestInterface $request, array $options)
97+
private function handleSuccess(RequestInterface $request, array $options): callable
9898
{
9999
return function (ResponseInterface $response) use ($request, $options) {
100100
// On exception only is true then it must not log the response since it was successful.
@@ -113,7 +113,7 @@ private function handleSuccess(RequestInterface $request, array $options)
113113
* @param array $options
114114
* @return Closure
115115
*/
116-
private function handleFailure(RequestInterface $request, array $options)
116+
private function handleFailure(RequestInterface $request, array $options): callable
117117
{
118118
return function (\Exception $reason) use ($request, $options) {
119119
if ($this->onExceptionOnly === true) {
@@ -135,7 +135,7 @@ private function handleFailure(RequestInterface $request, array $options)
135135
* @param array $options
136136
* @return void
137137
*/
138-
private function setOptions(array $options)
138+
private function setOptions(array $options): void
139139
{
140140
if (!isset($options['log'])) {
141141
return;

tests/Unit/Handler/StringHandlerTest.php

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,9 +8,10 @@
88
use GuzzleHttp\Psr7\Request;
99
use GuzzleHttp\Psr7\Response;
1010
use GuzzleHttp\TransferStats;
11+
use PHPUnit\Framework\TestCase;
1112
use Psr\Log\LogLevel;
1213

13-
final class StringHandlerTest extends \PHPUnit_Framework_TestCase
14+
final class StringHandlerTest extends TestCase
1415
{
1516
/**
1617
* @var HandlerInterface

tests/Unit/Middleware/LoggerMiddlewareTest.php

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,9 +12,10 @@
1212
use GuzzleHttp\HandlerStack;
1313
use GuzzleHttp\Psr7\Response;
1414
use GuzzleHttp\RequestOptions;
15+
use PHPUnit\Framework\TestCase;
1516
use Psr\Log\LogLevel;
1617

17-
final class LoggerMiddlewareTest extends \PHPUnit_Framework_TestCase
18+
final class LoggerMiddlewareTest extends TestCase
1819
{
1920
/**
2021
* @var MockHandler

0 commit comments

Comments
 (0)