mirror of
https://github.com/Seldaek/monolog.git
synced 2025-08-04 04:07:39 +02:00
Static analysis improvements (#1475)
* Static analysis improvements * Fix review issues
This commit is contained in:
@@ -49,6 +49,8 @@ class FilterHandler extends Handler implements ProcessableHandlerInterface, Rese
|
||||
protected $bubble;
|
||||
|
||||
/**
|
||||
* @psalm-param HandlerInterface|callable(?array, HandlerInterface): HandlerInterface $handler
|
||||
*
|
||||
* @param callable|HandlerInterface $handler Handler or factory callable($record|null, $filterHandler).
|
||||
* @param int|array $minLevelOrList A list of levels to accept or a minimum level if maxLevel is provided
|
||||
* @param int|string $maxLevel Maximum level to accept, only used if $minLevelOrList is not an array
|
||||
|
@@ -47,6 +47,8 @@ class FingersCrossedHandler extends Handler implements ProcessableHandlerInterfa
|
||||
protected $bubble;
|
||||
|
||||
/**
|
||||
* @psalm-param HandlerInterface|callable(?array, FingersCrossedHandler): HandlerInterface $handler
|
||||
*
|
||||
* @param callable|HandlerInterface $handler Handler or factory callable($record|null, $fingersCrossedHandler).
|
||||
* @param int|string|ActivationStrategyInterface $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.
|
||||
|
@@ -25,6 +25,8 @@ class MandrillHandler extends MailHandler
|
||||
protected $apiKey;
|
||||
|
||||
/**
|
||||
* @psalm-param Swift_Message|callable(string, array): Swift_Message $message
|
||||
*
|
||||
* @param string $apiKey A valid Mandrill API key
|
||||
* @param callable|\Swift_Message $message An example message for real messages, only the body will be replaced
|
||||
* @param string|int $level The minimum logging level at which this handler will be triggered
|
||||
|
@@ -23,6 +23,8 @@ interface ProcessableHandlerInterface
|
||||
/**
|
||||
* Adds a processor in the stack.
|
||||
*
|
||||
* @psalm-param ProcessorInterface|callable(array): array $callback
|
||||
*
|
||||
* @param ProcessorInterface|callable $callback
|
||||
* @return HandlerInterface self
|
||||
*/
|
||||
@@ -31,6 +33,8 @@ interface ProcessableHandlerInterface
|
||||
/**
|
||||
* Removes the processor on top of the stack and returns it.
|
||||
*
|
||||
* @psalm-return callable(array): array
|
||||
*
|
||||
* @throws \LogicException In case the processor stack is empty
|
||||
* @return callable
|
||||
*/
|
||||
|
@@ -42,6 +42,8 @@ class SamplingHandler extends AbstractHandler implements ProcessableHandlerInter
|
||||
protected $factor;
|
||||
|
||||
/**
|
||||
* @psalm-param HandlerInterface|callable(array, HandlerInterface): HandlerInterface $handler
|
||||
*
|
||||
* @param callable|HandlerInterface $handler Handler or factory callable($record|null, $samplingHandler).
|
||||
* @param int $factor Sample factor (e.g. 10 means every ~10th record is sampled)
|
||||
*/
|
||||
|
@@ -28,6 +28,8 @@ class SwiftMailerHandler extends MailHandler
|
||||
private $messageTemplate;
|
||||
|
||||
/**
|
||||
* @psalm-param Swift_Message|callable(string, array): Swift_Message $message
|
||||
*
|
||||
* @param \Swift_Mailer $mailer The mailer to use
|
||||
* @param callable|Swift_Message $message An example message for real messages, only the body will be replaced
|
||||
* @param string|int $level The minimum logging level at which this handler will be triggered
|
||||
|
@@ -139,13 +139,16 @@ class TestHandler extends AbstractProcessingHandler
|
||||
*/
|
||||
public function hasRecordThatMatches(string $regex, $level): bool
|
||||
{
|
||||
return $this->hasRecordThatPasses(function ($rec) use ($regex) {
|
||||
return $this->hasRecordThatPasses(function (array $rec) use ($regex): bool {
|
||||
return preg_match($regex, $rec['message']) > 0;
|
||||
}, $level);
|
||||
}
|
||||
|
||||
/**
|
||||
* @psalm-param callable(array, int): mixed $predicate
|
||||
*
|
||||
* @param string|int $level Logging level value or name
|
||||
* @return bool
|
||||
*/
|
||||
public function hasRecordThatPasses(callable $predicate, $level)
|
||||
{
|
||||
|
@@ -140,6 +140,8 @@ class Logger implements LoggerInterface, ResettableInterface
|
||||
protected $exceptionHandler;
|
||||
|
||||
/**
|
||||
* @psalm-param array<callable(array): array> $processors
|
||||
*
|
||||
* @param string $name The logging channel, a simple descriptive name that is attached to all log records
|
||||
* @param HandlerInterface[] $handlers Optional stack of handlers, the first one in the array is called first, etc.
|
||||
* @param callable[] $processors Optional array of processors
|
||||
|
Reference in New Issue
Block a user