Skip to content
This repository has been archived by the owner on Nov 23, 2019. It is now read-only.

Commit

Permalink
Merge pull request #23 from acelaya/feature/3.0
Browse files Browse the repository at this point in the history
Feature/3.0
  • Loading branch information
acelaya authored Aug 20, 2019
2 parents a9e1f04 + d78be12 commit 14b261e
Show file tree
Hide file tree
Showing 9 changed files with 44 additions and 48 deletions.
36 changes: 10 additions & 26 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,42 +4,26 @@ branches:
only:
- /.*/

php:
- '7.2'
- '7.3'
- '7.4snapshot'

matrix:
include:
- php: 7.1
env:
- DEPS=lowest
- php: 7.1
env:
- DEPS=latest
- php: 7.2
env:
- DEPS=lowest
- php: 7.2
env:
- DEPS=latest
- php: 7.3
env:
- DEPS=lowest
- php: 7.3
env:
- DEPS=latest
allow_failures:
- php: '7.4snapshot'

before_install:
- phpenv config-rm xdebug.ini || return 0

install:
- composer self-update
- composer install --no-interaction
- if [[ $DEPS == 'latest' ]]; then composer update --no-interaction ; fi
- if [[ $DEPS == 'lowest' ]]; then composer update --no-interaction --prefer-lowest --prefer-stable ; fi
- composer show

script:
- mkdir build
- if [[ $DEPS == 'latest' ]]; then composer ci ; fi
- if [[ $DEPS == 'lowest' ]]; then composer test ; fi
- composer ci

after_success:
- if [[ $DEPS == 'latest' ]]; then wget https://scrutinizer-ci.com/ocular.phar ; fi
- if [[ $DEPS == 'latest' ]]; then php ocular.phar code-coverage:upload --format=php-clover build/clover.xml ; fi
- wget https://scrutinizer-ci.com/ocular.phar
- php ocular.phar code-coverage:upload --format=php-clover build/clover.xml
10 changes: 6 additions & 4 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,23 +4,25 @@ All notable changes to this project will be documented in this file.

