Skip to content

Commit e5fd6f6

Browse files
committed
Issue #55: Remove PHP 8.1 and add PHP 8.4 & 8.5 support
Signed-off-by: alexmerlin <alex.merlin.1985@gmail.com>
1 parent 0c46abe commit e5fd6f6

23 files changed

+281
-365
lines changed

.github/workflows/codecov.yml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,8 @@ jobs:
1717
php:
1818
- "8.2"
1919
- "8.3"
20+
- "8.4"
21+
- "8.5"
2022

2123
steps:
2224
- name: Checkout

.github/workflows/docs-build.yml

Lines changed: 0 additions & 16 deletions
This file was deleted.
Lines changed: 50 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,50 @@
1+
on:
2+
- push
3+
4+
name: Run PHPStan checks
5+
6+
jobs:
7+
mutation:
8+
name: PHPStan ${{ matrix.php }}-${{ matrix.os }}
9+
10+
runs-on: ${{ matrix.os }}
11+
12+
strategy:
13+
matrix:
14+
os:
15+
- ubuntu-latest
16+
17+
php:
18+
- "8.2"
19+
- "8.3"
20+
- "8.4"
21+
- "8.5"
22+
23+
steps:
24+
- name: Checkout
25+
uses: actions/checkout@v4
26+
27+
- name: Install PHP
28+
uses: shivammathur/setup-php@v2
29+
with:
30+
php-version: "${{ matrix.php }}"
31+
coverage: pcov
32+
ini-values: assert.exception=1, zend.assertions=1, error_reporting=-1, log_errors_max_len=0, display_errors=On
33+
tools: composer:v2, cs2pr
34+
35+
- name: Determine composer cache directory
36+
run: echo "COMPOSER_CACHE_DIR=$(composer config cache-dir)" >> $GITHUB_ENV
37+
38+
- name: Cache dependencies installed with composer
39+
uses: actions/cache@v4
40+
with:
41+
path: ${{ env.COMPOSER_CACHE_DIR }}
42+
key: php${{ matrix.php }}-composer-${{ hashFiles('**/composer.json') }}
43+
restore-keys: |
44+
php${{ matrix.php }}-composer-
45+
46+
- name: Install dependencies with composer
47+
run: composer install --prefer-dist --no-interaction --no-progress --optimize-autoloader --ansi
48+
49+
- name: Run static analysis with PHPStan
50+
run: vendor/bin/phpstan analyse

README.md

Lines changed: 37 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,22 @@
11
# dot-errorhandler
22

