diff --git a/src/Monolog/Handler/FilterHandler.php b/src/Monolog/Handler/FilterHandler.php index 718f17ef1..5e43e1dc2 100644 --- a/src/Monolog/Handler/FilterHandler.php +++ b/src/Monolog/Handler/FilterHandler.php @@ -161,7 +161,7 @@ public function handleBatch(array $records): void * * @phpstan-param Record $record */ - public function getHandler(array $record = null) + public function getHandler(?array $record = null) { if (!$this->handler instanceof HandlerInterface) { $this->handler = ($this->handler)($record, $this); diff --git a/src/Monolog/Handler/FingersCrossedHandler.php b/src/Monolog/Handler/FingersCrossedHandler.php index 0627b4451..dfcb3af28 100644 --- a/src/Monolog/Handler/FingersCrossedHandler.php +++ b/src/Monolog/Handler/FingersCrossedHandler.php @@ -210,7 +210,7 @@ private function flushBuffer(): void * * @phpstan-param Record $record */ - public function getHandler(array $record = null) + public function getHandler(?array $record = null) { if (!$this->handler instanceof HandlerInterface) { $this->handler = ($this->handler)($record, $this); diff --git a/src/Monolog/Handler/SamplingHandler.php b/src/Monolog/Handler/SamplingHandler.php index c128a32d1..25cce07f9 100644 --- a/src/Monolog/Handler/SamplingHandler.php +++ b/src/Monolog/Handler/SamplingHandler.php @@ -90,7 +90,7 @@ public function handle(array $record): bool * * @return HandlerInterface */ - public function getHandler(array $record = null) + public function getHandler(?array $record = null) { if (!$this->handler instanceof HandlerInterface) { $this->handler = ($this->handler)($record, $this); diff --git a/src/Monolog/Handler/Slack/SlackRecord.php b/src/Monolog/Handler/Slack/SlackRecord.php index 71a410946..9ae100371 100644 --- a/src/Monolog/Handler/Slack/SlackRecord.php +++ b/src/Monolog/Handler/Slack/SlackRecord.php @@ -100,7 +100,7 @@ public function __construct( bool $useShortAttachment = false, bool $includeContextAndExtra = false, array $excludeFields = array(), - FormatterInterface $formatter = null + ?FormatterInterface $formatter = null ) { $this ->setChannel($channel) diff --git a/src/Monolog/Handler/TelegramBotHandler.php b/src/Monolog/Handler/TelegramBotHandler.php index 8912eba51..a6223b795 100644 --- a/src/Monolog/Handler/TelegramBotHandler.php +++ b/src/Monolog/Handler/TelegramBotHandler.php @@ -108,9 +108,9 @@ public function __construct( string $channel, $level = Logger::DEBUG, bool $bubble = true, - string $parseMode = null, - bool $disableWebPagePreview = null, - bool $disableNotification = null, + ?string $parseMode = null, + ?bool $disableWebPagePreview = null, + ?bool $disableNotification = null, bool $splitLongMessages = false, bool $delayBetweenMessages = false ) @@ -130,7 +130,7 @@ public function __construct( $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)) { throw new \InvalidArgumentException('Unknown parseMode, use one of these: ' . implode(', ', self::AVAILABLE_PARSE_MODES) . '.'); @@ -141,14 +141,14 @@ public function setParseMode(string $parseMode = null): self return $this; } - public function disableWebPagePreview(bool $disableWebPagePreview = null): self + public function disableWebPagePreview(?bool $disableWebPagePreview = null): self { $this->disableWebPagePreview = $disableWebPagePreview; return $this; } - public function disableNotification(bool $disableNotification = null): self + public function disableNotification(?bool $disableNotification = null): self { $this->disableNotification = $disableNotification; diff --git a/src/Monolog/Logger.php b/src/Monolog/Logger.php index 84a2f5510..3c588a707 100644 --- a/src/Monolog/Logger.php +++ b/src/Monolog/Logger.php @@ -337,7 +337,7 @@ public function useLoggingLoopDetection(bool $detectCycles): self * * @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])) { $level = self::RFC_5424_LEVELS[$level]; diff --git a/src/Monolog/Processor/WebProcessor.php b/src/Monolog/Processor/WebProcessor.php index 51850e17f..887f4d396 100644 --- a/src/Monolog/Processor/WebProcessor.php +++ b/src/Monolog/Processor/WebProcessor.php @@ -43,7 +43,7 @@ class WebProcessor implements ProcessorInterface * @param array|\ArrayAccess|null $serverData Array or object w/ ArrayAccess that provides access to the $_SERVER data * @param array|array|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) { $this->serverData = &$_SERVER;