Jordi Boggiano há 1 ano atrás
pai
commit
07cd08e0e4
34 ficheiros alterados com 106 adições e 91 exclusões
  1. 2 2
      src/Monolog/ErrorHandler.php
  2. 1 1
      src/Monolog/Formatter/HtmlFormatter.php
  3. 3 2
      src/Monolog/Formatter/LineFormatter.php
  4. 1 1
      src/Monolog/Formatter/NormalizerFormatter.php
  5. 0 1
      src/Monolog/Formatter/SyslogFormatter.php
  6. 4 4
      src/Monolog/Handler/AbstractHandler.php
  7. 3 1
      src/Monolog/Handler/AmqpHandler.php
  8. 0 1
      src/Monolog/Handler/BrowserConsoleHandler.php
  9. 4 4
      src/Monolog/Handler/DeduplicationHandler.php
  10. 5 5
      src/Monolog/Handler/FilterHandler.php
  11. 4 4
      src/Monolog/Handler/FingersCrossedHandler.php
  12. 1 1
      src/Monolog/Handler/HandlerInterface.php
  13. 2 3
      src/Monolog/Handler/LogglyHandler.php
  14. 3 3
      src/Monolog/Handler/NativeMailerHandler.php
  15. 4 4
      src/Monolog/Handler/PushoverHandler.php
  16. 2 2
      src/Monolog/Handler/RotatingFileHandler.php
  17. 3 3
      src/Monolog/Handler/Slack/SlackRecord.php
  18. 1 1
      src/Monolog/Handler/SlackHandler.php
  19. 1 1
      src/Monolog/Handler/SocketHandler.php
  20. 1 0
      src/Monolog/Handler/StreamHandler.php
  21. 3 3
      src/Monolog/Handler/SymfonyMailerHandler.php
  22. 0 1
      src/Monolog/Handler/SyslogHandler.php
  23. 2 2
      src/Monolog/Level.php
  24. 5 4
      src/Monolog/Logger.php
  25. 1 1
      src/Monolog/Processor/IntrospectionProcessor.php
  26. 2 2
      src/Monolog/Processor/TagProcessor.php
  27. 10 2
      tests/Monolog/Attribute/WithMonologChannelTest.php
  28. 1 1
      tests/Monolog/Formatter/JsonFormatterTest.php
  29. 1 1
      tests/Monolog/Formatter/NormalizerFormatterTest.php
  30. 12 3
      tests/Monolog/Handler/RedisHandlerTest.php
  31. 2 1
      tests/Monolog/Handler/RotatingFileHandlerTest.php
  32. 1 0
      tests/Monolog/Handler/SymfonyMailerHandlerTest.php
  33. 20 25
      tests/Monolog/LoggerTest.php
  34. 1 1
      tests/Monolog/PsrLogCompatTest.php

+ 2 - 2
src/Monolog/ErrorHandler.php

@@ -124,8 +124,8 @@ class ErrorHandler
     }
 
     /**
-     * @param LogLevel::*|null $level              a LogLevel::* constant, null to use the default LogLevel::ALERT
-     * @param int              $reservedMemorySize Amount of KBs to reserve in memory so that it can be freed when handling fatal errors giving Monolog some room in memory to get its job done
+     * @param  LogLevel::*|null $level              a LogLevel::* constant, null to use the default LogLevel::ALERT
+     * @param  int              $reservedMemorySize Amount of KBs to reserve in memory so that it can be freed when handling fatal errors giving Monolog some room in memory to get its job done
      * @return $this
      */
     public function registerFatalHandler($level = null, int $reservedMemorySize = 20): self

+ 1 - 1
src/Monolog/Formatter/HtmlFormatter.php

@@ -42,7 +42,7 @@ class HtmlFormatter extends NormalizerFormatter
     }
 
     /**
-     * @param string|null $dateFormat The format of the timestamp: one supported by DateTime::format
+     * @param  string|null       $dateFormat The format of the timestamp: one supported by DateTime::format
      * @throws \RuntimeException If the function json_encode does not exist
      */
     public function __construct(?string $dateFormat = null)

+ 3 - 2
src/Monolog/Formatter/LineFormatter.php

@@ -84,7 +84,7 @@ class LineFormatter extends NormalizerFormatter
     /**
      * Indent stack traces to separate them a bit from the main log record messages
      *
-     * @param string $indent The string used to indent, for example "    "
+     * @param  string $indent The string used to indent, for example "    "
      * @return $this
      */
     public function indentStacktraces(string $indent): self
