Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .github/workflows/ci_build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ jobs:
strategy:
fail-fast: false
matrix:
php-versions: ['8.2', '8.3', '8.4', '8.5']
php-versions: ['8.3', '8.4', '8.5']
steps:
- name: Setup PHP Action
uses: shivammathur/setup-php@v2
Expand Down
6 changes: 3 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,11 +7,11 @@ ErrorHeroModule
[![PHPStan](https://img.shields.io/badge/style-level%20max-brightgreen.svg?style=flat-square&label=phpstan)](https://github.com/phpstan/phpstan)
[![Downloads](https://poser.pugx.org/samsonasik/error-hero-module/downloads)](https://packagist.org/packages/samsonasik/error-hero-module)

> This is README for version ^6.0 which only support Laminas Mvc version 3 and Mezzio version 3 with php ^8.2.
> This is README for version ^7.0 which bump laminas-diactoros to ^3.8 and bump doctrine-orm-module to ^6.3, and only support Laminas Mvc version 3 and Mezzio version 3 with php ^8.3

> For version ^5.0, you can read at [version 5 readme](https://github.com/samsonasik/ErrorHeroModule/tree/5.x.x) which only support Laminas Mvc version 3 and Mezzio version 3 with php ^8.1.
> For version ^6.0, you can read at [version 6 readme](https://github.com/samsonasik/ErrorHeroModule/tree/6.x.x) which only support Laminas Mvc version 3 and Mezzio version 3 with php ^8.2.

> For version ^4.0, you can read at [version 4 readme](https://github.com/samsonasik/ErrorHeroModule/tree/4.x.x) which only support Laminas Mvc version 3 and Mezzio version 3 with php ^8.0.
> For version ^5.0, you can read at [version 5 readme](https://github.com/samsonasik/ErrorHeroModule/tree/5.x.x) which only support Laminas Mvc version 3 and Mezzio version 3 with php ^8.1.

Introduction
------------
Expand Down
2 changes: 1 addition & 1 deletion composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@
}
],
"require": {
"php": "^8.2",
"php": "^8.3",
"laminas/laminas-db": "^2.20.0",
"laminas/laminas-diactoros": "^3.8",
"laminas/laminas-log": "^2.17.1",
Expand Down
5 changes: 3 additions & 2 deletions src/Command/BaseLoggingCommand.php
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@

use ErrorHeroModule\Handler\Logging;
use ErrorHeroModule\HeroTrait;
use Override;
use Symfony\Component\Console\Command\Command;
use Symfony\Component\Console\Helper\Table;
use Symfony\Component\Console\Input\InputInterface;
Expand All @@ -18,8 +19,7 @@ abstract class BaseLoggingCommand extends Command
{
use HeroTrait;

/** @var string */
private const DISPLAY_SETTINGS = 'display-settings';
private const string DISPLAY_SETTINGS = 'display-settings';

private array $errorHeroModuleConfig;

Expand All @@ -36,6 +36,7 @@ public function init(array $errorHeroModuleConfig, Logging $logging): void
$this->logging = $logging;
}

#[Override]
public function run(InputInterface $input, OutputInterface $output): int
{
try {
Expand Down
2 changes: 2 additions & 0 deletions src/Compat/LoggerAbstractServiceFactory.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,13 +4,15 @@

namespace ErrorHeroModule\Compat;

use Override;
use Psr\Container\ContainerInterface;

class LoggerAbstractServiceFactory extends \Laminas\Log\LoggerAbstractServiceFactory
{
/**
* {@inheritdoc}
*/
#[Override]
public function __invoke(ContainerInterface $container, $requestedName, ?array $options = null)
{
$config = $this->getConfig($container);
Expand Down
5 changes: 3 additions & 2 deletions src/Handler/Formatter/Json.php
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
use DateTime;
use Laminas\Log\Formatter\FormatterInterface;
use Laminas\Log\Formatter\Json as BaseJson;
use Override;

use function json_encode;
use function str_replace;
Expand All @@ -18,13 +19,13 @@

final class Json extends BaseJson implements FormatterInterface
{
/** @var string */
private const TIMESTAMP = 'timestamp';
private const string TIMESTAMP = 'timestamp';

/**
* @param array<string, DateTime> $event event data
* @return string formatted line to write to the log
*/
#[Override]
public function format($event): string
{
static $timestamp;
Expand Down
21 changes: 7 additions & 14 deletions src/Handler/Logging.php
Original file line number Diff line number Diff line change
Expand Up @@ -40,26 +40,19 @@ final class Logging

private readonly string $emailSender;

/** @var string */
private const PRIORITY = 'priority';
private const string PRIORITY = 'priority';

/** @var string */
private const ERROR_TYPE = 'errorType';
private const string ERROR_TYPE = 'errorType';

/** @var string */
private const ERROR_FILE = 'errorFile';
private const string ERROR_FILE = 'errorFile';

/** @var string */
private const ERROR_LINE = 'errorLine';
private const string ERROR_LINE = 'errorLine';

/** @var string */
private const TRACE = 'trace';
private const string TRACE = 'trace';

/** @var string */
private const ERROR_MESSAGE = 'errorMessage';
private const string ERROR_MESSAGE = 'errorMessage';

/** @var string */
private const SERVER_URL = 'server_url';
private const string SERVER_URL = 'server_url';

public function __construct(
private readonly Logger $logger,
Expand Down
9 changes: 3 additions & 6 deletions src/Handler/Writer/Checker/Db.php
Original file line number Diff line number Diff line change
Expand Up @@ -14,14 +14,11 @@

final readonly class Db
{
/** @var string */
private const OPTIONS = 'options';
private const string OPTIONS = 'options';

/** @var string */
private const COLUMN = 'column';
private const string COLUMN = 'column';

/** @var string */
private const EXTRA = 'extra';
private const string EXTRA = 'extra';

public function __construct(
private DbWriter $dbWriter,
Expand Down
5 changes: 3 additions & 2 deletions src/Handler/Writer/Mail.php
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@
use Laminas\Mime\Message as MimeMessage;
use Laminas\Mime\Mime;
use Laminas\Mime\Part;
use Override;

use function fopen;
use function implode;
Expand All @@ -26,8 +27,7 @@

final class Mail extends BaseMail
{
/** @var string */
private const NAME = 'name';
private const string NAME = 'name';

/**
* @throws LogException\InvalidArgumentException
Expand All @@ -45,6 +45,7 @@ public function __construct(
*
* Override with apply attachment whenever there is $_FILES data
*/
#[Override]
public function shutdown(): void
{
// Always provide events to mail as plaintext.
Expand Down
2 changes: 1 addition & 1 deletion src/HeroConstant.php
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@
final class HeroConstant
{
/** @var array<int, string> */
public const ERROR_TYPE = [
public const array ERROR_TYPE = [
E_ERROR => 'E_ERROR',
E_WARNING => 'E_WARNING',
E_PARSE => 'E_PARSE',
Expand Down
6 changes: 2 additions & 4 deletions src/Listener/Mvc.php
Original file line number Diff line number Diff line change
Expand Up @@ -26,11 +26,9 @@ final class Mvc extends AbstractListenerAggregate

private ?MvcEvent $mvcEvent = null;

/** @var string */
private const DISPLAY_SETTINGS = 'display-settings';
private const string DISPLAY_SETTINGS = 'display-settings';

/** @var string */
private const MESSAGE = 'message';
private const string MESSAGE = 'message';

public function __construct(
private readonly array $errorHeroModuleConfig,
Expand Down
3 changes: 1 addition & 2 deletions src/Middleware/Mezzio.php
Original file line number Diff line number Diff line change
Expand Up @@ -31,8 +31,7 @@ final class Mezzio implements MiddlewareInterface

private ?ServerRequestInterface $request = null;

/** @var string */
private const DISPLAY_SETTINGS = 'display-settings';
private const string DISPLAY_SETTINGS = 'display-settings';

/**
* @param array{exclude-exceptions: array, enable: bool, display-settings: array} $errorHeroModuleConfig
Expand Down
2 changes: 1 addition & 1 deletion src/Middleware/MezzioFactory.php
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@
final class MezzioFactory
{
/** @var array<string, string> */
private const CONTAINERS_TRANSFORM = [
private const array CONTAINERS_TRANSFORM = [
ContainerBuilder::class => SymfonyService::class,
Psr11PimpleContainer::class => PimpleService::class,
];
Expand Down
3 changes: 1 addition & 2 deletions src/Transformer/TransformerAbstract.php
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,7 @@

abstract class TransformerAbstract
{
/** @var string */
private const DB = 'db';
private const string DB = 'db';

/**
* @return array{array{name: string, options: array}}
Expand Down
Loading