mirror of
https://github.com/Seldaek/monolog.git
synced 2025-08-09 06:36:46 +02:00
Last phpstan fixes
This commit is contained in:
@@ -30,7 +30,7 @@
|
|||||||
"rollbar/rollbar": "^1.3",
|
"rollbar/rollbar": "^1.3",
|
||||||
"ruflin/elastica": ">=0.90 <7.0.1",
|
"ruflin/elastica": ">=0.90 <7.0.1",
|
||||||
"swiftmailer/swiftmailer": "^5.3|^6.0",
|
"swiftmailer/swiftmailer": "^5.3|^6.0",
|
||||||
"phpstan/phpstan": "^0.12.59"
|
"phpstan/phpstan": "^0.12.91"
|
||||||
},
|
},
|
||||||
"suggest": {
|
"suggest": {
|
||||||
"graylog2/gelf-php": "Allow sending log messages to a GrayLog2 server",
|
"graylog2/gelf-php": "Allow sending log messages to a GrayLog2 server",
|
||||||
|
@@ -10,18 +10,21 @@ parameters:
|
|||||||
|
|
||||||
ignoreErrors:
|
ignoreErrors:
|
||||||
- '#zend_monitor_|ZEND_MONITOR_#'
|
- '#zend_monitor_|ZEND_MONITOR_#'
|
||||||
- '#^Cannot call method ltrim\(\) on int\|false.$#'
|
|
||||||
- '#MongoDB\\(Client|Collection)#'
|
- '#MongoDB\\(Client|Collection)#'
|
||||||
|
# Invalid type info on Redis multi
|
||||||
|
- '#^Cannot call method ltrim\(\) on int\|false.$#'
|
||||||
|
|
||||||
|
# Cannot resolve this cleanly as different normalizers return different types but it is safe
|
||||||
- message: '#Return type \(string\) of method Monolog\\Formatter\\LineFormatter::normalizeException\(\) should be compatible with return type \(array\) of method Monolog\\Formatter\\NormalizerFormatter::normalizeException\(\)#'
|
- message: '#Return type \(string\) of method Monolog\\Formatter\\LineFormatter::normalizeException\(\) should be compatible with return type \(array\) of method Monolog\\Formatter\\NormalizerFormatter::normalizeException\(\)#'
|
||||||
paths:
|
paths:
|
||||||
- src/Monolog/Formatter/LineFormatter.php
|
- src/Monolog/Formatter/LineFormatter.php
|
||||||
- message: '#Method Monolog\\Handler\\LogglyHandler::loadCurlHandle\(\) never returns resource so it can be removed from the return typehint.#'
|
|
||||||
paths:
|
|
||||||
- src/Monolog/Handler/LogglyHandler.php
|
|
||||||
|
|
||||||
# blocked until we only support php8+
|
# blocked until we only support php8+
|
||||||
- '#Parameter \#1 \$socket of function (socket_close|socket_sendto|socket_send) expects Socket, resource\|Socket(\|null)? given\.#'
|
- '#Parameter \#1 \$socket of function (socket_close|socket_sendto|socket_send) expects Socket, resource\|Socket(\|null)? given\.#'
|
||||||
- '#Parameter \#1 \$handle of function (curl_exec|curl_close|curl_error|curl_errno|curl_setopt) expects CurlHandle, CurlHandle\|resource(\|null)? given\.#'
|
- '#Parameter \#1 \$handle of function (curl_exec|curl_close|curl_error|curl_errno|curl_setopt) expects CurlHandle, CurlHandle\|resource(\|null)? given\.#'
|
||||||
|
- message: '#Method Monolog\\Handler\\LogglyHandler::loadCurlHandle\(\) never returns resource so it can be removed from the return typehint.#'
|
||||||
|
paths:
|
||||||
|
- src/Monolog/Handler/LogglyHandler.php
|
||||||
|
|
||||||
# blocked by https://github.com/phpstan/phpstan/issues/5091
|
# blocked by https://github.com/phpstan/phpstan/issues/5091
|
||||||
- '#has unknown class Monolog\\Handler\\Record#'
|
- '#has unknown class Monolog\\Handler\\Record#'
|
||||||
|
@@ -172,11 +172,14 @@ class NormalizerFormatter implements FormatterInterface
|
|||||||
}
|
}
|
||||||
|
|
||||||
if ($data instanceof \JsonSerializable) {
|
if ($data instanceof \JsonSerializable) {
|
||||||
|
/** @var null|scalar|array<array|scalar|null> $value */
|
||||||
$value = $data->jsonSerialize();
|
$value = $data->jsonSerialize();
|
||||||
} elseif (method_exists($data, '__toString')) {
|
} elseif (method_exists($data, '__toString')) {
|
||||||
|
/** @var string $value */
|
||||||
$value = $data->__toString();
|
$value = $data->__toString();
|
||||||
} else {
|
} else {
|
||||||
// the rest is normalized by json encoding and decoding it
|
// the rest is normalized by json encoding and decoding it
|
||||||
|
/** @var null|scalar|array<array|scalar|null> $value */
|
||||||
$value = json_decode($this->toJson($data, true), true);
|
$value = json_decode($this->toJson($data, true), true);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@@ -74,8 +74,6 @@ class FirePHPHandler extends AbstractProcessingHandler
|
|||||||
{
|
{
|
||||||
$header = sprintf('%s-%s', static::HEADER_PREFIX, join('-', $meta));
|
$header = sprintf('%s-%s', static::HEADER_PREFIX, join('-', $meta));
|
||||||
|
|
||||||
// See https://github.com/phpstan/phpstan/issues/5219
|
|
||||||
// @phpstan-ignore-next-line
|
|
||||||
return [$header => $message];
|
return [$header => $message];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@@ -436,7 +436,6 @@ class Logger implements LoggerInterface, ResettableInterface
|
|||||||
throw new InvalidArgumentException('Level "'.var_export($level, true).'" is not defined, use one of: '.implode(', ', array_keys(static::$levels) + static::$levels));
|
throw new InvalidArgumentException('Level "'.var_export($level, true).'" is not defined, use one of: '.implode(', ', array_keys(static::$levels) + static::$levels));
|
||||||
}
|
}
|
||||||
|
|
||||||
/** @phpstan-ignore-next-line */
|
|
||||||
return $level;
|
return $level;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user