@@ -117,7 +117,7 @@ class LineFormatter extends NormalizerFormatter
     /**
      * Allows cutting the level name to get fixed-length levels like INF for INFO, ERR for ERROR if you set this to 3 for example
      *
-     * @param int|null $maxLevelNameLength Maximum characters for the level name. Set null for infinite length (default)
+     * @param  int|null $maxLevelNameLength Maximum characters for the level name. Set null for infinite length (default)
      * @return $this
      */
     public function setMaxLevelNameLength(?int $maxLevelNameLength = null): self
@@ -244,6 +244,7 @@ class LineFormatter extends NormalizerFormatter
                 $str = preg_replace('/(?<!\\\\)\\\\[rn]/', "\n", $str);
                 if (null === $str) {
                     $pcreErrorCode = preg_last_error();
+
                     throw new \RuntimeException('Failed to run preg_replace: ' . $pcreErrorCode . ' / ' . Utils::pcreLastErrorMessage($pcreErrorCode));
                 }
             }

+ 1 - 1
src/Monolog/Formatter/NormalizerFormatter.php

@@ -34,7 +34,7 @@ class NormalizerFormatter implements FormatterInterface
     protected string $basePath = '';
 
     /**
-     * @param string|null $dateFormat The format of the timestamp: one supported by DateTime::format
+     * @param  string|null       $dateFormat The format of the timestamp: one supported by DateTime::format
      * @throws \RuntimeException If the function json_encode does not exist
      */
     public function __construct(?string $dateFormat = null)

+ 0 - 1
src/Monolog/Formatter/SyslogFormatter.php

@@ -44,7 +44,6 @@ class SyslogFormatter extends LineFormatter
     }
 
     /**
-     * @param LogRecord $record
      * @return array<string, mixed>
      */
     private function formatExtra(LogRecord $record): array

+ 4 - 4
src/Monolog/Handler/AbstractHandler.php

@@ -29,7 +29,7 @@ abstract class AbstractHandler extends Handler implements ResettableInterface
 
     /**
      * @param int|string|Level|LogLevel::* $level  The minimum logging level at which this handler will be triggered
-     * @param bool                                   $bubble Whether the messages that are handled can bubble up the stack or not
+     * @param bool                         $bubble Whether the messages that are handled can bubble up the stack or not
      *
      * @phpstan-param value-of<Level::VALUES>|value-of<Level::NAMES>|Level|LogLevel::* $level
      */
@@ -50,7 +50,7 @@ abstract class AbstractHandler extends Handler implements ResettableInterface
     /**
      * Sets minimum logging level at which this handler will be triggered.
      *
-     * @param Level|LogLevel::* $level Level or level name
+     * @param  Level|LogLevel::* $level Level or level name
      * @return $this
      *
      * @phpstan-param value-of<Level::VALUES>|value-of<Level::NAMES>|Level|LogLevel::* $level
@@ -73,8 +73,8 @@ abstract class AbstractHandler extends Handler implements ResettableInterface
     /**
      * Sets the bubbling behavior.
      *
-     * @param bool $bubble true means that this handler allows bubbling.
-     *                     false means that bubbling is not permitted.
+     * @param  bool  $bubble true means that this handler allows bubbling.
+     *                       false means that bubbling is not permitted.
      * @return $this
      */
     public function setBubble(bool $bubble): self

+ 3 - 1
src/Monolog/Handler/AmqpHandler.php

