diff --git a/src/Monolog/Formatter/ElasticaFormatter.php b/src/Monolog/Formatter/ElasticaFormatter.php index 8c92eff22..160510ad8 100644 --- a/src/Monolog/Formatter/ElasticaFormatter.php +++ b/src/Monolog/Formatter/ElasticaFormatter.php @@ -34,8 +34,6 @@ class ElasticaFormatter extends NormalizerFormatter /** * @param string $index Elastic Search index name * @param ?string $type Elastic Search document type, deprecated as of Elastica 7 - * - * @throws \RuntimeException If the function json_encode does not exist */ public function __construct(string $index, ?string $type) { diff --git a/src/Monolog/Formatter/ElasticsearchFormatter.php b/src/Monolog/Formatter/ElasticsearchFormatter.php index b38aca079..6c3eb9b2a 100644 --- a/src/Monolog/Formatter/ElasticsearchFormatter.php +++ b/src/Monolog/Formatter/ElasticsearchFormatter.php @@ -34,8 +34,6 @@ class ElasticsearchFormatter extends NormalizerFormatter /** * @param string $index Elasticsearch index name * @param string $type Elasticsearch record type - * - * @throws \RuntimeException If the function json_encode does not exist */ public function __construct(string $index, string $type) { diff --git a/src/Monolog/Formatter/FluentdFormatter.php b/src/Monolog/Formatter/FluentdFormatter.php index 0c9f3e162..5f7811735 100644 --- a/src/Monolog/Formatter/FluentdFormatter.php +++ b/src/Monolog/Formatter/FluentdFormatter.php @@ -42,15 +42,8 @@ class FluentdFormatter implements FormatterInterface */ protected bool $levelTag = false; - /** - * @throws \RuntimeException If the function json_encode does not exist - */ public function __construct(bool $levelTag = false) { - if (!\function_exists('json_encode')) { - throw new \RuntimeException('PHP\'s json extension is required to use Monolog\'s FluentdUnixFormatter'); - } - $this->levelTag = $levelTag; } diff --git a/src/Monolog/Formatter/HtmlFormatter.php b/src/Monolog/Formatter/HtmlFormatter.php index b5d69bcfd..09cbea9b6 100644 --- a/src/Monolog/Formatter/HtmlFormatter.php +++ b/src/Monolog/Formatter/HtmlFormatter.php @@ -42,8 +42,7 @@ protected function getLevelColor(Level $level): string } /** - * @param string|null $dateFormat The format of the timestamp: one supported by DateTime::format - * @throws \RuntimeException If the function json_encode does not exist + * @param string|null $dateFormat The format of the timestamp: one supported by DateTime::format */ public function __construct(?string $dateFormat = null) { diff --git a/src/Monolog/Formatter/JsonFormatter.php b/src/Monolog/Formatter/JsonFormatter.php index 640043a7e..238039f4e 100644 --- a/src/Monolog/Formatter/JsonFormatter.php +++ b/src/Monolog/Formatter/JsonFormatter.php @@ -38,8 +38,6 @@ class JsonFormatter extends NormalizerFormatter /** * @param self::BATCH_MODE_* $batchMode - * - * @throws \RuntimeException If the function json_encode does not exist */ public function __construct(int $batchMode = self::BATCH_MODE_JSON, bool $appendNewline = true, bool $ignoreEmptyContextAndExtra = false, bool $includeStacktraces = false) { diff --git a/src/Monolog/Formatter/LineFormatter.php b/src/Monolog/Formatter/LineFormatter.php index ba5852b39..06b8e4328 100644 --- a/src/Monolog/Formatter/LineFormatter.php +++ b/src/Monolog/Formatter/LineFormatter.php @@ -40,8 +40,6 @@ class LineFormatter extends NormalizerFormatter * @param string|null $format The format of the message * @param string|null $dateFormat The format of the timestamp: one supported by DateTime::format * @param bool $allowInlineLineBreaks Whether to allow inline line breaks in log entries - * - * @throws \RuntimeException If the function json_encode does not exist */ public function __construct(?string $format = null, ?string $dateFormat = null, bool $allowInlineLineBreaks = false, bool $ignoreEmptyContextAndExtra = false, bool $includeStacktraces = false) { diff --git a/src/Monolog/Formatter/LogstashFormatter.php b/src/Monolog/Formatter/LogstashFormatter.php index abee3cd13..d0e8749e3 100644 --- a/src/Monolog/Formatter/LogstashFormatter.php +++ b/src/Monolog/Formatter/LogstashFormatter.php @@ -48,8 +48,6 @@ class LogstashFormatter extends NormalizerFormatter * @param string|null $systemName The system/machine name, used as the "source" field of logstash, defaults to the hostname of the machine * @param string $extraKey The key for extra keys inside logstash "fields", defaults to extra * @param string $contextKey The key for context keys inside logstash "fields", defaults to context - * - * @throws \RuntimeException If the function json_encode does not exist */ public function __construct(string $applicationName, ?string $systemName = null, string $extraKey = 'extra', string $contextKey = 'context') { diff --git a/src/Monolog/Formatter/NormalizerFormatter.php b/src/Monolog/Formatter/NormalizerFormatter.php index e6f35be4d..36d77c96c 100644 --- a/src/Monolog/Formatter/NormalizerFormatter.php +++ b/src/Monolog/Formatter/NormalizerFormatter.php @@ -34,15 +34,11 @@ class NormalizerFormatter implements FormatterInterface protected string $basePath = ''; /** - * @param string|null $dateFormat The format of the timestamp: one supported by DateTime::format - * @throws \RuntimeException If the function json_encode does not exist + * @param string|null $dateFormat The format of the timestamp: one supported by DateTime::format */ public function __construct(?string $dateFormat = null) { $this->dateFormat = null === $dateFormat ? static::SIMPLE_DATE : $dateFormat; - if (!\function_exists('json_encode')) { - throw new \RuntimeException('PHP\'s json extension is required to use Monolog\'s NormalizerFormatter'); - } } /** diff --git a/src/Monolog/Formatter/WildfireFormatter.php b/src/Monolog/Formatter/WildfireFormatter.php index 28a1deecf..5e93e01b0 100644 --- a/src/Monolog/Formatter/WildfireFormatter.php +++ b/src/Monolog/Formatter/WildfireFormatter.php @@ -25,8 +25,6 @@ class WildfireFormatter extends NormalizerFormatter { /** * @param string|null $dateFormat The format of the timestamp: one supported by DateTime::format - * - * @throws \RuntimeException If the function json_encode does not exist */ public function __construct(?string $dateFormat = null) { diff --git a/src/Monolog/Handler/ChromePHPHandler.php b/src/Monolog/Handler/ChromePHPHandler.php index 8b1cd5a3e..61c9e83f9 100644 --- a/src/Monolog/Handler/ChromePHPHandler.php +++ b/src/Monolog/Handler/ChromePHPHandler.php @@ -62,15 +62,9 @@ class ChromePHPHandler extends AbstractProcessingHandler protected static bool $sendHeaders = true; - /** - * @throws \RuntimeException If the function json_encode does not exist - */ public function __construct(int|string|Level $level = Level::Debug, bool $bubble = true) { parent::__construct($level, $bubble); - if (!\function_exists('json_encode')) { - throw new \RuntimeException('PHP\'s json extension is required to use Monolog\'s ChromePHPHandler'); - } } /**