The format is based on [Keep a Changelog](https://keepachangelog.com), and this project adheres to [Semantic Versioning](https://semver.org).

## [Unreleased]
## 3.0.0 - 2019-08-20

#### Added

* [#14](https://github.com/acelaya/ze-content-based-error-handler/issues/14) Added PHP 7.3 to build matrix
* [#14](https://github.com/acelaya/ze-content-based-error-handler/issues/14) and [#19](https://github.com/acelaya/ze-content-based-error-handler/issues/19) Added PHP 7.3 and 7.4 to build matrix

#### Changed

* [#16](https://github.com/acelaya/ze-content-based-error-handler/issues/16) Added compatibility with expressive 3
* [#16](https://github.com/acelaya/ze-content-based-error-handler/issues/16) Updated dev dependencies
* [#21](https://github.com/acelaya/ze-content-based-error-handler/issues/21) Updated to coding standard v1.2

#### Deprecated

* *Nothing*

#### Removed

* *Nothing*
* [#18](https://github.com/acelaya/ze-content-based-error-handler/issues/18) Dropped support for PHP 7.1
* [#20](https://github.com/acelaya/ze-content-based-error-handler/issues/20) Dropped support for Expressive 2

#### Fixed

Expand Down
33 changes: 19 additions & 14 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
"name": "acelaya/ze-content-based-error-handler",
"description": "A Zend Expressive error handler which allows to implement different strategies based on the accepted content-types",
"type": "library",
"license": "MIT",
"keywords": [
"expressive",
"zend",
Expand All @@ -10,18 +11,18 @@
"error handler"
],
"require": {
"php": "^7.1",
"php": "^7.2",
"psr/log": "^1.0",
"zendframework/zend-expressive": "^3.0 || ^2.1",
"zendframework/zend-expressive": "^3.0",
"zendframework/zend-servicemanager": "^3.0"
},
"require-dev": {
"infection/infection": "^0.12.0",
"phpstan/phpstan": "^0.11.1",
"phpunit/phpunit": "^8.0 || ^7.5",
"shlinkio/php-coding-standard": "1.0.0"
"infection/infection": "^0.13.4",
"phpstan/phpstan": "^0.11.15",
"phpunit/phpunit": "^8.3",
"shlinkio/php-coding-standard": "~1.2.1",
"zendframework/zend-diactoros": "^2.1.3"
},
"license": "MIT",
"authors": [
{
"name": "Alejandro Celaya",
Expand All @@ -43,20 +44,24 @@
"@cs",
"@stan",
"@test:ci",
"@infection:ci"
"@infect:ci"
],

"cs": "phpcs",
"cs:fix": "phpcbf",
"stan": "phpstan analyse src/ --level=6",

"test": "phpdbg -qrr vendor/bin/phpunit --colors=always",
"test:pretty": "phpdbg -qrr vendor/bin/phpunit --coverage-html build/coverage",
"test:ci": "phpdbg -qrr vendor/bin/phpunit --colors=always --coverage-clover=build/clover.xml --coverage-xml=build/coverage-xml --log-junit=build/phpunit.junit.xml",
"test": "phpdbg -qrr vendor/bin/phpunit --colors=always --testdox",
"test:pretty": "phpdbg -qrr vendor/bin/phpunit --coverage-html build/coverage --testdox",
"test:ci": "phpdbg -qrr vendor/bin/phpunit --colors=always --coverage-clover=build/clover.xml --coverage-xml=build/coverage-xml --log-junit=build/phpunit.junit.xml --testdox",

"infection": "phpdbg -qrr vendor/bin/infection --threads=4 --min-msi=80 --log-verbosity=default --only-covered",
"infection:ci": "phpdbg -qrr vendor/bin/infection --threads=4 --min-msi=80 --log-verbosity=default --only-covered --coverage=build",
"infection:show": "phpdbg -qrr vendor/bin/infection --threads=4 --min-msi=80 --log-verbosity=default --only-covered --show-mutations"
"infect": "infection --threads=4 --min-msi=60 --log-verbosity=default --only-covered",
"infect:ci": "infection --threads=4 --min-msi=60 --log-verbosity=default --only-covered --coverage=build",

"infect:test": [
"@test:ci",
"@infect:ci"
]
},
"extra": {
"zf": {
Expand Down
2 changes: 1 addition & 1 deletion docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,6 @@ version: '3'
services:
ze_cbeh_php:
container_name: ze_cbeh_php
image: composer:1.8.3
image: composer:1.9.0
volumes:
- ./:/app
1 change: 1 addition & 0 deletions src/ErrorHandler/ContentBasedErrorResponseGenerator.php
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
use Psr\Http\Message\ServerRequestInterface as Request;
use Psr\Log\LoggerInterface;
use Throwable;

use function explode;
use function implode;
use function sprintf;
Expand Down
1 change: 1 addition & 0 deletions src/ErrorHandler/ErrorResponseGeneratorManager.php
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@

use Zend\ServiceManager\AbstractPluginManager;
use Zend\ServiceManager\Exception\InvalidServiceException;

use function get_class;
use function gettype;
use function is_callable;
Expand Down
6 changes: 4 additions & 2 deletions src/Log/BasicLogMessageBuilder.php
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,11 @@
use Psr\Http\Message\ResponseInterface as Response;
use Psr\Http\Message\ServerRequestInterface as Request;
use Throwable;
use const PHP_EOL;

use function sprintf;

use const PHP_EOL;

class BasicLogMessageBuilder implements LogMessageBuilderInterface
{
/**
Expand All @@ -19,7 +21,7 @@ class BasicLogMessageBuilder implements LogMessageBuilderInterface
* @param \Throwable|null $err
* @return string
*/
public function buildMessage(Request $request, Response $response, Throwable $err = null): string
public function buildMessage(Request $request, Response $response, ?Throwable $err = null): string
{
$base = 'Error occurred while dispatching request';
if ($err === null) {
Expand Down
2 changes: 1 addition & 1 deletion src/Log/LogMessageBuilderInterface.php
Original file line number Diff line number Diff line change
Expand Up @@ -17,5 +17,5 @@ interface LogMessageBuilderInterface
* @param \Throwable|null $err
* @return string
*/
public function buildMessage(Request $request, Response $response, Throwable $err = null): string;
public function buildMessage(Request $request, Response $response, ?Throwable $err = null): string;
}
1 change: 1 addition & 0 deletions test/Log/BasicLogMessageBuilderTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
use PHPUnit\Framework\TestCase;
use Zend\Diactoros\Response;
use Zend\Diactoros\ServerRequestFactory;

use const PHP_EOL;

class BasicLogMessageBuilderTest extends TestCase
Expand Down

0 comments on commit 14b261e

Please sign in to comment.