3-
Error Logging Handler for DotKernel
3+
Error Logging Handler for Dotkernel
4+
5+
## Version History
6+
7+
| Branch | Release | Service Manager | Log style implementation | PHP Version |
8+
|--------|----------|-------------------|--------------------------|------------------------------------------------------------------------------------------------------------------|
9+
| 4.0 | < 4.1.0 | Service Manager 3 | Laminas Log style | ![PHP from Packagist (specify version)](https://img.shields.io/packagist/php-v/dotkernel/dot-errorhandler/4.0.1) |
10+
| 3.0 | < 4.0.0 | Service Manager 3 | Laminas Log | ![PHP from Packagist (specify version)](https://img.shields.io/packagist/php-v/dotkernel/dot-errorhandler/3.4.1) |
11+
12+
## Documentation
13+
14+
Documentation is available at: https://docs.dotkernel.org/dot-errorhandler/
15+
16+
## Badges
417

518
![OSS Lifecycle](https://img.shields.io/osslifecycle/dotkernel/dot-errorhandler)
6-
![PHP from Packagist (specify version)](https://img.shields.io/packagist/php-v/dotkernel/dot-errorhandler/4.0.0)
19+
![PHP from Packagist (specify version)](https://img.shields.io/packagist/php-v/dotkernel/dot-errorhandler/4.0.1)
720

821
[![GitHub issues](https://img.shields.io/github/issues/dotkernel/dot-errorhandler)](https://github.com/dotkernel/dot-errorhandler/issues)
922
[![GitHub forks](https://img.shields.io/github/forks/dotkernel/dot-errorhandler)](https://github.com/dotkernel/dot-errorhandler/network)
@@ -12,24 +25,27 @@ Error Logging Handler for DotKernel
1225

1326
[![Build Static](https://github.com/dotkernel/dot-errorhandler/actions/workflows/continuous-integration.yml/badge.svg?branch=4.0)](https://github.com/dotkernel/dot-errorhandler/actions/workflows/continuous-integration.yml)
1427
[![codecov](https://codecov.io/gh/dotkernel/dot-errorhandler/branch/4.0/graph/badge.svg?token=0KIJARS5RS)](https://codecov.io/gh/dotkernel/dot-errorhandler)
15-
16-
[![SymfonyInsight](https://insight.symfony.com/projects/cf1f8d89-f230-4157-bc8b-7cce20c75454/big.svg)](https://insight.symfony.com/projects/cf1f8d89-f230-4157-bc8b-7cce20c75454)
28+
[![PHPStan](https://github.com/dotkernel/dot-errorhandler/actions/workflows/static-analysis.yml/badge.svg?branch=4.0)](https://github.com/dotkernel/dot-errorhandler/actions/workflows/static-analysis.yml)
1729

1830
## Adding the error handler
1931

20-
- Add the composer package:
32+
- Add the Composer package.
2133

22-
`composer require dotkernel/dot-errorhandler`
34+
```shell
35+
composer require dotkernel/dot-errorhandler
36+
```
2337

2438
- Add the config provider
2539
- in `config/config.php` add `\Dot\ErrorHandler\ConfigProvider`
2640
- in `config/pipeline.php` add `\Dot\ErrorHandler\ErrorHandlerInterface::class`
2741
- the interface is used as an alias to keep all error handling related configurations in one file
28-
- **IMPORTANT NOTE** there should be no other error handlers after this one (only before) because the other error handler will catch the error causing dot-errorhandler not to catch any error, we recommend using just one error handler unless you have an error-specific handler
2942

30-
- Configure the error handler as shown below
43+
> If you need other error handlers, you should place them before DotErrorhandler in the pipeline; else it will not be able to catch errors.
44+
> We recommend using just one error handler unless you have an error-specific handler.
3145
32-
config/autoload/error-handling.global.php
46+
- Configure the error handler as shown below.
47+
48+
In `config/autoload/error-handling.global.php`:
3349

3450
```php
3551
<?php
@@ -54,45 +70,35 @@ return [
5470

5571
A configuration example for the default logger can be found in `config/log.global.php.dist`.
5672

57-
When declaring the `ErrorHandlerInterface` alias you can choose whether to log or not:
58-
59-
- for logging use `LogErrorHandler`
60-
- for the simple Zend Expressive handler user `ErrorHandler`
73+
When configuring the error handler in your application, you can choose between two classes:
6174

62-
The class `Dot\ErrorHandler\ErrorHandler` is the same as the Zend Expressive error handling class
63-
the only difference being the removal of the `final` statement for making extension possible.
75+
- `Dot\ErrorHandler\LogErrorHandler`: for logging and displaying errors
76+
- `Dot\ErrorHandler\ErrorHandler`: for displaying errors only
6477

65-
The class `Dot\ErrorHandler\LogErrorHandler` is `Dot\ErrorHandler\ErrorHandler` with
66-
added logging support.
67-
68-
As a note: both `LogErrorHandler` and `ErrorHandler` have factories declared in the
69-
package's `ConfigProvider`. If you need a custom ErrorHandler it must have a factory
70-
declared in the config, as in the example.
78+
> Both `LogErrorHandler` and `ErrorHandler` have factories declared in the package's `ConfigProvider`.
79+
> If you need a custom ErrorHandler, it must have a factory declared in the config, as in the below example:
7180
7281
Example:
7382

7483
```php
7584
<?php
7685

77-
use Dot\ErrorHandler\ErrorHandlerInterface;
78-
use Custom\MyErrorHandler;
79-
use Custom\MyErrorHandlerFactory;
86+
declare(strict_types=1);
8087

8188
return [
82-
'dependencies' => [
89+
'dependencies' => [
8390
'factories' => [
84-
MyErrorHandler::class => MyCustomHandlerFactory::class,
91+
\App\CustomErrorHandler::class => \App\CustomHandlerFactory::class,
8592
],
86-
8793
'aliases' => [
88-
ErrorHandlerInterface::class => MyErrorHandler::class,
89-
]
94+
\Dot\ErrorHandler\ErrorHandlerInterface::class => \App\CustomErrorHandler::class,
95+
],
9096

9197
],
9298
'dot-errorhandler' => [
9399
'loggerEnabled' => true,
94-
'logger' => 'dot-log.default_logger'
95-
]
100+
'logger' => 'dot-log.default_logger',
101+
],
96102
];
97103
```
98104

composer.json

Lines changed: 15 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
"homepage": "https://github.com/dotkernel/dot-errorhandler",
77
"authors": [
88
{
9-
"name": "DotKernel Team",
9+
"name": "Dotkernel Team",
1010
"email": "team@dotkernel.com"
1111
}
1212
],
@@ -26,19 +26,20 @@
2626
}
2727
},
2828
"require": {
29-
"php": "~8.2.0 || ~8.3.0",
30-
"dotkernel/dot-log": "^4.0.2",
31-
"laminas/laminas-diactoros": "^3.3",
32-
"laminas/laminas-stratigility": "^3.11",
33-
"mezzio/mezzio": "^3.19",
29+
"php": "~8.2.0 || ~8.3.0 || ~8.4.0 || ~8.5.0",
30+
"dotkernel/dot-log": "^4.0.5",
31+
"laminas/laminas-diactoros": "^3.8.0",
32+
"laminas/laminas-stratigility": "^4.3.0",
3433
"psr/http-message": "^1.0 || ^2.0",
35-
"psr/http-server-middleware": "^1.0"
34+
"psr/http-server-middleware": "^1.0",
35+
"psr/log": "^3.0"
3636
},
3737
"require-dev": {
38-
"laminas/laminas-coding-standard": "^2.5",
38+
"laminas/laminas-coding-standard": "^3.0",
3939
"mikey179/vfsstream": "^1.6.7",
40-
"phpunit/phpunit": "^10.5",
41-
"vimeo/psalm": "^5.22"
40+
"phpstan/phpstan": "^2.1",
41+
"phpstan/phpstan-phpunit": "^2.0",
42+
"phpunit/phpunit": "^10.5"
4243
},
4344
"autoload": {
4445
"psr-4": {
@@ -54,12 +55,12 @@
5455
"scripts": {
5556
"check": [
5657
"@cs-check",
57-
"@test"
58+
"@test",
59+
"@static-analysis"
5860
],
5961
"cs-check": "phpcs",
6062
"cs-fix": "phpcbf",
61-
"test": "phpunit --colors=always",
62-
"test-coverage": "phpunit --colors=always --coverage-clover clover.xml",
63-
"static-analysis": "psalm --shepherd --stats"
63+
"static-analysis": "phpstan analyse --memory-limit 1G",
64+
"test": "phpunit --colors=always"
6465
}
6566
}

config/error-handling.global.php.dist

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -7,10 +7,10 @@ return [
77
'dependencies' => [
88
'aliases' => [
99
ErrorHandlerInterface::class => LogErrorHandler::class,
10-
]
10+
],
1111
],
1212
'dot-errorhandler' => [
1313
'loggerEnabled' => true,
14-
'logger' => 'dot-log.default_logger'
15-
]
14+
'logger' => 'dot-log.default_logger',
15+
],
1616
];

docs/book/index.md

Lines changed: 0 additions & 1 deletion
This file was deleted.

docs/book/v3/configuration.md

Lines changed: 0 additions & 76 deletions
This file was deleted.

docs/book/v3/installation.md

Lines changed: 0 additions & 5 deletions
This file was deleted.

docs/book/v3/overview.md

Lines changed: 0 additions & 6 deletions
This file was deleted.

0 commit comments

Comments
 (0)