@@ -56,7 +56,7 @@ class AmqpHandler extends AbstractProcessingHandler
     /**
      * Configure extra attributes to pass to the AMQPExchange (if you are using the amqp extension)
      *
-     * @param array<string, mixed> $extraAttributes  One of content_type, content_encoding,
+     * @param  array<string, mixed> $extraAttributes One of content_type, content_encoding,
      *                                               message_id, user_id, app_id, delivery_mode,
      *                                               priority, timestamp, expiration, type
      *                                               or reply_to, headers.
@@ -65,6 +65,7 @@ class AmqpHandler extends AbstractProcessingHandler
     public function setExtraAttributes(array $extraAttributes): self
     {
         $this->extraAttributes = $extraAttributes;
+
         return $this;
     }
 
@@ -155,6 +156,7 @@ class AmqpHandler extends AbstractProcessingHandler
         if (\count($this->extraAttributes) > 0) {
             $attributes = array_merge($attributes, $this->extraAttributes);
         }
+
         return new AMQPMessage($data, $attributes);
     }
 

+ 0 - 1
src/Monolog/Handler/BrowserConsoleHandler.php

@@ -17,7 +17,6 @@ use Monolog\Utils;
 use Monolog\LogRecord;
 use Monolog\Level;
 
-use function count;
 use function headers_list;
 use function stripos;
 

+ 4 - 4
src/Monolog/Handler/DeduplicationHandler.php

@@ -46,11 +46,11 @@ class DeduplicationHandler extends BufferHandler
     protected bool $gc = false;
 
     /**
-     * @param HandlerInterface                       $handler            Handler.
-     * @param string|null                            $deduplicationStore The file/path where the deduplication log should be kept
+     * @param HandlerInterface             $handler            Handler.
+     * @param string|null                  $deduplicationStore The file/path where the deduplication log should be kept
      * @param int|string|Level|LogLevel::* $deduplicationLevel The minimum logging level for log records to be looked at for deduplication purposes
-     * @param int                                    $time               The period (in seconds) during which duplicate entries should be suppressed after a given log is sent through
-     * @param bool                                   $bubble             Whether the messages that are handled can bubble up the stack or not
+     * @param int                          $time               The period (in seconds) during which duplicate entries should be suppressed after a given log is sent through
+     * @param bool                         $bubble             Whether the messages that are handled can bubble up the stack or not
      *
      * @phpstan-param value-of<Level::VALUES>|value-of<Level::NAMES>|Level|LogLevel::* $deduplicationLevel
      */

+ 5 - 5
src/Monolog/Handler/FilterHandler.php

@@ -54,10 +54,10 @@ class FilterHandler extends Handler implements ProcessableHandlerInterface, Rese
     /**
      * @phpstan-param (Closure(LogRecord|null, HandlerInterface): HandlerInterface)|HandlerInterface $handler
      *
-     * @param Closure|HandlerInterface                                                 $handler        Handler or factory Closure($record|null, $filterHandler).
+     * @param Closure|HandlerInterface                             $handler        Handler or factory Closure($record|null, $filterHandler).
      * @param int|string|Level|array<int|string|Level|LogLevel::*> $minLevelOrList A list of levels to accept or a minimum level if maxLevel is provided
-     * @param int|string|Level|LogLevel::*                                   $maxLevel       Maximum level to accept, only used if $minLevelOrList is not an array
-     * @param bool                                                                     $bubble         Whether the messages that are handled can bubble up the stack or not
+     * @param int|string|Level|LogLevel::*                         $maxLevel       Maximum level to accept, only used if $minLevelOrList is not an array
+     * @param bool                                                 $bubble         Whether the messages that are handled can bubble up the stack or not
      *
      * @phpstan-param value-of<Level::VALUES>|value-of<Level::NAMES>|Level|LogLevel::*|array<value-of<Level::VALUES>|value-of<Level::NAMES>|Level|LogLevel::*> $minLevelOrList
      * @phpstan-param value-of<Level::VALUES>|value-of<Level::NAMES>|Level|LogLevel::* $maxLevel
@@ -78,8 +78,8 @@ class FilterHandler extends Handler implements ProcessableHandlerInterface, Rese
     }
 
     /**
-     * @param int|string|Level|LogLevel::*|array<int|string|Level|LogLevel::*> $minLevelOrList A list of levels to accept or a minimum level or level name if maxLevel is provided
-     * @param int|string|Level|LogLevel::*                                               $maxLevel       Maximum level or level name to accept, only used if $minLevelOrList is not an array
+     * @param  int|string|Level|LogLevel::*|array<int|string|Level|LogLevel::*> $minLevelOrList A list of levels to accept or a minimum level or level name if maxLevel is provided
+     * @param  int|string|Level|LogLevel::*                                     $maxLevel       Maximum level or level name to accept, only used if $minLevelOrList is not an array
      * @return $this
      *
      * @phpstan-param value-of<Level::VALUES>|value-of<Level::NAMES>|Level|LogLevel::*|array<value-of<Level::VALUES>|value-of<Level::NAMES>|Level|LogLevel::*> $minLevelOrList

+ 4 - 4
src/Monolog/Handler/FingersCrossedHandler.php

@@ -66,11 +66,11 @@ class FingersCrossedHandler extends Handler implements ProcessableHandlerInterfa
     /**
      * @phpstan-param (Closure(LogRecord|null, HandlerInterface): HandlerInterface)|HandlerInterface $handler
      *
-     * @param Closure|HandlerInterface                    $handler            Handler or factory Closure($record|null, $fingersCrossedHandler).
+     * @param Closure|HandlerInterface          $handler            Handler or factory Closure($record|null, $fingersCrossedHandler).
      * @param int|string|Level|LogLevel::*      $activationStrategy Strategy which determines when this handler takes action, or a level name/value at which the handler is activated
-     * @param int                                         $bufferSize         How many entries should be buffered at most, beyond that the oldest items are removed from the buffer.
-     * @param bool                                        $bubble             Whether the messages that are handled can bubble up the stack or not
-     * @param bool                                        $stopBuffering      Whether the handler should stop buffering after being triggered (default true)
+     * @param int                               $bufferSize         How many entries should be buffered at most, beyond that the oldest items are removed from the buffer.
+     * @param bool                              $bubble             Whether the messages that are handled can bubble up the stack or not
+     * @param bool                              $stopBuffering      Whether the handler should stop buffering after being triggered (default true)
      * @param int|string|Level|LogLevel::*|null $passthruLevel      Minimum level to always flush to handler on close, even if strategy not triggered
      *
      * @phpstan-param value-of<Level::VALUES>|value-of<Level::NAMES>|Level|LogLevel::*|ActivationStrategyInterface $activationStrategy

+ 1 - 1
src/Monolog/Handler/HandlerInterface.php

@@ -45,7 +45,7 @@ interface HandlerInterface
      *
      * @param  LogRecord $record The record to handle
      * @return bool      true means that this handler handled the record, and that bubbling is not permitted.
-     *                          false means the record was either not processed or that this handler allows bubbling.
+     *                   false means the record was either not processed or that this handler allows bubbling.
      */
     public function handle(LogRecord $record): bool;
 

