Skip to content

Commit

Permalink
is null (#1711)
Browse files Browse the repository at this point in the history
Replaces is_null($var) expression with null === $var.
  • Loading branch information
MathiasReker authored Jun 21, 2022
1 parent 3cba75e commit 100d0f1
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
6 changes: 3 additions & 3 deletions src/Monolog/Formatter/GelfMessageFormatter.php
Original file line number Diff line number Diff line change
Expand Up @@ -71,11 +71,11 @@ public function __construct(?string $systemName = null, ?string $extraPrefix = n

parent::__construct('U.u');

$this->systemName = (is_null($systemName) || $systemName === '') ? (string) gethostname() : $systemName;
$this->systemName = (null === $systemName || $systemName === '') ? (string) gethostname() : $systemName;

$this->extraPrefix = is_null($extraPrefix) ? '' : $extraPrefix;
$this->extraPrefix = null === $extraPrefix ? '' : $extraPrefix;
$this->contextPrefix = $contextPrefix;
$this->maxLength = is_null($maxLength) ? self::DEFAULT_MAX_LENGTH : $maxLength;
$this->maxLength = null === $maxLength ? self::DEFAULT_MAX_LENGTH : $maxLength;
}

/**
Expand Down
2 changes: 1 addition & 1 deletion src/Monolog/Processor/PsrLogMessageProcessor.php
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ public function __invoke(LogRecord $record): LogRecord
continue;
}

if (is_null($val) || is_scalar($val) || (is_object($val) && method_exists($val, "__toString"))) {
if (null === $val || is_scalar($val) || (is_object($val) && method_exists($val, "__toString"))) {
$replacements[$placeholder] = $val;
} elseif ($val instanceof \DateTimeInterface) {
if (null === $this->dateFormat && $val instanceof \Monolog\DateTimeImmutable) {
Expand Down

0 comments on commit 100d0f1

Please sign in to comment.