Skip to content

Commit

Permalink
Add baseline for php8.2
Browse files Browse the repository at this point in the history
  • Loading branch information
Seldaek committed Oct 25, 2024
1 parent b4a48dd commit 11075bc
Show file tree
Hide file tree
Showing 5 changed files with 21 additions and 2 deletions.
1 change: 1 addition & 0 deletions .github/workflows/phpstan.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ jobs:
matrix:
php-version:
- "8.1"
- latest

steps:
- uses: actions/checkout@v4
Expand Down
6 changes: 6 additions & 0 deletions phpstan-baseline-8.2.neon
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
parameters:
ignoreErrors:
-
message: "#^Call to deprecated function utf8_encode\\(\\)\\.$#"
count: 1
path: src/Monolog/Utils.php
10 changes: 10 additions & 0 deletions phpstan-ignore-by-php-version.neon.php
Original file line number Diff line number Diff line change
@@ -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;
1 change: 1 addition & 0 deletions phpstan.neon.dist
Original file line number Diff line number Diff line change
Expand Up @@ -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
5 changes: 3 additions & 2 deletions src/Monolog/Utils.php
Original file line number Diff line number Diff line change
Expand Up @@ -200,8 +200,9 @@ private static function detectAndCleanUtf8(&$data): void
$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
);
Expand Down

0 comments on commit 11075bc

Please sign in to comment.