1
0
mirror of https://github.com/Seldaek/monolog.git synced 2025-08-01 10:50:21 +02:00

Add baseline for php8.2

This commit is contained in:
Jordi Boggiano
2024-10-25 22:44:10 +02:00
parent b4a48dd3ee
commit 11075bc016
5 changed files with 21 additions and 2 deletions

View File

@@ -17,6 +17,7 @@ jobs:
matrix:
php-version:
- "8.1"
- latest
steps:
- uses: actions/checkout@v4

View File

@@ -0,0 +1,6 @@
parameters:
ignoreErrors:
-
message: "#^Call to deprecated function utf8_encode\\(\\)\\.$#"
count: 1
path: src/Monolog/Utils.php

View File

@@ -0,0 +1,10 @@
<?php declare(strict_types = 1);
$includes = [];
if (PHP_VERSION_ID >= 80200) {
$includes[] = __DIR__ . '/phpstan-baseline-8.2.neon';
}
$config['includes'] = $includes;
return $config;

View File

@@ -28,5 +28,6 @@ parameters:
includes:
- phpstan-baseline.neon
- phpstan-ignore-by-php-version.neon.php
- vendor/phpstan/phpstan-strict-rules/rules.neon
- vendor/phpstan/phpstan-deprecation-rules/rules.neon

View File

@@ -200,8 +200,9 @@ final class Utils
$data = preg_replace_callback(
'/[\x80-\xFF]+/',
function (array $m): string {
// @phpstan-ignore function.deprecated
return \function_exists('mb_convert_encoding') ? mb_convert_encoding($m[0], 'UTF-8', 'ISO-8859-1') : utf8_encode($m[0]);
return \function_exists('mb_convert_encoding')
? mb_convert_encoding($m[0], 'UTF-8', 'ISO-8859-1')
: (\function_exists('utf8_encode') ? utf8_encode($m[0]) : '');
},
$data
);