Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

explicitly mark nullable parameters as nullable #1874

Merged
merged 1 commit into from
Apr 12, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion src/Monolog/Handler/FilterHandler.php
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down
2 changes: 1 addition & 1 deletion src/Monolog/Handler/FingersCrossedHandler.php
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down
2 changes: 1 addition & 1 deletion src/Monolog/Handler/SamplingHandler.php
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down
2 changes: 1 addition & 1 deletion src/Monolog/Handler/Slack/SlackRecord.php
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
12 changes: 6 additions & 6 deletions src/Monolog/Handler/TelegramBotHandler.php
Original file line number Diff line number Diff line change
Expand Up @@ -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
)
Expand All @@ -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) . '.');
Expand All @@ -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;

Expand Down
2 changes: 1 addition & 1 deletion src/Monolog/Logger.php
Original file line number Diff line number Diff line change
Expand Up @@ -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];
Expand Down
2 changes: 1 addition & 1 deletion src/Monolog/Processor/WebProcessor.php
Original file line number Diff line number Diff line change
Expand Up @@ -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, 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) {
$this->serverData = &$_SERVER;
Expand Down
Loading