1
0
mirror of https://github.com/Seldaek/monolog.git synced 2025-08-01 19:00:20 +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

@@ -65,6 +65,7 @@ class FirePHPHandler extends AbstractProcessingHandler
*
* @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

@@ -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

@@ -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

@@ -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

@@ -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
@@ -287,7 +286,7 @@ class ElasticaHandlerTest extends TestCase
*/
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)