1
0
mirror of https://github.com/Seldaek/monolog.git synced 2025-08-03 19:57:41 +02:00
This commit is contained in:
Jordi Boggiano
2021-05-28 22:07:02 +02:00
parent 13d40f953f
commit 4ef5da80ad
26 changed files with 48 additions and 43 deletions

View File

@@ -77,7 +77,7 @@ class ElasticaFormatter extends NormalizerFormatter
{
$document = new Document();
$document->setData($record);
if(method_exists($document, 'setType')) {
if (method_exists($document, 'setType')) {
$document->setType($this->type);
}
$document->setIndex($this->index);

View File

@@ -66,7 +66,7 @@ class MongoDBFormatter implements FormatterInterface
}
/**
* @param mixed[] $array
* @param mixed[] $array
* @return mixed[]|string Array except when max nesting level is reached then a string "[...]"
*/
protected function formatArray(array $array, int $nestingLevel = 0)
@@ -91,7 +91,7 @@ class MongoDBFormatter implements FormatterInterface
}
/**
* @param mixed $value
* @param mixed $value
* @return mixed[]|string
*/
protected function formatObject($value, int $nestingLevel)

View File

@@ -122,7 +122,7 @@ class NormalizerFormatter implements FormatterInterface
}
/**
* @param mixed $data
* @param mixed $data
* @return scalar|array<scalar>
*/
protected function normalize($data, int $depth = 0)

View File

@@ -34,7 +34,7 @@ class ScalarFormatter extends NormalizerFormatter
}
/**
* @param mixed $value
* @param mixed $value
* @return string|int|bool|null
*/
protected function normalizeValue($value)

View File

@@ -213,7 +213,7 @@ class BrowserConsoleHandler extends AbstractProcessingHandler
}
/**
* @param mixed[] $dict
* @param mixed[] $dict
* @return mixed[]
*/
private static function dump(string $title, array $dict): array

View File

@@ -84,7 +84,7 @@ class DynamoDbHandler extends AbstractProcessingHandler
}
/**
* @param mixed[] $record
* @param mixed[] $record
* @return mixed[]
*/
protected function filterEmptyFields(array $record): array

View File

