1
0
mirror of https://github.com/Seldaek/monolog.git synced 2025-08-06 21:26:43 +02:00

Fix phpstan errors, update baseline

This commit is contained in:
Jordi Boggiano
2023-06-20 14:43:04 +02:00
parent 06276fcf77
commit 8941155d2f
3 changed files with 6 additions and 35 deletions

View File

@@ -15,16 +15,6 @@ parameters:
count: 1
path: src/Monolog/Formatter/WildfireFormatter.php
-
message: "#^Instanceof between Monolog\\\\Handler\\\\HandlerInterface and Monolog\\\\Handler\\\\HandlerInterface will always evaluate to true\\.$#"
count: 1
path: src/Monolog/Handler/FilterHandler.php
-
message: "#^Instanceof between Monolog\\\\Handler\\\\HandlerInterface and Monolog\\\\Handler\\\\HandlerInterface will always evaluate to true\\.$#"
count: 1
path: src/Monolog/Handler/FingersCrossedHandler.php
-
message: "#^Short ternary operator is not allowed\\. Use null coalesce operator if applicable or consider using long ternary\\.$#"
count: 1
@@ -50,11 +40,6 @@ parameters:
count: 1
path: src/Monolog/Handler/MandrillHandler.php
-
message: "#^Instanceof between Swift_Message and Swift_Message will always evaluate to true\\.$#"
count: 1
path: src/Monolog/Handler/MandrillHandler.php
-
message: "#^Parameter \\$message of method Monolog\\\\Handler\\\\MandrillHandler\\:\\:__construct\\(\\) has invalid type Swift_Message\\.$#"
count: 3
@@ -66,9 +51,9 @@ parameters:
path: src/Monolog/Handler/MandrillHandler.php
-
message: "#^Instanceof between Monolog\\\\Handler\\\\HandlerInterface and Monolog\\\\Handler\\\\HandlerInterface will always evaluate to true\\.$#"
message: "#^Negated boolean expression is always false\\.$#"
count: 1
path: src/Monolog/Handler/SamplingHandler.php
path: src/Monolog/Handler/SyslogHandler.php
-
message: "#^Variable property access on \\$this\\(Monolog\\\\LogRecord\\)\\.$#"
@@ -95,22 +80,7 @@ parameters:
count: 1
path: src/Monolog/Logger.php
-
message: "#^Comparison operation \"\\<\" between int\\<1, 32\\> and 1 is always false\\.$#"
count: 1
path: src/Monolog/Processor/UidProcessor.php
-
message: "#^Comparison operation \"\\>\" between int\\<1, 32\\> and 32 is always false\\.$#"
count: 1
path: src/Monolog/Processor/UidProcessor.php
-
message: "#^Parameter \\#1 \\$length of function random_bytes expects int\\<1, max\\>, int given\\.$#"
count: 1
path: src/Monolog/Processor/UidProcessor.php
-
message: "#^Parameter \\#2 \\$callback of function preg_replace_callback expects callable\\(array\\<int\\|string, string\\>\\)\\: string, Closure\\(mixed\\)\\: array\\<int, string\\>\\|string\\|false given\\.$#"
count: 1
path: src/Monolog/Utils.php

View File

@@ -181,8 +181,9 @@ class FingersCrossedHandler extends Handler implements ProcessableHandlerInterfa
private function flushBuffer(): void
{
if (null !== $this->passthruLevel) {
$this->buffer = array_filter($this->buffer, function ($record) {
return $this->passthruLevel->includes($record->level);
$passthruLevel = $this->passthruLevel;
$this->buffer = array_filter($this->buffer, static function ($record) use ($passthruLevel) {
return $passthruLevel->includes($record->level);
});
if (count($this->buffer) > 0) {
$this->getHandler(end($this->buffer))->handleBatch($this->buffer);

View File

@@ -199,7 +199,7 @@ final class Utils
if (is_string($data) && preg_match('//u', $data) !== 1) {
$data = preg_replace_callback(
'/[\x80-\xFF]+/',
function ($m) {
function (array $m): string {
return function_exists('mb_convert_encoding') ? mb_convert_encoding($m[0], 'UTF-8', 'ISO-8859-1') : utf8_encode($m[0]);
},
$data