diff --git a/phpstan-baseline.neon b/phpstan-baseline.neon index 94b59539..9916d2d9 100644 --- a/phpstan-baseline.neon +++ b/phpstan-baseline.neon @@ -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\\\\)\\: string, Closure\\(mixed\\)\\: array\\\\|string\\|false given\\.$#" - count: 1 - path: src/Monolog/Utils.php diff --git a/src/Monolog/Handler/FingersCrossedHandler.php b/src/Monolog/Handler/FingersCrossedHandler.php index 888ec998..1c3df386 100644 --- a/src/Monolog/Handler/FingersCrossedHandler.php +++ b/src/Monolog/Handler/FingersCrossedHandler.php @@ -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); diff --git a/src/Monolog/Utils.php b/src/Monolog/Utils.php index 9dae2535..7848f0ec 100644 --- a/src/Monolog/Utils.php +++ b/src/Monolog/Utils.php @@ -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