@@ -47,8 +47,8 @@ class ElasticaHandler extends AbstractProcessingHandler
protected $options = [];
/**
* @param Client $client Elastica Client object
* @param mixed[] $options Handler configuration
* @param Client $client Elastica Client object
* @param mixed[] $options Handler configuration
*/
public function __construct(Client $client, array $options = [], $level = Logger::DEBUG, bool $bubble = true)
{

View File

@@ -54,8 +54,8 @@ class ElasticsearchHandler extends AbstractProcessingHandler
protected $options = [];
/**
* @param Client $client Elasticsearch Client object
* @param mixed[] $options Handler configuration
* @param Client $client Elasticsearch Client object
* @param mixed[] $options Handler configuration
*/
public function __construct(Client $client, array $options = [], $level = Logger::DEBUG, bool $bubble = true)
{

View File

@@ -31,8 +31,8 @@ class ErrorLogHandler extends AbstractProcessingHandler
protected $expandNewlines;
/**
* @param int $messageType Says where the error should go.
* @param bool $expandNewlines If set to true, newlines in the message will be expanded to be take multiple log entries
* @param int $messageType Says where the error should go.
* @param bool $expandNewlines If set to true, newlines in the message will be expanded to be take multiple log entries
*/
public function __construct(int $messageType = self::OPERATING_SYSTEM, $level = Logger::DEBUG, bool $bubble = true, bool $expandNewlines = false)
{

View File

@@ -63,8 +63,9 @@ class FirePHPHandler extends AbstractProcessingHandler
/**
* Base header creation function used by init headers & record headers
*
* @param array<int|string> $meta Wildfire Plugin, Protocol & Structure Indexes
* @param string $message Log message
* @param array<int|string> $meta Wildfire Plugin, Protocol & Structure Indexes
* @param string $message Log message
*
* @return array<string, string> Complete header string ready for the client as key and message as value
*/
protected function createHeader(array $meta, string $message): array

View File

@@ -33,8 +33,8 @@ class IFTTTHandler extends AbstractProcessingHandler
private $secretKey;
/**
* @param string $eventName The name of the IFTTT Maker event that should be triggered
* @param string $secretKey A valid IFTTT secret key
* @param string $eventName The name of the IFTTT Maker event that should be triggered
* @param string $secretKey A valid IFTTT secret key
*/
public function __construct(string $eventName, string $secretKey, $level = Logger::ERROR, bool $bubble = true)
{

View File

@@ -44,7 +44,7 @@ class LogglyHandler extends AbstractProcessingHandler
protected $tag = [];
/**
* @param string $token API token supplied by Loggly
* @param string $token API token supplied by Loggly
*
* @throws MissingExtensionException If the curl extension is missing
*/

View File

@@ -66,9 +66,9 @@ class NativeMailerHandler extends MailHandler
/**
* @param string|string[] $to The receiver of the mail
* @param string $subject The subject of the mail
* @param string $from The sender of the mail
* @param int $maxColumnWidth The maximum column width that the message lines will have
* @param string $subject The subject of the mail
* @param string $from The sender of the mail
* @param int $maxColumnWidth The maximum column width that the message lines will have
*/
public function __construct($to, string $subject, string $from, $level = Logger::ERROR, bool $bubble = true, int $maxColumnWidth = 70)
{

View File

@@ -86,6 +86,7 @@ class PHPConsoleHandler extends AbstractProcessingHandler
/**
* @param array<string, mixed> $options
*
* @return array<string, mixed>
*/
private function initOptions(array $options): array

View File

@@ -37,7 +37,7 @@ interface ProcessableHandlerInterface
*
* @psalm-return ProcessorInterface|callable(Record): Record $callback
*
* @throws \LogicException In case the processor stack is empty
* @throws \LogicException In case the processor stack is empty
* @return callable|ProcessorInterface
*/
public function popProcessor(): callable;

View File

@@ -34,8 +34,8 @@ class RedisPubSubHandler extends AbstractProcessingHandler
private $channelKey;
/**
* @param \Predis\Client|\Redis $redis The redis instance
* @param string $key The channel key to publish records to
* @param \Predis\Client|\Redis $redis The redis instance
* @param string $key The channel key to publish records to
*/
public function __construct($redis, string $key, $level = Logger::DEBUG, bool $bubble = true)
{

View File

@@ -316,6 +316,7 @@ class SlackRecord
* Generates attachment field
*
* @param string|mixed[] $value
*
* @return array{title: string, value: string, short: false}
*/
private function generateAttachmentField(string $title, $value): array
@@ -335,6 +336,7 @@ class SlackRecord
* Generates a collection of attachment fields from array
*
* @param mixed[] $data
*
* @return array<array{title: string, value: string, short: false}>
*/
private function generateAttachmentFields(array $data): array
@@ -351,6 +353,7 @@ class SlackRecord
* Get a copy of record with fields excluded according to $this->excludeFields
*
* @phpstan-param FormattedRecord $record
*
* @return mixed[]
*/
private function removeExcludedFields(array $record): array

View File

@@ -79,7 +79,7 @@ class SyslogUdpHandler extends AbstractSyslogHandler
}
/**
* @param string|string[] $message
* @param string|string[] $message
* @return string[]
*/
private function splitMessageIntoLines($message): array

View File

@@ -38,7 +38,7 @@ class TelegramBotHandler extends AbstractProcessingHandler
private const AVAILABLE_PARSE_MODES = [
'HTML',
'MarkdownV2',
'Markdown' // legacy mode without underline and strikethrough, use MarkdownV2 instead
'Markdown', // legacy mode without underline and strikethrough, use MarkdownV2 instead
];
/**
@@ -104,18 +104,21 @@ class TelegramBotHandler extends AbstractProcessingHandler
}
$this->parseMode = $parseMode;
return $this;
}
public function disableWebPagePreview(bool $disableWebPagePreview = null): self
{
$this->disableWebPagePreview = $disableWebPagePreview;
return $this;
}
public function disableNotification(bool $disableNotification = null): self
{
$this->disableNotification = $disableNotification;
return $this;
}

View File

@@ -172,7 +172,7 @@ class TestHandler extends AbstractProcessingHandler
}
/**
* @param string|int $level Logging level value or name
* @param string|int $level Logging level value or name
* @return bool
*
* @psalm-param callable(Record, int): mixed $predicate
@@ -205,8 +205,8 @@ class TestHandler extends AbstractProcessingHandler
}
/**
* @param string $method
* @param mixed[] $args
* @param string $method
* @param mixed[] $args
* @return bool
*/
public function __call($method, $args)

View File

@@ -93,7 +93,7 @@ class WebProcessor implements ProcessorInterface
}
/**
* @param mixed[] $extra
* @param mixed[] $extra
* @return mixed[]
*/
private function appendExtraFields(array $extra): array

View File

@@ -41,10 +41,10 @@ class SignalHandler
}
/**
* @param int|string $level Level or level name
* @param bool $callPrevious
* @param bool $restartSyscalls
* @param bool|null $async
* @param int|string $level Level or level name
* @param bool $callPrevious
* @param bool $restartSyscalls
* @param bool|null $async
* @return $this
*
* @phpstan-param Level|LevelName|LogLevel::* $level

View File

@@ -56,7 +56,7 @@ class ElasticaFormatterTest extends \PHPUnit\Framework\TestCase
// Document parameters
$this->assertEquals('my_index', $doc->getIndex());
if(method_exists($doc, 'getType')) {
if (method_exists($doc, 'getType')) {
$this->assertEquals('doc_type', $doc->getType());
}

View File

@@ -263,7 +263,6 @@ class ElasticaHandlerTest extends TestCase
$client->request("/{$this->options['index']}", Request::DELETE);
}
/**
* Return last created document id from ES response
* @param Response $response Elastica Response object
@@ -279,15 +278,15 @@ class ElasticaHandlerTest extends TestCase
/**
* Retrieve document by id from Elasticsearch
* @param Client $client Elastica client
* @param string $index
* @param Client $client Elastica client
* @param string $index
* @param ?string $type
* @param string $documentId
* @param string $documentId
* @return array
*/
protected function getDocSourceFromElastic(Client $client, $index, $type, $documentId)
{
if($type === null) {
if ($type === null) {
$path = "/{$index}/_doc/{$documentId}";
} else {
$path = "/{$index}/{$type}/{$documentId}";

View File

@@ -13,7 +13,6 @@ namespace Monolog\Handler;
use MongoDB\Driver\Manager;
use Monolog\Test\TestCase;
use Monolog\Formatter\NormalizerFormatter;
class MongoDBHandlerTest extends TestCase
{

View File

@@ -41,8 +41,7 @@ class TelegramBotHandlerTest extends TestCase
string $parseMode = 'Markdown',
bool $disableWebPagePreview = false,
bool $disableNotification = true
): void
{
): void {
$constructorArgs = [$apiKey, $channel, Logger::DEBUG, true, $parseMode, $disableWebPagePreview, $disableNotification];
$this->handler = $this->getMockBuilder(TelegramBotHandler::class)