+ 2 - 3
src/Monolog/Handler/LogglyHandler.php

@@ -14,7 +14,6 @@ namespace Monolog\Handler;
 use Monolog\Level;
 use Monolog\Formatter\FormatterInterface;
 use Monolog\Formatter\LogglyFormatter;
-use function array_key_exists;
 use CurlHandle;
 use Monolog\LogRecord;
 
@@ -88,7 +87,7 @@ class LogglyHandler extends AbstractProcessingHandler
     }
 
     /**
-     * @param string[]|string $tag
+     * @param  string[]|string $tag
      * @return $this
      */
     public function setTag(string|array $tag): self
@@ -103,7 +102,7 @@ class LogglyHandler extends AbstractProcessingHandler
     }
 
     /**
-     * @param string[]|string $tag
+     * @param  string[]|string $tag
      * @return $this
      */
     public function addTag(string|array $tag): self

+ 3 - 3
src/Monolog/Handler/NativeMailerHandler.php

@@ -78,7 +78,7 @@ class NativeMailerHandler extends MailHandler
     /**
      * Add headers to the message
      *
-     * @param string|string[] $headers Custom added headers
+     * @param  string|string[] $headers Custom added headers
      * @return $this
      */
     public function addHeader($headers): self
@@ -96,7 +96,7 @@ class NativeMailerHandler extends MailHandler
     /**
      * Add parameters to the message
      *
-     * @param string|string[] $parameters Custom added parameters
+     * @param  string|string[] $parameters Custom added parameters
      * @return $this
      */
     public function addParameter($parameters): self
@@ -143,7 +143,7 @@ class NativeMailerHandler extends MailHandler
     }
 
     /**
-     * @param string $contentType The content type of the email - Defaults to text/plain. Use text/html for HTML messages.
+     * @param  string $contentType The content type of the email - Defaults to text/plain. Use text/html for HTML messages.
      * @return $this
      */
     public function setContentType(string $contentType): self

+ 4 - 4
src/Monolog/Handler/PushoverHandler.php

@@ -88,9 +88,9 @@ class PushoverHandler extends SocketHandler
      *                             to be retried for (every retry seconds).
      *
      * @param int|string|Level|LogLevel::* $highPriorityLevel The minimum logging level at which this handler will start
-     *                                                                  sending "high priority" requests to the Pushover API
+     *                                                        sending "high priority" requests to the Pushover API
      * @param int|string|Level|LogLevel::* $emergencyLevel    The minimum logging level at which this handler will start
-     *                                                                  sending "emergency" requests to the Pushover API
+     *                                                        sending "emergency" requests to the Pushover API
      *
      *
      * @phpstan-param string|array<int|string>    $users
