mirror of
https://github.com/Seldaek/monolog.git
synced 2025-08-02 19:27:37 +02:00
Fix phpstan error
This commit is contained in:
@@ -110,27 +110,26 @@ class SyslogUdpHandler extends AbstractSyslogHandler
|
|||||||
$hostname = '-';
|
$hostname = '-';
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($this->rfc === self::RFC3164 && ($datetime instanceof \DateTimeImmutable || $datetime instanceof \DateTime)) {
|
if ($this->rfc === self::RFC3164) {
|
||||||
|
// see https://github.com/phpstan/phpstan/issues/5348
|
||||||
|
// @phpstan-ignore-next-line
|
||||||
$dateNew = $datetime->setTimezone(new \DateTimeZone('UTC'));
|
$dateNew = $datetime->setTimezone(new \DateTimeZone('UTC'));
|
||||||
$date = $dateNew->format($this->dateFormats[$this->rfc]);
|
$date = $dateNew->format($this->dateFormats[$this->rfc]);
|
||||||
}
|
|
||||||
else {
|
|
||||||
$date = $datetime->format($this->dateFormats[$this->rfc]);
|
|
||||||
}
|
|
||||||
|
|
||||||
if ($this->rfc === self::RFC3164) {
|
|
||||||
return "<$priority>" .
|
return "<$priority>" .
|
||||||
$date . " " .
|
$date . " " .
|
||||||
$hostname . " " .
|
$hostname . " " .
|
||||||
$this->ident . "[" . $pid . "]: ";
|
$this->ident . "[" . $pid . "]: ";
|
||||||
} else {
|
}
|
||||||
|
|
||||||
|
$date = $datetime->format($this->dateFormats[$this->rfc]);
|
||||||
|
|
||||||
return "<$priority>1 " .
|
return "<$priority>1 " .
|
||||||
$date . " " .
|
$date . " " .
|
||||||
$hostname . " " .
|
$hostname . " " .
|
||||||
$this->ident . " " .
|
$this->ident . " " .
|
||||||
$pid . " - - ";
|
$pid . " - - ";
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Inject your own socket, mainly used for testing
|
* Inject your own socket, mainly used for testing
|
||||||
|
Reference in New Issue
Block a user