Skip to content

Commit

Permalink
Merge branch '2.x'
Browse files Browse the repository at this point in the history
  • Loading branch information
Seldaek committed Apr 12, 2024
2 parents 814ea50 + e7455b7 commit cdec3b5
Show file tree
Hide file tree
Showing 11 changed files with 24 additions and 21 deletions.
4 changes: 2 additions & 2 deletions .github/workflows/continuous-integration.yml
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ jobs:
- php-version: "8.1"
dependencies: lowest
operating-system: ubuntu-latest
- php-version: "8.2"
- php-version: "8.4"
dependencies: highest
operating-system: ubuntu-latest
composer-options: "--ignore-platform-req=php+"
Expand All @@ -50,7 +50,7 @@ jobs:
couchdb version: '2.3.1'

- name: Run MongoDB
uses: supercharge/mongodb-github-action@1.7.0
uses: supercharge/mongodb-github-action@1.10.0
with:
mongodb-version: 5.0

Expand Down
1 change: 1 addition & 0 deletions .github/workflows/lint.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ jobs:
matrix:
php-version:
- "8.1"
- "8.3"

steps:
- name: "Checkout"
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/phpstan.yml
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ jobs:
run: echo "dir=$(composer config cache-files-dir)" >> "$GITHUB_OUTPUT"

- name: Cache dependencies
uses: actions/cache@v3
uses: actions/cache@v4
with:
path: ${{ steps.composercache.outputs.dir }}
key: ${{ runner.os }}-composer-${{ hashFiles('**/composer.json') }}
Expand Down
2 changes: 2 additions & 0 deletions src/Monolog/DateTimeImmutable.php
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,8 @@ public function __construct(bool $useMicroseconds, ?DateTimeZone $timezone = nul
{
$this->useMicroseconds = $useMicroseconds;

// if you like to use a custom time to pass to Logger::addRecord directly,
// call modify() or setTimestamp() on this instance to change the date after creating it
parent::__construct('now', $timezone);
}

Expand Down
2 changes: 1 addition & 1 deletion src/Monolog/Handler/FilterHandler.php
Original file line number Diff line number Diff line change
Expand Up @@ -150,7 +150,7 @@ public function handleBatch(array $records): void
*
* If the handler was provided as a factory, this will trigger the handler's instantiation.
*/
public function getHandler(LogRecord $record = null): HandlerInterface
public function getHandler(LogRecord|null $record = null): HandlerInterface
{
if (!$this->handler instanceof HandlerInterface) {
$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 @@ -199,7 +199,7 @@ private function flushBuffer(): void
*
* If the handler was provided as a factory, this will trigger the handler's instantiation.
*/
public function getHandler(LogRecord $record = null): HandlerInterface
public function getHandler(LogRecord|null $record = null): HandlerInterface
{
if (!$this->handler instanceof HandlerInterface) {
$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 @@ -78,7 +78,7 @@ public function handle(LogRecord $record): bool
*
* If the handler was provided as a factory, this will trigger the handler's instantiation.
*/
public function getHandler(LogRecord $record = null): HandlerInterface
public function getHandler(LogRecord|null $record = null): HandlerInterface
{
if (!$this->handler instanceof HandlerInterface) {
$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 @@ -86,7 +86,7 @@ public function __construct(
bool $useShortAttachment = false,
bool $includeContextAndExtra = false,
array $excludeFields = [],
FormatterInterface $formatter = null
FormatterInterface|null $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 @@ -111,9 +111,9 @@ public function __construct(
string $channel,
$level = Level::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,
int $topic = null
Expand All @@ -137,7 +137,7 @@ public function __construct(
/**
* @return $this
*/
public function setParseMode(string $parseMode = null): self
public function setParseMode(string|null $parseMode = null): self
{
if ($parseMode !== null && !in_array($parseMode, self::AVAILABLE_PARSE_MODES, true)) {
throw new \InvalidArgumentException('Unknown parseMode, use one of these: ' . implode(', ', self::AVAILABLE_PARSE_MODES) . '.');
Expand All @@ -151,7 +151,7 @@ public function setParseMode(string $parseMode = null): self
/**
* @return $this
*/
public function disableWebPagePreview(bool $disableWebPagePreview = null): self
public function disableWebPagePreview(bool|null $disableWebPagePreview = null): self
{
$this->disableWebPagePreview = $disableWebPagePreview;

Expand All @@ -161,7 +161,7 @@ public function disableWebPagePreview(bool $disableWebPagePreview = null): self
/**
* @return $this
*/
public function disableNotification(bool $disableNotification = null): self
public function disableNotification(bool|null $disableNotification = null): self
{
$this->disableNotification = $disableNotification;

Expand Down
12 changes: 6 additions & 6 deletions src/Monolog/Logger.php
Original file line number Diff line number Diff line change
Expand Up @@ -320,15 +320,15 @@ public function useLoggingLoopDetection(bool $detectCycles): self
/**
* Adds a log record.
*
* @param int $level The logging level (a Monolog or RFC 5424 level)
* @param string $message The log message
* @param mixed[] $context The log context
* @param DateTimeImmutable $datetime Optional log date to log into the past or future
* @return bool Whether the record has been processed
* @param int $level The logging level (a Monolog or RFC 5424 level)
* @param string $message The log message
* @param mixed[] $context The log context
* @param DateTimeImmutable|null $datetime Optional log date to log into the past or future
* @return bool Whether the record has been processed
*
* @phpstan-param value-of<Level::VALUES>|Level $level
*/
public function addRecord(int|Level $level, string $message, array $context = [], DateTimeImmutable $datetime = null): bool
public function addRecord(int|Level $level, string $message, array $context = [], DateTimeImmutable|null $datetime = null): bool
{
if (is_int($level) && isset(self::RFC_5424_LEVELS[$level])) {
$level = self::RFC_5424_LEVELS[$level];
Expand Down
4 changes: 2 additions & 2 deletions tests/Monolog/SignalHandlerTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ protected function setUp(): void
$this->asyncSignalHandling = pcntl_async_signals();
}
if (function_exists('pcntl_sigprocmask')) {
pcntl_sigprocmask(SIG_BLOCK, [], $this->blockedSignals);
pcntl_sigprocmask(SIG_SETMASK, [], $this->blockedSignals);
}
}
}
Expand Down Expand Up @@ -146,7 +146,7 @@ public function testRegisterDefaultPreviousSignalHandler($signo, $callPrevious,
posix_kill(posix_getpid(), $signo);
pcntl_signal_dispatch();
// If $callPrevious is true, SIGINT should terminate by this line.
pcntl_sigprocmask(SIG_BLOCK, [], $oldset);
pcntl_sigprocmask(SIG_SETMASK, [], $oldset);
file_put_contents($path, implode(' ', $oldset), FILE_APPEND);
posix_kill(posix_getpid(), $signo);
pcntl_signal_dispatch();
Expand Down

0 comments on commit cdec3b5

Please sign in to comment.