@@ -207,7 +207,7 @@ class PushoverHandler extends SocketHandler
     }
 
     /**
-     * @param int|string|Level|LogLevel::* $level
+     * @param  int|string|Level|LogLevel::* $level
      * @return $this
      *
      * @phpstan-param value-of<Level::VALUES>|value-of<Level::NAMES>|Level|LogLevel::* $level
@@ -220,7 +220,7 @@ class PushoverHandler extends SocketHandler
     }
 
     /**
-     * @param int|string|Level|LogLevel::* $level
+     * @param  int|string|Level|LogLevel::* $level
      * @return $this
      *
      * @phpstan-param value-of<Level::VALUES>|value-of<Level::NAMES>|Level|LogLevel::* $level

+ 2 - 2
src/Monolog/Handler/RotatingFileHandler.php

@@ -182,8 +182,8 @@ class RotatingFileHandler extends StreamHandler
             [$fileInfo['filename'], str_replace(
                 ['Y', 'y', 'm', 'd'],
                 ['[0-9][0-9][0-9][0-9]', '[0-9][0-9]', '[0-9][0-9]', '[0-9][0-9]'],
-                $this->dateFormat)
-            ],
+                $this->dateFormat
+            )],
             ($fileInfo['dirname'] ?? '') . '/' . $this->filenameFormat
         );
         if (isset($fileInfo['extension'])) {

+ 3 - 3
src/Monolog/Handler/Slack/SlackRecord.php

@@ -220,7 +220,7 @@ class SlackRecord
     /**
      * Channel used by the bot when posting
      *
-     * @param ?string $channel
+     * @param  ?string $channel
      * @return $this
      */
     public function setChannel(?string $channel = null): self
@@ -233,7 +233,7 @@ class SlackRecord
     /**
      * Username used by the bot when posting
      *
-     * @param ?string $username
+     * @param  ?string $username
      * @return $this
      */
     public function setUsername(?string $username = null): self
@@ -292,7 +292,7 @@ class SlackRecord
     }
 
     /**
-     * @param string[] $excludeFields
+     * @param  string[] $excludeFields
      * @return $this
      */
     public function excludeFields(array $excludeFields = []): self

+ 1 - 1
src/Monolog/Handler/SlackHandler.php

@@ -255,7 +255,7 @@ class SlackHandler extends SocketHandler
     }
 
     /**
-     * @param string[] $excludeFields
+     * @param  string[] $excludeFields
      * @return $this
      */
     public function excludeFields(array $excludeFields): self

+ 1 - 1
src/Monolog/Handler/SocketHandler.php

@@ -151,7 +151,7 @@ class SocketHandler extends AbstractProcessingHandler
     /**
      * Set writing timeout. Only has effect during connection in the writing cycle.
      *
-     * @param float $seconds 0 for no timeout
+     * @param  float $seconds 0 for no timeout
      * @return $this
      */
     public function setWritingTimeout(float $seconds): self

+ 1 - 0
src/Monolog/Handler/StreamHandler.php

@@ -125,6 +125,7 @@ class StreamHandler extends AbstractProcessingHandler
             set_error_handler(function (...$args) {
                 return $this->customErrorHandler(...$args);
             });
