mirror of
https://github.com/Seldaek/monolog.git
synced 2025-08-01 19:00:20 +02:00
Fix CS
This commit is contained in:
@@ -77,7 +77,7 @@ class ElasticaFormatter extends NormalizerFormatter
|
|||||||
{
|
{
|
||||||
$document = new Document();
|
$document = new Document();
|
||||||
$document->setData($record);
|
$document->setData($record);
|
||||||
if(method_exists($document, 'setType')) {
|
if (method_exists($document, 'setType')) {
|
||||||
$document->setType($this->type);
|
$document->setType($this->type);
|
||||||
}
|
}
|
||||||
$document->setIndex($this->index);
|
$document->setIndex($this->index);
|
||||||
|
@@ -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 "[...]"
|
* @return mixed[]|string Array except when max nesting level is reached then a string "[...]"
|
||||||
*/
|
*/
|
||||||
protected function formatArray(array $array, int $nestingLevel = 0)
|
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
|
* @return mixed[]|string
|
||||||
*/
|
*/
|
||||||
protected function formatObject($value, int $nestingLevel)
|
protected function formatObject($value, int $nestingLevel)
|
||||||
|
@@ -122,7 +122,7 @@ class NormalizerFormatter implements FormatterInterface
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param mixed $data
|
* @param mixed $data
|
||||||
* @return scalar|array<scalar>
|
* @return scalar|array<scalar>
|
||||||
*/
|
*/
|
||||||
protected function normalize($data, int $depth = 0)
|
protected function normalize($data, int $depth = 0)
|
||||||
|
@@ -34,7 +34,7 @@ class ScalarFormatter extends NormalizerFormatter
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param mixed $value
|
* @param mixed $value
|
||||||
* @return string|int|bool|null
|
* @return string|int|bool|null
|
||||||
*/
|
*/
|
||||||
protected function normalizeValue($value)
|
protected function normalizeValue($value)
|
||||||
|
@@ -213,7 +213,7 @@ class BrowserConsoleHandler extends AbstractProcessingHandler
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param mixed[] $dict
|
* @param mixed[] $dict
|
||||||
* @return mixed[]
|
* @return mixed[]
|
||||||
*/
|
*/
|
||||||
private static function dump(string $title, array $dict): array
|
private static function dump(string $title, array $dict): array
|
||||||
|
@@ -84,7 +84,7 @@ class DynamoDbHandler extends AbstractProcessingHandler
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param mixed[] $record
|
* @param mixed[] $record
|
||||||
* @return mixed[]
|
* @return mixed[]
|
||||||
*/
|
*/
|
||||||
protected function filterEmptyFields(array $record): array
|
protected function filterEmptyFields(array $record): array
|
||||||
|
@@ -47,8 +47,8 @@ class ElasticaHandler extends AbstractProcessingHandler
|
|||||||
protected $options = [];
|
protected $options = [];
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param Client $client Elastica Client object
|
* @param Client $client Elastica Client object
|
||||||
* @param mixed[] $options Handler configuration
|
* @param mixed[] $options Handler configuration
|
||||||
*/
|
*/
|
||||||
public function __construct(Client $client, array $options = [], $level = Logger::DEBUG, bool $bubble = true)
|
public function __construct(Client $client, array $options = [], $level = Logger::DEBUG, bool $bubble = true)
|
||||||
{
|
{
|
||||||
|
@@ -54,8 +54,8 @@ class ElasticsearchHandler extends AbstractProcessingHandler
|
|||||||
protected $options = [];
|
protected $options = [];
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param Client $client Elasticsearch Client object
|
* @param Client $client Elasticsearch Client object
|
||||||
* @param mixed[] $options Handler configuration
|
* @param mixed[] $options Handler configuration
|
||||||
*/
|
*/
|
||||||
public function __construct(Client $client, array $options = [], $level = Logger::DEBUG, bool $bubble = true)
|
public function __construct(Client $client, array $options = [], $level = Logger::DEBUG, bool $bubble = true)
|
||||||
{
|
{
|
||||||
|
@@ -31,8 +31,8 @@ class ErrorLogHandler extends AbstractProcessingHandler
|
|||||||
protected $expandNewlines;
|
protected $expandNewlines;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param int $messageType Says where the error should go.
|
* @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 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)
|
public function __construct(int $messageType = self::OPERATING_SYSTEM, $level = Logger::DEBUG, bool $bubble = true, bool $expandNewlines = false)
|
||||||
{
|
{
|
||||||
|
@@ -63,8 +63,9 @@ class FirePHPHandler extends AbstractProcessingHandler
|
|||||||
/**
|
/**
|
||||||
* Base header creation function used by init headers & record headers
|
* Base header creation function used by init headers & record headers
|
||||||
*
|
*
|
||||||
* @param array<int|string> $meta Wildfire Plugin, Protocol & Structure Indexes
|
* @param array<int|string> $meta Wildfire Plugin, Protocol & Structure Indexes
|
||||||
* @param string $message Log message
|
* @param string $message Log message
|
||||||
|
*
|
||||||
* @return array<string, string> Complete header string ready for the client as key and message as value
|
* @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
|
protected function createHeader(array $meta, string $message): array
|
||||||
|
@@ -33,8 +33,8 @@ class IFTTTHandler extends AbstractProcessingHandler
|
|||||||
private $secretKey;
|
private $secretKey;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param string $eventName The name of the IFTTT Maker event that should be triggered
|
* @param string $eventName The name of the IFTTT Maker event that should be triggered
|
||||||
* @param string $secretKey A valid IFTTT secret key
|
* @param string $secretKey A valid IFTTT secret key
|
||||||
*/
|
*/
|
||||||
public function __construct(string $eventName, string $secretKey, $level = Logger::ERROR, bool $bubble = true)
|
public function __construct(string $eventName, string $secretKey, $level = Logger::ERROR, bool $bubble = true)
|
||||||
{
|
{
|
||||||
|
@@ -44,7 +44,7 @@ class LogglyHandler extends AbstractProcessingHandler
|
|||||||
protected $tag = [];
|
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
|
* @throws MissingExtensionException If the curl extension is missing
|
||||||
*/
|
*/
|
||||||
|
@@ -66,9 +66,9 @@ class NativeMailerHandler extends MailHandler
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* @param string|string[] $to The receiver of the mail
|
* @param string|string[] $to The receiver of the mail
|
||||||
* @param string $subject The subject of the mail
|
* @param string $subject The subject of the mail
|
||||||
* @param string $from The sender 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 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)
|
public function __construct($to, string $subject, string $from, $level = Logger::ERROR, bool $bubble = true, int $maxColumnWidth = 70)
|
||||||
{
|
{
|
||||||
|
@@ -86,6 +86,7 @@ class PHPConsoleHandler extends AbstractProcessingHandler
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* @param array<string, mixed> $options
|
* @param array<string, mixed> $options
|
||||||
|
*
|
||||||
* @return array<string, mixed>
|
* @return array<string, mixed>
|
||||||
*/
|
*/
|
||||||
private function initOptions(array $options): array
|
private function initOptions(array $options): array
|
||||||
|
@@ -37,7 +37,7 @@ interface ProcessableHandlerInterface
|
|||||||
*
|
*
|
||||||
* @psalm-return ProcessorInterface|callable(Record): Record $callback
|
* @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
|
* @return callable|ProcessorInterface
|
||||||
*/
|
*/
|
||||||
public function popProcessor(): callable;
|
public function popProcessor(): callable;
|
||||||
|
@@ -34,8 +34,8 @@ class RedisPubSubHandler extends AbstractProcessingHandler
|
|||||||
private $channelKey;
|
private $channelKey;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param \Predis\Client|\Redis $redis The redis instance
|
* @param \Predis\Client|\Redis $redis The redis instance
|
||||||
* @param string $key The channel key to publish records to
|
* @param string $key The channel key to publish records to
|
||||||
*/
|
*/
|
||||||
public function __construct($redis, string $key, $level = Logger::DEBUG, bool $bubble = true)
|
public function __construct($redis, string $key, $level = Logger::DEBUG, bool $bubble = true)
|
||||||
{
|
{
|
||||||
|
@@ -316,6 +316,7 @@ class SlackRecord
|
|||||||
* Generates attachment field
|
* Generates attachment field
|
||||||
*
|
*
|
||||||
* @param string|mixed[] $value
|
* @param string|mixed[] $value
|
||||||
|
*
|
||||||
* @return array{title: string, value: string, short: false}
|
* @return array{title: string, value: string, short: false}
|
||||||
*/
|
*/
|
||||||
private function generateAttachmentField(string $title, $value): array
|
private function generateAttachmentField(string $title, $value): array
|
||||||
@@ -335,6 +336,7 @@ class SlackRecord
|
|||||||
* Generates a collection of attachment fields from array
|
* Generates a collection of attachment fields from array
|
||||||
*
|
*
|
||||||
* @param mixed[] $data
|
* @param mixed[] $data
|
||||||
|
*
|
||||||
* @return array<array{title: string, value: string, short: false}>
|
* @return array<array{title: string, value: string, short: false}>
|
||||||
*/
|
*/
|
||||||
private function generateAttachmentFields(array $data): array
|
private function generateAttachmentFields(array $data): array
|
||||||
@@ -351,6 +353,7 @@ class SlackRecord
|
|||||||
* Get a copy of record with fields excluded according to $this->excludeFields
|
* Get a copy of record with fields excluded according to $this->excludeFields
|
||||||
*
|
*
|
||||||
* @phpstan-param FormattedRecord $record
|
* @phpstan-param FormattedRecord $record
|
||||||
|
*
|
||||||
* @return mixed[]
|
* @return mixed[]
|
||||||
*/
|
*/
|
||||||
private function removeExcludedFields(array $record): array
|
private function removeExcludedFields(array $record): array
|
||||||
|
@@ -79,7 +79,7 @@ class SyslogUdpHandler extends AbstractSyslogHandler
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param string|string[] $message
|
* @param string|string[] $message
|
||||||
* @return string[]
|
* @return string[]
|
||||||
*/
|
*/
|
||||||
private function splitMessageIntoLines($message): array
|
private function splitMessageIntoLines($message): array
|
||||||
|
@@ -38,7 +38,7 @@ class TelegramBotHandler extends AbstractProcessingHandler
|
|||||||
private const AVAILABLE_PARSE_MODES = [
|
private const AVAILABLE_PARSE_MODES = [
|
||||||
'HTML',
|
'HTML',
|
||||||
'MarkdownV2',
|
'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;
|
$this->parseMode = $parseMode;
|
||||||
|
|
||||||
return $this;
|
return $this;
|
||||||
}
|
}
|
||||||
|
|
||||||
public function disableWebPagePreview(bool $disableWebPagePreview = null): self
|
public function disableWebPagePreview(bool $disableWebPagePreview = null): self
|
||||||
{
|
{
|
||||||
$this->disableWebPagePreview = $disableWebPagePreview;
|
$this->disableWebPagePreview = $disableWebPagePreview;
|
||||||
|
|
||||||
return $this;
|
return $this;
|
||||||
}
|
}
|
||||||
|
|
||||||
public function disableNotification(bool $disableNotification = null): self
|
public function disableNotification(bool $disableNotification = null): self
|
||||||
{
|
{
|
||||||
$this->disableNotification = $disableNotification;
|
$this->disableNotification = $disableNotification;
|
||||||
|
|
||||||
return $this;
|
return $this;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@@ -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
|
* @return bool
|
||||||
*
|
*
|
||||||
* @psalm-param callable(Record, int): mixed $predicate
|
* @psalm-param callable(Record, int): mixed $predicate
|
||||||
@@ -205,8 +205,8 @@ class TestHandler extends AbstractProcessingHandler
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param string $method
|
* @param string $method
|
||||||
* @param mixed[] $args
|
* @param mixed[] $args
|
||||||
* @return bool
|
* @return bool
|
||||||
*/
|
*/
|
||||||
public function __call($method, $args)
|
public function __call($method, $args)
|
||||||
|
@@ -93,7 +93,7 @@ class WebProcessor implements ProcessorInterface
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param mixed[] $extra
|
* @param mixed[] $extra
|
||||||
* @return mixed[]
|
* @return mixed[]
|
||||||
*/
|
*/
|
||||||
private function appendExtraFields(array $extra): array
|
private function appendExtraFields(array $extra): array
|
||||||
|
@@ -41,10 +41,10 @@ class SignalHandler
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param int|string $level Level or level name
|
* @param int|string $level Level or level name
|
||||||
* @param bool $callPrevious
|
* @param bool $callPrevious
|
||||||
* @param bool $restartSyscalls
|
* @param bool $restartSyscalls
|
||||||
* @param bool|null $async
|
* @param bool|null $async
|
||||||
* @return $this
|
* @return $this
|
||||||
*
|
*
|
||||||
* @phpstan-param Level|LevelName|LogLevel::* $level
|
* @phpstan-param Level|LevelName|LogLevel::* $level
|
||||||
|
@@ -56,7 +56,7 @@ class ElasticaFormatterTest extends \PHPUnit\Framework\TestCase
|
|||||||
|
|
||||||
// Document parameters
|
// Document parameters
|
||||||
$this->assertEquals('my_index', $doc->getIndex());
|
$this->assertEquals('my_index', $doc->getIndex());
|
||||||
if(method_exists($doc, 'getType')) {
|
if (method_exists($doc, 'getType')) {
|
||||||
$this->assertEquals('doc_type', $doc->getType());
|
$this->assertEquals('doc_type', $doc->getType());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@@ -263,7 +263,6 @@ class ElasticaHandlerTest extends TestCase
|
|||||||
$client->request("/{$this->options['index']}", Request::DELETE);
|
$client->request("/{$this->options['index']}", Request::DELETE);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Return last created document id from ES response
|
* Return last created document id from ES response
|
||||||
* @param Response $response Elastica Response object
|
* @param Response $response Elastica Response object
|
||||||
@@ -279,15 +278,15 @@ class ElasticaHandlerTest extends TestCase
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Retrieve document by id from Elasticsearch
|
* Retrieve document by id from Elasticsearch
|
||||||
* @param Client $client Elastica client
|
* @param Client $client Elastica client
|
||||||
* @param string $index
|
* @param string $index
|
||||||
* @param ?string $type
|
* @param ?string $type
|
||||||
* @param string $documentId
|
* @param string $documentId
|
||||||
* @return array
|
* @return array
|
||||||
*/
|
*/
|
||||||
protected function getDocSourceFromElastic(Client $client, $index, $type, $documentId)
|
protected function getDocSourceFromElastic(Client $client, $index, $type, $documentId)
|
||||||
{
|
{
|
||||||
if($type === null) {
|
if ($type === null) {
|
||||||
$path = "/{$index}/_doc/{$documentId}";
|
$path = "/{$index}/_doc/{$documentId}";
|
||||||
} else {
|
} else {
|
||||||
$path = "/{$index}/{$type}/{$documentId}";
|
$path = "/{$index}/{$type}/{$documentId}";
|
||||||
|
@@ -13,7 +13,6 @@ namespace Monolog\Handler;
|
|||||||
|
|
||||||
use MongoDB\Driver\Manager;
|
use MongoDB\Driver\Manager;
|
||||||
use Monolog\Test\TestCase;
|
use Monolog\Test\TestCase;
|
||||||
use Monolog\Formatter\NormalizerFormatter;
|
|
||||||
|
|
||||||
class MongoDBHandlerTest extends TestCase
|
class MongoDBHandlerTest extends TestCase
|
||||||
{
|
{
|
||||||
|
@@ -41,8 +41,7 @@ class TelegramBotHandlerTest extends TestCase
|
|||||||
string $parseMode = 'Markdown',
|
string $parseMode = 'Markdown',
|
||||||
bool $disableWebPagePreview = false,
|
bool $disableWebPagePreview = false,
|
||||||
bool $disableNotification = true
|
bool $disableNotification = true
|
||||||
): void
|
): void {
|
||||||
{
|
|
||||||
$constructorArgs = [$apiKey, $channel, Logger::DEBUG, true, $parseMode, $disableWebPagePreview, $disableNotification];
|
$constructorArgs = [$apiKey, $channel, Logger::DEBUG, true, $parseMode, $disableWebPagePreview, $disableNotification];
|
||||||
|
|
||||||
$this->handler = $this->getMockBuilder(TelegramBotHandler::class)
|
$this->handler = $this->getMockBuilder(TelegramBotHandler::class)
|
||||||
|
Reference in New Issue
Block a user