mirror of
https://github.com/Seldaek/monolog.git
synced 2025-08-07 05:36:45 +02:00
explicitly mark nullable parameters as nullable (#1874)
This commit is contained in:
committed by
GitHub
parent
437cb3628f
commit
b0a861a9cc
@@ -161,7 +161,7 @@ class FilterHandler extends Handler implements ProcessableHandlerInterface, Rese
|
|||||||
*
|
*
|
||||||
* @phpstan-param Record $record
|
* @phpstan-param Record $record
|
||||||
*/
|
*/
|
||||||
public function getHandler(array $record = null)
|
public function getHandler(?array $record = null)
|
||||||
{
|
{
|
||||||
if (!$this->handler instanceof HandlerInterface) {
|
if (!$this->handler instanceof HandlerInterface) {
|
||||||
$this->handler = ($this->handler)($record, $this);
|
$this->handler = ($this->handler)($record, $this);
|
||||||
|
@@ -210,7 +210,7 @@ class FingersCrossedHandler extends Handler implements ProcessableHandlerInterfa
|
|||||||
*
|
*
|
||||||
* @phpstan-param Record $record
|
* @phpstan-param Record $record
|
||||||
*/
|
*/
|
||||||
public function getHandler(array $record = null)
|
public function getHandler(?array $record = null)
|
||||||
{
|
{
|
||||||
if (!$this->handler instanceof HandlerInterface) {
|
if (!$this->handler instanceof HandlerInterface) {
|
||||||
$this->handler = ($this->handler)($record, $this);
|
$this->handler = ($this->handler)($record, $this);
|
||||||
|
@@ -90,7 +90,7 @@ class SamplingHandler extends AbstractHandler implements ProcessableHandlerInter
|
|||||||
*
|
*
|
||||||
* @return HandlerInterface
|
* @return HandlerInterface
|
||||||
*/
|
*/
|
||||||
public function getHandler(array $record = null)
|
public function getHandler(?array $record = null)
|
||||||
{
|
{
|
||||||
if (!$this->handler instanceof HandlerInterface) {
|
if (!$this->handler instanceof HandlerInterface) {
|
||||||
$this->handler = ($this->handler)($record, $this);
|
$this->handler = ($this->handler)($record, $this);
|
||||||
|
@@ -100,7 +100,7 @@ class SlackRecord
|
|||||||
bool $useShortAttachment = false,
|
bool $useShortAttachment = false,
|
||||||
bool $includeContextAndExtra = false,
|
bool $includeContextAndExtra = false,
|
||||||
array $excludeFields = array(),
|
array $excludeFields = array(),
|
||||||
FormatterInterface $formatter = null
|
?FormatterInterface $formatter = null
|
||||||
) {
|
) {
|
||||||
$this
|
$this
|
||||||
->setChannel($channel)
|
->setChannel($channel)
|
||||||
|
@@ -108,9 +108,9 @@ class TelegramBotHandler extends AbstractProcessingHandler
|
|||||||
string $channel,
|
string $channel,
|
||||||
$level = Logger::DEBUG,
|
$level = Logger::DEBUG,
|
||||||
bool $bubble = true,
|
bool $bubble = true,
|
||||||
string $parseMode = null,
|
?string $parseMode = null,
|
||||||
bool $disableWebPagePreview = null,
|
?bool $disableWebPagePreview = null,
|
||||||
bool $disableNotification = null,
|
?bool $disableNotification = null,
|
||||||
bool $splitLongMessages = false,
|
bool $splitLongMessages = false,
|
||||||
bool $delayBetweenMessages = false
|
bool $delayBetweenMessages = false
|
||||||
)
|
)
|
||||||
@@ -130,7 +130,7 @@ class TelegramBotHandler extends AbstractProcessingHandler
|
|||||||
$this->delayBetweenMessages($delayBetweenMessages);
|
$this->delayBetweenMessages($delayBetweenMessages);
|
||||||
}
|
}
|
||||||
|
|
||||||
public function setParseMode(string $parseMode = null): self
|
public function setParseMode(?string $parseMode = null): self
|
||||||
{
|
{
|
||||||
if ($parseMode !== null && !in_array($parseMode, self::AVAILABLE_PARSE_MODES)) {
|
if ($parseMode !== null && !in_array($parseMode, self::AVAILABLE_PARSE_MODES)) {
|
||||||
throw new \InvalidArgumentException('Unknown parseMode, use one of these: ' . implode(', ', self::AVAILABLE_PARSE_MODES) . '.');
|
throw new \InvalidArgumentException('Unknown parseMode, use one of these: ' . implode(', ', self::AVAILABLE_PARSE_MODES) . '.');
|
||||||
@@ -141,14 +141,14 @@ class TelegramBotHandler extends AbstractProcessingHandler
|
|||||||
return $this;
|
return $this;
|
||||||
}
|
}
|
||||||
|
|
||||||
public function disableWebPagePreview(bool $disableWebPagePreview = null): self
|
public function disableWebPagePreview(?bool $disableWebPagePreview = null): self
|
||||||
{
|
{
|
||||||
$this->disableWebPagePreview = $disableWebPagePreview;
|
$this->disableWebPagePreview = $disableWebPagePreview;
|
||||||
|
|
||||||
return $this;
|
return $this;
|
||||||
}
|
}
|
||||||
|
|
||||||
public function disableNotification(bool $disableNotification = null): self
|
public function disableNotification(?bool $disableNotification = null): self
|
||||||
{
|
{
|
||||||
$this->disableNotification = $disableNotification;
|
$this->disableNotification = $disableNotification;
|
||||||
|
|
||||||
|
@@ -337,7 +337,7 @@ class Logger implements LoggerInterface, ResettableInterface
|
|||||||
*
|
*
|
||||||
* @phpstan-param Level $level
|
* @phpstan-param Level $level
|
||||||
*/
|
*/
|
||||||
public function addRecord(int $level, string $message, array $context = [], DateTimeImmutable $datetime = null): bool
|
public function addRecord(int $level, string $message, array $context = [], ?DateTimeImmutable $datetime = null): bool
|
||||||
{
|
{
|
||||||
if (isset(self::RFC_5424_LEVELS[$level])) {
|
if (isset(self::RFC_5424_LEVELS[$level])) {
|
||||||
$level = self::RFC_5424_LEVELS[$level];
|
$level = self::RFC_5424_LEVELS[$level];
|
||||||
|
@@ -43,7 +43,7 @@ class WebProcessor implements ProcessorInterface
|
|||||||
* @param array<string, mixed>|\ArrayAccess<string, mixed>|null $serverData Array or object w/ ArrayAccess that provides access to the $_SERVER data
|
* @param array<string, mixed>|\ArrayAccess<string, mixed>|null $serverData Array or object w/ ArrayAccess that provides access to the $_SERVER data
|
||||||
* @param array<string, string>|array<string>|null $extraFields Field names and the related key inside $serverData to be added (or just a list of field names to use the default configured $serverData mapping). If not provided it defaults to: [url, ip, http_method, server, referrer] + unique_id if present in server data
|
* @param array<string, string>|array<string>|null $extraFields Field names and the related key inside $serverData to be added (or just a list of field names to use the default configured $serverData mapping). If not provided it defaults to: [url, ip, http_method, server, referrer] + unique_id if present in server data
|
||||||
*/
|
*/
|
||||||
public function __construct($serverData = null, array $extraFields = null)
|
public function __construct($serverData = null, ?array $extraFields = null)
|
||||||
{
|
{
|
||||||
if (null === $serverData) {
|
if (null === $serverData) {
|
||||||
$this->serverData = &$_SERVER;
|
$this->serverData = &$_SERVER;
|
||||||
|
Reference in New Issue
Block a user