+
             try {
                 $stream = fopen($url, 'a');
                 if ($this->filePermission !== null) {

+ 3 - 3
src/Monolog/Handler/SymfonyMailerHandler.php

@@ -13,7 +13,6 @@ namespace Monolog\Handler;
 
 use Closure;
 use Monolog\Level;
-use Monolog\Logger;
 use Monolog\LogRecord;
 use Monolog\Utils;
 use Monolog\Formatter\FormatterInterface;
@@ -68,8 +67,8 @@ class SymfonyMailerHandler extends MailHandler
     /**
      * Creates instance of Email to be sent
      *
-     * @param  string      $content formatted email body to be sent
-     * @param  LogRecord[] $records Log records that formed the content
+     * @param string      $content formatted email body to be sent
+     * @param LogRecord[] $records Log records that formed the content
      */
     protected function buildMessage(string $content, array $records): Email
     {
@@ -82,6 +81,7 @@ class SymfonyMailerHandler extends MailHandler
 
         if (!$message instanceof Email) {
             $record = reset($records);
+
             throw new \InvalidArgumentException('Could not resolve message as instance of Email or a callable returning it' . ($record instanceof LogRecord ? Utils::getRecordMessageForException($record) : ''));
         }
 

+ 0 - 1
src/Monolog/Handler/SyslogHandler.php

@@ -12,7 +12,6 @@
 namespace Monolog\Handler;
 
 use Monolog\Level;
-use Monolog\Utils;
 use Monolog\LogRecord;
 
 /**

+ 2 - 2
src/Monolog/Level.php

@@ -82,7 +82,7 @@ enum Level: int
     case Emergency = 600;
 
     /**
-     * @param value-of<self::NAMES>|LogLevel::*|'Debug'|'Info'|'Notice'|'Warning'|'Error'|'Critical'|'Alert'|'Emergency' $name
+     * @param  value-of<self::NAMES>|LogLevel::*|'Debug'|'Info'|'Notice'|'Warning'|'Error'|'Critical'|'Alert'|'Emergency' $name
      * @return static
      */
     public static function fromName(string $name): self
@@ -100,7 +100,7 @@ enum Level: int
     }
 
     /**
-     * @param value-of<self::VALUES> $value
+     * @param  value-of<self::VALUES> $value
      * @return static
      */
     public static function fromValue(int $value): self

+ 5 - 4
src/Monolog/Logger.php

@@ -230,7 +230,7 @@ class Logger implements LoggerInterface, ResettableInterface
      *
      * If a map is passed, keys will be ignored.
      *
-     * @param list<HandlerInterface> $handlers
+     * @param  list<HandlerInterface> $handlers
      * @return $this
      */
     public function setHandlers(array $handlers): self
@@ -297,7 +297,7 @@ class Logger implements LoggerInterface, ResettableInterface
      * by default. This function lets you disable them though in case you want
      * to suppress microseconds from the output.
      *
-     * @param bool $micro True to use microtime() to create timestamps
+     * @param  bool  $micro True to use microtime() to create timestamps
      * @return $this
      */
     public function useMicrosecondTimestamps(bool $micro): self
@@ -346,6 +346,7 @@ class Logger implements LoggerInterface, ResettableInterface
 
         if ($logDepth === 3) {
             $this->warning('A possible infinite logging loop was detected and aborted. It appears some of your handler code is triggering logging, see the previous log record for a hint as to what may be the cause.');
+
             return false;
         } elseif ($logDepth >= 5) { // log depth 4 is let through, so we can log the warning above
             return false;
@@ -470,8 +471,8 @@ class Logger implements LoggerInterface, ResettableInterface
     /**
      * Converts PSR-3 levels to Monolog ones if necessary
      *
-     * @param  int|string|Level|LogLevel::* $level Level number (monolog) or name (PSR-3)
-     * @throws \Psr\Log\InvalidArgumentException      If level is not defined
+     * @param  int|string|Level|LogLevel::*      $level Level number (monolog) or name (PSR-3)
+     * @throws \Psr\Log\InvalidArgumentException If level is not defined
      *
      * @phpstan-param value-of<Level::VALUES>|value-of<Level::NAMES>|Level|LogLevel::* $level
      */

+ 1 - 1
src/Monolog/Processor/IntrospectionProcessor.php

@@ -43,7 +43,7 @@ class IntrospectionProcessor implements ProcessorInterface
 
     /**
      * @param string|int|Level $level               The minimum logging level at which this Processor will be triggered
-     * @param string[]                   $skipClassesPartials
+     * @param string[]         $skipClassesPartials
      *
      * @phpstan-param value-of<Level::VALUES>|value-of<Level::NAMES>|Level|LogLevel::* $level
      */

+ 2 - 2
src/Monolog/Processor/TagProcessor.php

@@ -32,7 +32,7 @@ class TagProcessor implements ProcessorInterface
     }
 
     /**
-     * @param string[] $tags
+     * @param  string[] $tags
      * @return $this
      */
     public function addTags(array $tags = []): self
@@ -43,7 +43,7 @@ class TagProcessor implements ProcessorInterface
     }
 
     /**
-     * @param string[] $tags
+     * @param  string[] $tags
      * @return $this
      */
     public function setTags(array $tags = []): self

+ 10 - 2
tests/Monolog/Attribute/WithMonologChannelTest.php

@@ -1,4 +1,13 @@
-<?php
+<?php declare(strict_types=1);
+
+/*
+ * This file is part of the Monolog package.
+ *
+ * (c) Jordi Boggiano <j.boggiano@seld.be>
+ *
+ * For the full copyright and license information, please view the LICENSE
+ * file that was distributed with this source code.
+ */
 
 namespace Monolog\Attribute;
 
@@ -11,5 +20,4 @@ class WithMonologChannelTest extends TestCase
         $attribute = new WithMonologChannel('fixture');
         $this->assertSame('fixture', $attribute->channel);
     }
