mirror of
https://github.com/Seldaek/monolog.git
synced 2025-08-04 04:07:39 +02:00
Fix phpstan build
This commit is contained in:
@@ -72,7 +72,7 @@ class RedisHandler extends AbstractProcessingHandler
|
|||||||
$mode = \defined('Redis::MULTI') ? Redis::MULTI : 1;
|
$mode = \defined('Redis::MULTI') ? Redis::MULTI : 1;
|
||||||
$this->redisClient->multi($mode)
|
$this->redisClient->multi($mode)
|
||||||
->rPush($this->redisKey, $record->formatted)
|
->rPush($this->redisKey, $record->formatted)
|
||||||
->lTrim($this->redisKey, -$this->capSize, -1)
|
->ltrim($this->redisKey, -$this->capSize, -1)
|
||||||
->exec();
|
->exec();
|
||||||
} else {
|
} else {
|
||||||
$redisKey = $this->redisKey;
|
$redisKey = $this->redisKey;
|
||||||
|
@@ -179,7 +179,7 @@ class TestHandler extends AbstractProcessingHandler
|
|||||||
*/
|
*/
|
||||||
public function __call(string $method, array $args): bool
|
public function __call(string $method, array $args): bool
|
||||||
{
|
{
|
||||||
if (preg_match('/(.*)(Debug|Info|Notice|Warning|Error|Critical|Alert|Emergency)(.*)/', $method, $matches) > 0) {
|
if ((bool) preg_match('/(.*)(Debug|Info|Notice|Warning|Error|Critical|Alert|Emergency)(.*)/', $method, $matches)) {
|
||||||
$genericMethod = $matches[1] . ('Records' !== $matches[3] ? 'Record' : '') . $matches[3];
|
$genericMethod = $matches[1] . ('Records' !== $matches[3] ? 'Record' : '') . $matches[3];
|
||||||
$level = \constant(Level::class.'::' . $matches[2]);
|
$level = \constant(Level::class.'::' . $matches[2]);
|
||||||
$callback = [$this, $genericMethod];
|
$callback = [$this, $genericMethod];
|
||||||
|
@@ -200,6 +200,7 @@ final class Utils
|
|||||||
$data = preg_replace_callback(
|
$data = preg_replace_callback(
|
||||||
'/[\x80-\xFF]+/',
|
'/[\x80-\xFF]+/',
|
||||||
function (array $m): string {
|
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') : utf8_encode($m[0]);
|
||||||
},
|
},
|
||||||
$data
|
$data
|
||||||
@@ -234,12 +235,12 @@ final class Utils
|
|||||||
return (int) $val;
|
return (int) $val;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (preg_match('/^\s*(?<val>\d+)(?:\.\d+)?\s*(?<unit>[gmk]?)\s*$/i', $val, $match) !== 1) {
|
if (!(bool) preg_match('/^\s*(?<val>\d+)(?:\.\d+)?\s*(?<unit>[gmk]?)\s*$/i', $val, $match)) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
$val = (int) $match['val'];
|
$val = (int) $match['val'];
|
||||||
switch (strtolower($match['unit'] ?? '')) {
|
switch (strtolower($match['unit'])) {
|
||||||
case 'g':
|
case 'g':
|
||||||
$val *= 1024;
|
$val *= 1024;
|
||||||
// no break
|
// no break
|
||||||
|
Reference in New Issue
Block a user