mirror of
https://github.com/Seldaek/monolog.git
synced 2025-08-02 03:10:15 +02:00
Fix CS
This commit is contained in:
@@ -93,7 +93,7 @@ class HtmlFormatter extends NormalizerFormatter
|
|||||||
if ($record['context']) {
|
if ($record['context']) {
|
||||||
$embeddedTable = '<table cellspacing="1" width="100%">';
|
$embeddedTable = '<table cellspacing="1" width="100%">';
|
||||||
foreach ($record['context'] as $key => $value) {
|
foreach ($record['context'] as $key => $value) {
|
||||||
$embeddedTable .= $this->addRow((string)$key, $this->convertToString($value));
|
$embeddedTable .= $this->addRow((string) $key, $this->convertToString($value));
|
||||||
}
|
}
|
||||||
$embeddedTable .= '</table>';
|
$embeddedTable .= '</table>';
|
||||||
$output .= $this->addRow('Context', $embeddedTable, false);
|
$output .= $this->addRow('Context', $embeddedTable, false);
|
||||||
@@ -101,7 +101,7 @@ class HtmlFormatter extends NormalizerFormatter
|
|||||||
if ($record['extra']) {
|
if ($record['extra']) {
|
||||||
$embeddedTable = '<table cellspacing="1" width="100%">';
|
$embeddedTable = '<table cellspacing="1" width="100%">';
|
||||||
foreach ($record['extra'] as $key => $value) {
|
foreach ($record['extra'] as $key => $value) {
|
||||||
$embeddedTable .= $this->addRow((string)$key, $this->convertToString($value));
|
$embeddedTable .= $this->addRow((string) $key, $this->convertToString($value));
|
||||||
}
|
}
|
||||||
$embeddedTable .= '</table>';
|
$embeddedTable .= '</table>';
|
||||||
$output .= $this->addRow('Extra', $embeddedTable, false);
|
$output .= $this->addRow('Extra', $embeddedTable, false);
|
||||||
|
@@ -11,7 +11,6 @@
|
|||||||
|
|
||||||
namespace Monolog\Formatter;
|
namespace Monolog\Formatter;
|
||||||
|
|
||||||
use Monolog\Utils;
|
|
||||||
use Throwable;
|
use Throwable;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@@ -203,7 +203,7 @@ class NormalizerFormatter implements FormatterInterface
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (isset($e->detail)) {
|
if (isset($e->detail)) {
|
||||||
if (is_string($e->detail)) {
|
if (is_string($e->detail)) {
|
||||||
$data['detail'] = $e->detail;
|
$data['detail'] = $e->detail;
|
||||||
} elseif (is_object($e->detail) || is_array($e->detail)) {
|
} elseif (is_object($e->detail) || is_array($e->detail)) {
|
||||||
$data['detail'] = $this->toJson($e->detail, true);
|
$data['detail'] = $this->toJson($e->detail, true);
|
||||||
@@ -230,7 +230,7 @@ class NormalizerFormatter implements FormatterInterface
|
|||||||
*
|
*
|
||||||
* @param mixed $data
|
* @param mixed $data
|
||||||
* @throws \RuntimeException if encoding fails and errors are not ignored
|
* @throws \RuntimeException if encoding fails and errors are not ignored
|
||||||
* @return string if encoding fails and ignoreErrors is true 'null' is returned
|
* @return string if encoding fails and ignoreErrors is true 'null' is returned
|
||||||
*/
|
*/
|
||||||
protected function toJson($data, bool $ignoreErrors = false): string
|
protected function toJson($data, bool $ignoreErrors = false): string
|
||||||
{
|
{
|
||||||
|
@@ -31,6 +31,7 @@ class FallbackGroupHandler extends GroupHandler
|
|||||||
// What throwable?
|
// What throwable?
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return false === $this->bubble;
|
return false === $this->bubble;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@@ -71,10 +71,10 @@ class ZendMonitorHandler extends AbstractProcessingHandler
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Write to Zend Monitor Events
|
* Write to Zend Monitor Events
|
||||||
* @param string $type Text displayed in "Class Name (custom)" field
|
* @param string $type Text displayed in "Class Name (custom)" field
|
||||||
* @param string $message Text displayed in "Error String"
|
* @param string $message Text displayed in "Error String"
|
||||||
* @param mixed $formatted Displayed in Custom Variables tab
|
* @param mixed $formatted Displayed in Custom Variables tab
|
||||||
* @param int $severity Set the event severity level (-1,0,1)
|
* @param int $severity Set the event severity level (-1,0,1)
|
||||||
*/
|
*/
|
||||||
protected function writeZendMonitorCustomEvent(string $type, string $message, array $formatted, int $severity): void
|
protected function writeZendMonitorCustomEvent(string $type, string $message, array $formatted, int $severity): void
|
||||||
{
|
{
|
||||||
|
@@ -66,10 +66,10 @@ final class Utils
|
|||||||
* Return the JSON representation of a value
|
* Return the JSON representation of a value
|
||||||
*
|
*
|
||||||
* @param mixed $data
|
* @param mixed $data
|
||||||
* @param int $encodeFlags flags to pass to json encode, defaults to JSON_UNESCAPED_SLASHES | JSON_UNESCAPED_UNICODE
|
* @param int $encodeFlags flags to pass to json encode, defaults to JSON_UNESCAPED_SLASHES | JSON_UNESCAPED_UNICODE
|
||||||
* @param bool $ignoreErrors whether to ignore encoding errors or to throw on error, when ignored and the encoding fails, "null" is returned which is valid json for null
|
* @param bool $ignoreErrors whether to ignore encoding errors or to throw on error, when ignored and the encoding fails, "null" is returned which is valid json for null
|
||||||
* @throws \RuntimeException if encoding fails and errors are not ignored
|
* @throws \RuntimeException if encoding fails and errors are not ignored
|
||||||
* @return string when errors are ignored and the encoding fails, "null" is returned which is valid json for null
|
* @return string when errors are ignored and the encoding fails, "null" is returned which is valid json for null
|
||||||
*/
|
*/
|
||||||
public static function jsonEncode($data, ?int $encodeFlags = null, bool $ignoreErrors = false): string
|
public static function jsonEncode($data, ?int $encodeFlags = null, bool $ignoreErrors = false): string
|
||||||
{
|
{
|
||||||
@@ -102,8 +102,8 @@ final class Utils
|
|||||||
* initial error is not encoding related or the input can't be cleaned then
|
* initial error is not encoding related or the input can't be cleaned then
|
||||||
* raise a descriptive exception.
|
* raise a descriptive exception.
|
||||||
*
|
*
|
||||||
* @param int $code return code of json_last_error function
|
* @param int $code return code of json_last_error function
|
||||||
* @param mixed $data data that was meant to be encoded
|
* @param mixed $data data that was meant to be encoded
|
||||||
* @param int $encodeFlags flags to pass to json encode, defaults to JSON_UNESCAPED_SLASHES | JSON_UNESCAPED_UNICODE | JSON_PRESERVE_ZERO_FRACTION
|
* @param int $encodeFlags flags to pass to json encode, defaults to JSON_UNESCAPED_SLASHES | JSON_UNESCAPED_UNICODE | JSON_PRESERVE_ZERO_FRACTION
|
||||||
* @throws \RuntimeException if failure can't be corrected
|
* @throws \RuntimeException if failure can't be corrected
|
||||||
* @return string JSON encoded data after error correction
|
* @return string JSON encoded data after error correction
|
||||||
|
@@ -28,7 +28,8 @@ class ErrorHandlerTest extends \PHPUnit\Framework\TestCase
|
|||||||
$logger = new Logger('test', [$handler = new TestHandler]);
|
$logger = new Logger('test', [$handler = new TestHandler]);
|
||||||
$errHandler = new ErrorHandler($logger);
|
$errHandler = new ErrorHandler($logger);
|
||||||
|
|
||||||
$phpunitHandler = set_error_handler($prevHandler = function() {});
|
$phpunitHandler = set_error_handler($prevHandler = function () {
|
||||||
|
});
|
||||||
|
|
||||||
try {
|
try {
|
||||||
$errHandler->registerErrorHandler([], true);
|
$errHandler->registerErrorHandler([], true);
|
||||||
|
@@ -13,7 +13,6 @@ namespace Monolog\Handler;
|
|||||||
|
|
||||||
use Monolog\Test\TestCase;
|
use Monolog\Test\TestCase;
|
||||||
use Monolog\Logger;
|
use Monolog\Logger;
|
||||||
use InvalidArgumentException;
|
|
||||||
|
|
||||||
function mail($to, $subject, $message, $additional_headers = null, $additional_parameters = null)
|
function mail($to, $subject, $message, $additional_headers = null, $additional_parameters = null)
|
||||||
{
|
{
|
||||||
|
@@ -1,4 +1,4 @@
|
|||||||
<?php
|
<?php declare(strict_types=1);
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* This file is part of the Monolog package.
|
* This file is part of the Monolog package.
|
||||||
|
Reference in New Issue
Block a user