Skip to content

Commit 11075bc

Browse files
committed
Add baseline for php8.2
1 parent b4a48dd commit 11075bc

File tree

5 files changed

+21
-2
lines changed

5 files changed

+21
-2
lines changed

.github/workflows/phpstan.yml

+1
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@ jobs:
1717
matrix:
1818
php-version:
1919
- "8.1"
20+
- latest
2021

2122
steps:
2223
- uses: actions/checkout@v4

phpstan-baseline-8.2.neon

+6
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
parameters:
2+
ignoreErrors:
3+
-
4+
message: "#^Call to deprecated function utf8_encode\\(\\)\\.$#"
5+
count: 1
6+
path: src/Monolog/Utils.php
+10
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
<?php declare(strict_types = 1);
2+
3+
$includes = [];
4+
if (PHP_VERSION_ID >= 80200) {
5+
$includes[] = __DIR__ . '/phpstan-baseline-8.2.neon';
6+
}
7+
8+
$config['includes'] = $includes;
9+
10+
return $config;

phpstan.neon.dist

+1
Original file line numberDiff line numberDiff line change
@@ -28,5 +28,6 @@ parameters:
2828

2929
includes:
3030
- phpstan-baseline.neon
31+
- phpstan-ignore-by-php-version.neon.php
3132
- vendor/phpstan/phpstan-strict-rules/rules.neon
3233
- vendor/phpstan/phpstan-deprecation-rules/rules.neon

src/Monolog/Utils.php

+3-2
Original file line numberDiff line numberDiff line change
@@ -200,8 +200,9 @@ private static function detectAndCleanUtf8(&$data): void
200200
$data = preg_replace_callback(
201201
'/[\x80-\xFF]+/',
202202
function (array $m): string {
203-
// @phpstan-ignore function.deprecated
204-
return \function_exists('mb_convert_encoding') ? mb_convert_encoding($m[0], 'UTF-8', 'ISO-8859-1') : utf8_encode($m[0]);
203+
return \function_exists('mb_convert_encoding')
204+
? mb_convert_encoding($m[0], 'UTF-8', 'ISO-8859-1')
205+
: (\function_exists('utf8_encode') ? utf8_encode($m[0]) : '');
205206
},
206207
$data
207208
);

0 commit comments

Comments
 (0)