1
0
mirror of https://github.com/Seldaek/monolog.git synced 2025-10-22 09:06:10 +02:00

Add phpstan strict rules and deprecation rules, fix all related issues

This commit is contained in:
Jordi Boggiano
2022-04-24 11:08:10 +02:00
parent ad732b37a7
commit 6627c092d8
62 changed files with 335 additions and 186 deletions

View File

@@ -60,12 +60,12 @@ class PsrLogMessageProcessor implements ProcessorInterface
if (is_null($val) || is_scalar($val) || (is_object($val) && method_exists($val, "__toString"))) {
$replacements[$placeholder] = $val;
} elseif ($val instanceof \DateTimeInterface) {
if (!$this->dateFormat && $val instanceof \Monolog\DateTimeImmutable) {
if (null === $this->dateFormat && $val instanceof \Monolog\DateTimeImmutable) {
// handle monolog dates using __toString if no specific dateFormat was asked for
// so that it follows the useMicroseconds flag
$replacements[$placeholder] = (string) $val;
} else {
$replacements[$placeholder] = $val->format($this->dateFormat ?: static::SIMPLE_DATE);
$replacements[$placeholder] = $val->format($this->dateFormat ?? static::SIMPLE_DATE);
}
} elseif (is_object($val)) {
$replacements[$placeholder] = '[object '.Utils::getClass($val).']';