-
 }

+ 1 - 1
tests/Monolog/Formatter/JsonFormatterTest.php

@@ -121,7 +121,7 @@ class JsonFormatterTest extends TestCase
     public function testBasePathWithException(): void
     {
         $formatter = new JsonFormatter();
-        $formatter->setBasePath(dirname(dirname(dirname(__DIR__))));
+        $formatter->setBasePath(\dirname(\dirname(\dirname(__DIR__))));
         $exception = new \RuntimeException('Foo');
 
         $message = $this->formatRecordWithExceptionInContext($formatter, $exception);

+ 1 - 1
tests/Monolog/Formatter/NormalizerFormatterTest.php

@@ -84,7 +84,7 @@ class NormalizerFormatterTest extends TestCase
     public function testFormatExceptionWithBasePath(): void
     {
         $formatter = new NormalizerFormatter('Y-m-d');
-        $formatter->setBasePath(dirname(dirname(dirname(__DIR__))));
+        $formatter->setBasePath(\dirname(\dirname(\dirname(__DIR__))));
         $e = new \LogicException('bar');
         $formatted = $formatter->normalizeValue([
             'exception' => $e,

+ 12 - 3
tests/Monolog/Handler/RedisHandlerTest.php

@@ -103,16 +103,25 @@ class RedisHandlerTest extends TestCase
     {
         $redis = new class extends \Predis\Client {
             public array $testResults = [];
-            public function rpush(...$args) {
+
+            public function rpush(...$args)
+            {
                 $this->testResults[] = ['rpush', ...$args];
+
                 return $this;
             }
-            public function ltrim(...$args) {
+
+            public function ltrim(...$args)
+            {
                 $this->testResults[] = ['ltrim', ...$args];
+
                 return $this;
             }
-            public function transaction(...$args) {
+
+            public function transaction(...$args)
+            {
                 $this->testResults[] = ['transaction start'];
+
                 return ($args[0])($this);
             }
         };

+ 2 - 1
tests/Monolog/Handler/RotatingFileHandlerTest.php

@@ -59,7 +59,8 @@ class RotatingFileHandlerTest extends TestCase
         unset($this->lastError);
     }
 
-    private function rrmdir($directory) {
+    private function rrmdir($directory)
+    {
         if (! is_dir($directory)) {
             throw new InvalidArgumentException("$directory must be a directory");
         }

+ 1 - 0
tests/Monolog/Handler/SymfonyMailerHandlerTest.php

@@ -69,6 +69,7 @@ class SymfonyMailerHandlerTest extends TestCase
         // Callback dynamically changes subject based on number of logged records
         $callback = function ($content, array $records) use ($expectedMessage) {
             $subject = \count($records) > 0 ? 'Emergency' : 'Normal';
+
             return $expectedMessage->subject($subject);
         };
         $handler = new SymfonyMailerHandler($this->mailer, $callback);

+ 20 - 25
tests/Monolog/LoggerTest.php

@@ -285,11 +285,11 @@ class LoggerTest extends TestCase
         $handler->expects($this->any())
             ->method('isHandling')
             ->willReturn(true);
-        ;
+
         $handler->expects($this->any())
             ->method('handle')
             ->willReturn(true);
-        ;
+
         $logger->pushHandler($handler);
 
         $processor = $this->getMockBuilder('Monolog\Processor\WebProcessor')
@@ -316,7 +316,7 @@ class LoggerTest extends TestCase
         $handler->expects($this->once())
             ->method('isHandling')
             ->willReturn(false);
-        ;
+
         $logger->pushHandler($handler);
         $that = $this;
         $logger->pushProcessor(function ($record) use ($that) {
@@ -337,29 +337,29 @@ class LoggerTest extends TestCase
         $handler1->expects($this->never())
             ->method('isHandling')
             ->willReturn(false);
-        ;
+
         $handler1->expects($this->once())
             ->method('handle')
             ->willReturn(false);
-        ;
+
         $logger->pushHandler($handler1);
 
         $handler2 = $this->createMock('Monolog\Handler\HandlerInterface');
         $handler2->expects($this->once())
             ->method('isHandling')
             ->willReturn(true);
-        ;
+
         $handler2->expects($this->once())
             ->method('handle')
             ->willReturn(false);
-        ;
+
         $logger->pushHandler($handler2);
 
         $handler3 = $this->createMock('Monolog\Handler\HandlerInterface');
         $handler3->expects($this->once())
             ->method('isHandling')
             ->willReturn(false);
-        ;
+
         $handler3->expects($this->never())
             ->method('handle')
         ;
@@ -377,27 +377,25 @@ class LoggerTest extends TestCase
         $handler1->expects($this->never())
             ->method('isHandling')
             ->willReturn(false);
-        ;
+
         $handler1->expects($this->once())
             ->method('handle')
             ->willReturn(false);
-        ;
 
         $handler2 = $this->createMock('Monolog\Handler\HandlerInterface');
         $handler2->expects($this->once())
             ->method('isHandling')
             ->willReturn(true);
-        ;
+
         $handler2->expects($this->once())
             ->method('handle')
             ->willReturn(false);
-        ;
 
         $handler3 = $this->createMock('Monolog\Handler\HandlerInterface');
         $handler3->expects($this->once())
             ->method('isHandling')
             ->willReturn(false);
-        ;
+
         $handler3->expects($this->never())
             ->method('handle')
         ;
@@ -419,22 +417,22 @@ class LoggerTest extends TestCase
         $handler1->expects($this->any())
             ->method('isHandling')
             ->willReturn(true);
-        ;
+
         $handler1->expects($this->once())
             ->method('handle')
             ->willReturn(false);
-        ;
+
         $logger->pushHandler($handler1);
 
         $handler2 = $this->createMock('Monolog\Handler\HandlerInterface');
         $handler2->expects($this->any())
             ->method('isHandling')
             ->willReturn(true);
-        ;
+
         $handler2->expects($this->once())
             ->method('handle')
             ->willReturn(false);
-        ;
+
         $logger->pushHandler($handler2);
 
         $logger->debug('test');
@@ -451,7 +449,7 @@ class LoggerTest extends TestCase
         $handler1->expects($this->any())
             ->method('isHandling')
             ->willReturn(true);
-        ;
+
         $handler1->expects($this->never())
             ->method('handle')
         ;
@@ -461,11 +459,11 @@ class LoggerTest extends TestCase
         $handler2->expects($this->any())
             ->method('isHandling')
             ->willReturn(true);
-        ;
+
         $handler2->expects($this->once())
             ->method('handle')
             ->willReturn(true);
-        ;
+
         $logger->pushHandler($handler2);
 
         $logger->debug('test');
@@ -482,7 +480,6 @@ class LoggerTest extends TestCase
         $handler1->expects($this->any())
             ->method('isHandling')
             ->willReturn(false);
-        ;
 
         $logger->pushHandler($handler1);
         $this->assertFalse($logger->isHandling(Level::Debug));
@@ -491,7 +488,6 @@ class LoggerTest extends TestCase
         $handler2->expects($this->any())
             ->method('isHandling')
             ->willReturn(true);
-        ;
 
         $logger->pushHandler($handler2);
         $this->assertTrue($logger->isHandling(Level::Debug));
@@ -677,7 +673,7 @@ class LoggerTest extends TestCase
         $handler->expects($this->any())
             ->method('isHandling')
             ->willReturn(true);
-        ;
+
         $handler->expects($this->any())
             ->method('handle')
             ->will($this->throwException(new \Exception('Some handler exception')))
@@ -706,7 +702,7 @@ class LoggerTest extends TestCase
         $handler->expects($this->any())
             ->method('isHandling')
             ->willReturn(true);
-        ;
+
         $handler->expects($this->any())
             ->method('handle')
             ->will($this->throwException(new \Exception('Some handler exception')))
@@ -900,7 +896,6 @@ class LoggingHandler implements HandlerInterface
     }
 }
 
-
 class FiberSuspendHandler implements HandlerInterface
 {
     public function isHandling(LogRecord $record): bool

+ 1 - 1
tests/Monolog/PsrLogCompatTest.php

@@ -161,7 +161,7 @@ class PsrLogCompatTest extends TestCase
     /**
      * Creates a mock of a `Stringable`.
      *
-     * @param  string $string The string that must be represented by the stringable.
+     * @param string $string The string that must be represented by the stringable.
      */
     protected function createStringable(string $string = ''): MockObject&Stringable
     {