|Level|LogLevel::* $level
+ * @phpstan-param Level|LevelName|LogLevel::* $level
*/
- public function __construct(int|string|Level $level = Level::Debug)
+ public function __construct($level = Logger::DEBUG)
{
$this->level = Logger::toMonologLevel($level);
}
/**
- * @inheritDoc
+ * {@inheritDoc}
*/
- public function __invoke(LogRecord $record): LogRecord
+ public function __invoke(array $record): array
{
// return if the level is not high enough
- if ($record->level->isLowerThan($this->level)) {
+ if ($record['level'] < $this->level) {
return $record;
}
- $record->extra['hg'] = self::getMercurialInfo();
+ $record['extra']['hg'] = self::getMercurialInfo();
return $record;
}
@@ -57,11 +59,11 @@ public function __invoke(LogRecord $record): LogRecord
*/
private static function getMercurialInfo(): array
{
- if (self::$cache !== null) {
+ if (self::$cache) {
return self::$cache;
}
- $result = explode(' ', trim((string) shell_exec('hg id -nb')));
+ $result = explode(' ', trim(`hg id -nb`));
if (count($result) >= 3) {
return self::$cache = [
diff --git a/vendor/monolog/monolog/src/Monolog/Processor/ProcessIdProcessor.php b/vendor/monolog/monolog/src/Monolog/Processor/ProcessIdProcessor.php
index bb9a52243..3b939a951 100644
--- a/vendor/monolog/monolog/src/Monolog/Processor/ProcessIdProcessor.php
+++ b/vendor/monolog/monolog/src/Monolog/Processor/ProcessIdProcessor.php
@@ -11,8 +11,6 @@
namespace Monolog\Processor;
-use Monolog\LogRecord;
-
/**
* Adds value of getmypid into records
*
@@ -21,11 +19,11 @@
class ProcessIdProcessor implements ProcessorInterface
{
/**
- * @inheritDoc
+ * {@inheritDoc}
*/
- public function __invoke(LogRecord $record): LogRecord
+ public function __invoke(array $record): array
{
- $record->extra['process_id'] = getmypid();
+ $record['extra']['process_id'] = getmypid();
return $record;
}
diff --git a/vendor/monolog/monolog/src/Monolog/Processor/ProcessorInterface.php b/vendor/monolog/monolog/src/Monolog/Processor/ProcessorInterface.php
index ebe41fc20..5defb7eb4 100644
--- a/vendor/monolog/monolog/src/Monolog/Processor/ProcessorInterface.php
+++ b/vendor/monolog/monolog/src/Monolog/Processor/ProcessorInterface.php
@@ -11,17 +11,20 @@
namespace Monolog\Processor;
-use Monolog\LogRecord;
-
/**
* An optional interface to allow labelling Monolog processors.
*
* @author Nicolas Grekas
+ *
+ * @phpstan-import-type Record from \Monolog\Logger
*/
interface ProcessorInterface
{
/**
- * @return LogRecord The processed record
+ * @return array The processed record
+ *
+ * @phpstan-param Record $record
+ * @phpstan-return Record
*/
- public function __invoke(LogRecord $record);
+ public function __invoke(array $record);
}
diff --git a/vendor/monolog/monolog/src/Monolog/Processor/PsrLogMessageProcessor.php b/vendor/monolog/monolog/src/Monolog/Processor/PsrLogMessageProcessor.php
index aad2aad2f..e7c12176a 100644
--- a/vendor/monolog/monolog/src/Monolog/Processor/PsrLogMessageProcessor.php
+++ b/vendor/monolog/monolog/src/Monolog/Processor/PsrLogMessageProcessor.php
@@ -12,7 +12,6 @@
namespace Monolog\Processor;
use Monolog\Utils;
-use Monolog\LogRecord;
/**
* Processes a record's message according to PSR-3 rules
@@ -25,9 +24,11 @@ class PsrLogMessageProcessor implements ProcessorInterface
{
public const SIMPLE_DATE = "Y-m-d\TH:i:s.uP";
- private ?string $dateFormat;
+ /** @var string|null */
+ private $dateFormat;
- private bool $removeUsedContextFields;
+ /** @var bool */
+ private $removeUsedContextFields;
/**
* @param string|null $dateFormat The format of the timestamp: one supported by DateTime::format
@@ -40,32 +41,30 @@ public function __construct(?string $dateFormat = null, bool $removeUsedContextF
}
/**
- * @inheritDoc
+ * {@inheritDoc}
*/
- public function __invoke(LogRecord $record): LogRecord
+ public function __invoke(array $record): array
{
- if (false === strpos($record->message, '{')) {
+ if (false === strpos($record['message'], '{')) {
return $record;
}
$replacements = [];
- $context = $record->context;
-
- foreach ($context as $key => $val) {
+ foreach ($record['context'] as $key => $val) {
$placeholder = '{' . $key . '}';
- if (strpos($record->message, $placeholder) === false) {
+ if (strpos($record['message'], $placeholder) === false) {
continue;
}
- if (null === $val || is_scalar($val) || (is_object($val) && method_exists($val, "__toString"))) {
+ if (is_null($val) || is_scalar($val) || (is_object($val) && method_exists($val, "__toString"))) {
$replacements[$placeholder] = $val;
} elseif ($val instanceof \DateTimeInterface) {
- if (null === $this->dateFormat && $val instanceof \Monolog\DateTimeImmutable) {
+ if (!$this->dateFormat && $val instanceof \Monolog\DateTimeImmutable) {
// handle monolog dates using __toString if no specific dateFormat was asked for
// so that it follows the useMicroseconds flag
$replacements[$placeholder] = (string) $val;
} else {
- $replacements[$placeholder] = $val->format($this->dateFormat ?? static::SIMPLE_DATE);
+ $replacements[$placeholder] = $val->format($this->dateFormat ?: static::SIMPLE_DATE);
}
} elseif ($val instanceof \UnitEnum) {
$replacements[$placeholder] = $val instanceof \BackedEnum ? $val->value : $val->name;
@@ -78,10 +77,12 @@ public function __invoke(LogRecord $record): LogRecord
}
if ($this->removeUsedContextFields) {
- unset($context[$key]);
+ unset($record['context'][$key]);
}
}
- return $record->with(message: strtr($record->message, $replacements), context: $context);
+ $record['message'] = strtr($record['message'], $replacements);
+
+ return $record;
}
}
diff --git a/vendor/monolog/monolog/src/Monolog/Processor/TagProcessor.php b/vendor/monolog/monolog/src/Monolog/Processor/TagProcessor.php
index 10ed1cea3..80f18747a 100644
--- a/vendor/monolog/monolog/src/Monolog/Processor/TagProcessor.php
+++ b/vendor/monolog/monolog/src/Monolog/Processor/TagProcessor.php
@@ -11,8 +11,6 @@
namespace Monolog\Processor;
-use Monolog\LogRecord;
-
/**
* Adds a tags array into record
*
@@ -21,7 +19,7 @@
class TagProcessor implements ProcessorInterface
{
/** @var string[] */
- private array $tags;
+ private $tags;
/**
* @param string[] $tags
@@ -33,7 +31,6 @@ public function __construct(array $tags = [])
/**
* @param string[] $tags
- * @return $this
*/
public function addTags(array $tags = []): self
{
@@ -44,7 +41,6 @@ public function addTags(array $tags = []): self
/**
* @param string[] $tags
- * @return $this
*/
public function setTags(array $tags = []): self
{
@@ -54,11 +50,11 @@ public function setTags(array $tags = []): self
}
/**
- * @inheritDoc
+ * {@inheritDoc}
*/
- public function __invoke(LogRecord $record): LogRecord
+ public function __invoke(array $record): array
{
- $record->extra['tags'] = $this->tags;
+ $record['extra']['tags'] = $this->tags;
return $record;
}
diff --git a/vendor/monolog/monolog/src/Monolog/Processor/UidProcessor.php b/vendor/monolog/monolog/src/Monolog/Processor/UidProcessor.php
index 3a0c128c2..a27b74dbf 100644
--- a/vendor/monolog/monolog/src/Monolog/Processor/UidProcessor.php
+++ b/vendor/monolog/monolog/src/Monolog/Processor/UidProcessor.php
@@ -12,7 +12,6 @@
namespace Monolog\Processor;
use Monolog\ResettableInterface;
-use Monolog\LogRecord;
/**
* Adds a unique identifier into records
@@ -21,12 +20,9 @@
*/
class UidProcessor implements ProcessorInterface, ResettableInterface
{
- /** @var non-empty-string */
- private string $uid;
+ /** @var string */
+ private $uid;
- /**
- * @param int<1, 32> $length
- */
public function __construct(int $length = 7)
{
if ($length > 32 || $length < 1) {
@@ -37,11 +33,11 @@ public function __construct(int $length = 7)
}
/**
- * @inheritDoc
+ * {@inheritDoc}
*/
- public function __invoke(LogRecord $record): LogRecord
+ public function __invoke(array $record): array
{
- $record->extra['uid'] = $this->uid;
+ $record['extra']['uid'] = $this->uid;
return $record;
}
@@ -51,15 +47,11 @@ public function getUid(): string
return $this->uid;
}
- public function reset(): void
+ public function reset()
{
$this->uid = $this->generateUid(strlen($this->uid));
}
- /**
- * @param positive-int $length
- * @return non-empty-string
- */
private function generateUid(int $length): string
{
return substr(bin2hex(random_bytes((int) ceil($length / 2))), 0, $length);
diff --git a/vendor/monolog/monolog/src/Monolog/Processor/WebProcessor.php b/vendor/monolog/monolog/src/Monolog/Processor/WebProcessor.php
index 1abb8400c..51850e17f 100644
--- a/vendor/monolog/monolog/src/Monolog/Processor/WebProcessor.php
+++ b/vendor/monolog/monolog/src/Monolog/Processor/WebProcessor.php
@@ -11,9 +11,6 @@
namespace Monolog\Processor;
-use ArrayAccess;
-use Monolog\LogRecord;
-
/**
* Injects url/method and remote IP of the current web request in all records
*
@@ -22,9 +19,9 @@
class WebProcessor implements ProcessorInterface
{
/**
- * @var array|ArrayAccess
+ * @var array|\ArrayAccess
*/
- protected array|ArrayAccess $serverData;
+ protected $serverData;
/**
* Default fields
@@ -33,7 +30,7 @@ class WebProcessor implements ProcessorInterface
*
* @var array
*/
- protected array $extraFields = [
+ protected $extraFields = [
'url' => 'REQUEST_URI',
'ip' => 'REMOTE_ADDR',
'http_method' => 'REQUEST_METHOD',
@@ -43,15 +40,17 @@ class WebProcessor implements ProcessorInterface
];
/**
- * @param array|ArrayAccess|null $serverData Array or object w/ ArrayAccess that provides access to the $_SERVER data
- * @param array|array|null $extraFields Field names and the related key inside $serverData to be added (or just a list of field names to use the default configured $serverData mapping). If not provided it defaults to: [url, ip, http_method, server, referrer] + unique_id if present in server data
+ * @param array|\ArrayAccess|null $serverData Array or object w/ ArrayAccess that provides access to the $_SERVER data
+ * @param array|array|null $extraFields Field names and the related key inside $serverData to be added (or just a list of field names to use the default configured $serverData mapping). If not provided it defaults to: [url, ip, http_method, server, referrer] + unique_id if present in server data
*/
- public function __construct(array|ArrayAccess|null $serverData = null, array|null $extraFields = null)
+ public function __construct($serverData = null, array $extraFields = null)
{
if (null === $serverData) {
$this->serverData = &$_SERVER;
- } else {
+ } elseif (is_array($serverData) || $serverData instanceof \ArrayAccess) {
$this->serverData = $serverData;
+ } else {
+ throw new \UnexpectedValueException('$serverData must be an array or object implementing ArrayAccess.');
}
$defaultEnabled = ['url', 'ip', 'http_method', 'server', 'referrer'];
@@ -65,7 +64,7 @@ public function __construct(array|ArrayAccess|null $serverData = null, array|nul
}
if (isset($extraFields[0])) {
foreach (array_keys($this->extraFields) as $fieldName) {
- if (!in_array($fieldName, $extraFields, true)) {
+ if (!in_array($fieldName, $extraFields)) {
unset($this->extraFields[$fieldName]);
}
}
@@ -75,9 +74,9 @@ public function __construct(array|ArrayAccess|null $serverData = null, array|nul
}
/**
- * @inheritDoc
+ * {@inheritDoc}
*/
- public function __invoke(LogRecord $record): LogRecord
+ public function __invoke(array $record): array
{
// skip processing if for some reason request data
// is not present (CLI or wonky SAPIs)
@@ -85,14 +84,11 @@ public function __invoke(LogRecord $record): LogRecord
return $record;
}
- $record->extra = $this->appendExtraFields($record->extra);
+ $record['extra'] = $this->appendExtraFields($record['extra']);
return $record;
}
- /**
- * @return $this
- */
public function addExtraField(string $extraName, string $serverName): self
{
$this->extraFields[$extraName] = $serverName;
diff --git a/vendor/monolog/monolog/src/Monolog/Registry.php b/vendor/monolog/monolog/src/Monolog/Registry.php
index 2ef2edceb..ae94ae6cc 100644
--- a/vendor/monolog/monolog/src/Monolog/Registry.php
+++ b/vendor/monolog/monolog/src/Monolog/Registry.php
@@ -42,7 +42,7 @@ class Registry
*
* @var Logger[]
*/
- private static array $loggers = [];
+ private static $loggers = [];
/**
* Adds new logging channel to the registry
@@ -51,10 +51,11 @@ class Registry
* @param string|null $name Name of the logging channel ($logger->getName() by default)
* @param bool $overwrite Overwrite instance in the registry if the given name already exists?
* @throws \InvalidArgumentException If $overwrite set to false and named Logger instance already exists
+ * @return void
*/
- public static function addLogger(Logger $logger, ?string $name = null, bool $overwrite = false): void
+ public static function addLogger(Logger $logger, ?string $name = null, bool $overwrite = false)
{
- $name = $name ?? $logger->getName();
+ $name = $name ?: $logger->getName();
if (isset(self::$loggers[$name]) && !$overwrite) {
throw new InvalidArgumentException('Logger with the given name already exists');
@@ -109,7 +110,7 @@ public static function clear(): void
* @param string $name Name of the requested Logger instance
* @throws \InvalidArgumentException If named Logger instance is not in the registry
*/
- public static function getInstance(string $name): Logger
+ public static function getInstance($name): Logger
{
if (!isset(self::$loggers[$name])) {
throw new InvalidArgumentException(sprintf('Requested "%s" logger instance is not in the registry', $name));
@@ -126,7 +127,7 @@ public static function getInstance(string $name): Logger
* @throws \InvalidArgumentException If named Logger instance is not in the registry
* @return Logger Requested instance of Logger
*/
- public static function __callStatic(string $name, array $arguments): Logger
+ public static function __callStatic($name, $arguments)
{
return self::getInstance($name);
}
diff --git a/vendor/monolog/monolog/src/Monolog/ResettableInterface.php b/vendor/monolog/monolog/src/Monolog/ResettableInterface.php
index 4983a6b35..2c5fd7851 100644
--- a/vendor/monolog/monolog/src/Monolog/ResettableInterface.php
+++ b/vendor/monolog/monolog/src/Monolog/ResettableInterface.php
@@ -27,5 +27,8 @@
*/
interface ResettableInterface
{
- public function reset(): void;
+ /**
+ * @return void
+ */
+ public function reset();
}
diff --git a/vendor/monolog/monolog/src/Monolog/SignalHandler.php b/vendor/monolog/monolog/src/Monolog/SignalHandler.php
index b930ca439..d730eea3a 100644
--- a/vendor/monolog/monolog/src/Monolog/SignalHandler.php
+++ b/vendor/monolog/monolog/src/Monolog/SignalHandler.php
@@ -19,17 +19,21 @@
* Monolog POSIX signal handler
*
* @author Robert Gust-Bardon
+ *
+ * @phpstan-import-type Level from \Monolog\Logger
+ * @phpstan-import-type LevelName from \Monolog\Logger
*/
class SignalHandler
{
- private LoggerInterface $logger;
+ /** @var LoggerInterface */
+ private $logger;
/** @var array SIG_DFL, SIG_IGN or previous callable */
- private array $previousSignalHandler = [];
- /** @var array */
- private array $signalLevelMap = [];
+ private $previousSignalHandler = [];
+ /** @var array */
+ private $signalLevelMap = [];
/** @var array */
- private array $signalRestartSyscalls = [];
+ private $signalRestartSyscalls = [];
public function __construct(LoggerInterface $logger)
{
@@ -37,18 +41,21 @@ public function __construct(LoggerInterface $logger)
}
/**
- * @param int|string|Level $level Level or level name
+ * @param int|string $level Level or level name
+ * @param bool $callPrevious
+ * @param bool $restartSyscalls
+ * @param bool|null $async
* @return $this
*
- * @phpstan-param value-of|value-of|Level|LogLevel::* $level
+ * @phpstan-param Level|LevelName|LogLevel::* $level
*/
- public function registerSignalHandler(int $signo, int|string|Level $level = LogLevel::CRITICAL, bool $callPrevious = true, bool $restartSyscalls = true, ?bool $async = true): self
+ public function registerSignalHandler(int $signo, $level = LogLevel::CRITICAL, bool $callPrevious = true, bool $restartSyscalls = true, ?bool $async = true): self
{
if (!extension_loaded('pcntl') || !function_exists('pcntl_signal')) {
return $this;
}
- $level = Logger::toMonologLevel($level)->toPsrLogLevel();
+ $level = Logger::toMonologLevel($level);
if ($callPrevious) {
$handler = pcntl_signal_get_handler($signo);
@@ -73,12 +80,12 @@ public function registerSignalHandler(int $signo, int|string|Level $level = LogL
*/
public function handleSignal(int $signo, $siginfo = null): void
{
- /** @var array $signals */
static $signals = [];
- if (\count($signals) === 0 && extension_loaded('pcntl')) {
+ if (!$signals && extension_loaded('pcntl')) {
$pcntl = new ReflectionExtension('pcntl');
- foreach ($pcntl->getConstants() as $name => $value) {
+ // HHVM 3.24.2 returns an empty array.
+ foreach ($pcntl->getConstants() ?: get_defined_constants(true)['Core'] as $name => $value) {
if (substr($name, 0, 3) === 'SIG' && $name[3] !== '_' && is_int($value)) {
$signals[$value] = $name;
}
diff --git a/vendor/monolog/monolog/src/Monolog/Test/TestCase.php b/vendor/monolog/monolog/src/Monolog/Test/TestCase.php
index 29ec7c96e..bc0b425ea 100644
--- a/vendor/monolog/monolog/src/Monolog/Test/TestCase.php
+++ b/vendor/monolog/monolog/src/Monolog/Test/TestCase.php
@@ -11,18 +11,18 @@
namespace Monolog\Test;
-use Monolog\Level;
use Monolog\Logger;
-use Monolog\LogRecord;
use Monolog\DateTimeImmutable;
use Monolog\Formatter\FormatterInterface;
-use Psr\Log\LogLevel;
/**
* Lets you easily generate log records and a dummy formatter for testing purposes
*
* @author Jordi Boggiano
*
+ * @phpstan-import-type Record from \Monolog\Logger
+ * @phpstan-import-type Level from \Monolog\Logger
+ *
* @internal feel free to reuse this to test your own handlers, this is marked internal to avoid issues with PHPStorm https://github.com/Seldaek/monolog/issues/1677
*/
class TestCase extends \PHPUnit\Framework\TestCase
@@ -37,45 +37,48 @@ public function tearDown(): void
}
/**
- * @param array $context
- * @param array $extra
+ * @param mixed[] $context
+ *
+ * @return array Record
*
- * @phpstan-param value-of|value-of|Level|LogLevel::* $level
+ * @phpstan-param Level $level
+ * @phpstan-return Record
*/
- protected function getRecord(int|string|Level $level = Level::Warning, string|\Stringable $message = 'test', array $context = [], string $channel = 'test', \DateTimeImmutable $datetime = new DateTimeImmutable(true), array $extra = []): LogRecord
+ protected function getRecord(int $level = Logger::WARNING, string $message = 'test', array $context = []): array
{
- return new LogRecord(
- message: (string) $message,
- context: $context,
- level: Logger::toMonologLevel($level),
- channel: $channel,
- datetime: $datetime,
- extra: $extra,
- );
+ return [
+ 'message' => (string) $message,
+ 'context' => $context,
+ 'level' => $level,
+ 'level_name' => Logger::getLevelName($level),
+ 'channel' => 'test',
+ 'datetime' => new DateTimeImmutable(true),
+ 'extra' => [],
+ ];
}
/**
- * @phpstan-return list
+ * @phpstan-return Record[]
*/
protected function getMultipleRecords(): array
{
return [
- $this->getRecord(Level::Debug, 'debug message 1'),
- $this->getRecord(Level::Debug, 'debug message 2'),
- $this->getRecord(Level::Info, 'information'),
- $this->getRecord(Level::Warning, 'warning'),
- $this->getRecord(Level::Error, 'error'),
+ $this->getRecord(Logger::DEBUG, 'debug message 1'),
+ $this->getRecord(Logger::DEBUG, 'debug message 2'),
+ $this->getRecord(Logger::INFO, 'information'),
+ $this->getRecord(Logger::WARNING, 'warning'),
+ $this->getRecord(Logger::ERROR, 'error'),
];
}
protected function getIdentityFormatter(): FormatterInterface
{
$formatter = $this->createMock(FormatterInterface::class);
- $formatter->expects(self::any())
+ $formatter->expects($this->any())
->method('format')
- ->willReturnCallback(function ($record) {
- return $record->message;
- });
+ ->will($this->returnCallback(function ($record) {
+ return $record['message'];
+ }));
return $formatter;
}
diff --git a/vendor/monolog/monolog/src/Monolog/Utils.php b/vendor/monolog/monolog/src/Monolog/Utils.php
index 7848f0ecd..360c42199 100644
--- a/vendor/monolog/monolog/src/Monolog/Utils.php
+++ b/vendor/monolog/monolog/src/Monolog/Utils.php
@@ -122,7 +122,7 @@ public static function handleJsonError(int $code, $data, ?int $encodeFlags = nul
if (is_string($data)) {
self::detectAndCleanUtf8($data);
} elseif (is_array($data)) {
- array_walk_recursive($data, ['Monolog\Utils', 'detectAndCleanUtf8']);
+ array_walk_recursive($data, array('Monolog\Utils', 'detectAndCleanUtf8'));
} else {
self::throwEncodeError($code, $data);
}
@@ -165,16 +165,27 @@ public static function pcreLastErrorMessage(int $code): string
* @param int $code return code of json_last_error function
* @param mixed $data data that was meant to be encoded
* @throws \RuntimeException
+ *
+ * @return never
*/
- private static function throwEncodeError(int $code, $data): never
+ private static function throwEncodeError(int $code, $data): void
{
- $msg = match ($code) {
- JSON_ERROR_DEPTH => 'Maximum stack depth exceeded',
- JSON_ERROR_STATE_MISMATCH => 'Underflow or the modes mismatch',
- JSON_ERROR_CTRL_CHAR => 'Unexpected control character found',
- JSON_ERROR_UTF8 => 'Malformed UTF-8 characters, possibly incorrectly encoded',
- default => 'Unknown error',
- };
+ switch ($code) {
+ case JSON_ERROR_DEPTH:
+ $msg = 'Maximum stack depth exceeded';
+ break;
+ case JSON_ERROR_STATE_MISMATCH:
+ $msg = 'Underflow or the modes mismatch';
+ break;
+ case JSON_ERROR_CTRL_CHAR:
+ $msg = 'Unexpected control character found';
+ break;
+ case JSON_ERROR_UTF8:
+ $msg = 'Malformed UTF-8 characters, possibly incorrectly encoded';
+ break;
+ default:
+ $msg = 'Unknown error';
+ }
throw new \RuntimeException('JSON encoding failed: '.$msg.'. Encoding: '.var_export($data, true));
}
@@ -196,17 +207,16 @@ private static function throwEncodeError(int $code, $data): never
*/
private static function detectAndCleanUtf8(&$data): void
{
- if (is_string($data) && preg_match('//u', $data) !== 1) {
+ if (is_string($data) && !preg_match('//u', $data)) {
$data = preg_replace_callback(
'/[\x80-\xFF]+/',
- function (array $m): string {
+ function ($m) {
return function_exists('mb_convert_encoding') ? mb_convert_encoding($m[0], 'UTF-8', 'ISO-8859-1') : utf8_encode($m[0]);
},
$data
);
if (!is_string($data)) {
$pcreErrorCode = preg_last_error();
-
throw new \RuntimeException('Failed to preg_replace_callback: ' . $pcreErrorCode . ' / ' . self::pcreLastErrorMessage($pcreErrorCode));
}
$data = str_replace(
@@ -220,8 +230,8 @@ function (array $m): string {
/**
* Converts a string with a valid 'memory_limit' format, to bytes.
*
- * @param string|false $val
- * @return int|false Returns an integer representing bytes. Returns FALSE in case of error.
+ * @param string|false $val
+ * @return int|false Returns an integer representing bytes. Returns FALSE in case of error.
*/
public static function expandIniShorthandBytes($val)
{
@@ -234,7 +244,7 @@ public static function expandIniShorthandBytes($val)
return (int) $val;
}
- if (preg_match('/^\s*(?\d+)(?:\.\d+)?\s*(?[gmk]?)\s*$/i', $val, $match) !== 1) {
+ if (!preg_match('/^\s*(?\d+)(?:\.\d+)?\s*(?[gmk]?)\s*$/i', $val, $match)) {
return false;
}
@@ -242,10 +252,8 @@ public static function expandIniShorthandBytes($val)
switch (strtolower($match['unit'] ?? '')) {
case 'g':
$val *= 1024;
- // no break
case 'm':
$val *= 1024;
- // no break
case 'k':
$val *= 1024;
}
@@ -253,22 +261,24 @@ public static function expandIniShorthandBytes($val)
return $val;
}
- public static function getRecordMessageForException(LogRecord $record): string
+ /**
+ * @param array $record
+ */
+ public static function getRecordMessageForException(array $record): string
{
$context = '';
$extra = '';
-
try {
- if (\count($record->context) > 0) {
- $context = "\nContext: " . json_encode($record->context, JSON_THROW_ON_ERROR);
+ if ($record['context']) {
+ $context = "\nContext: " . json_encode($record['context']);
}
- if (\count($record->extra) > 0) {
- $extra = "\nExtra: " . json_encode($record->extra, JSON_THROW_ON_ERROR);
+ if ($record['extra']) {
+ $extra = "\nExtra: " . json_encode($record['extra']);
}
} catch (\Throwable $e) {
// noop
}
- return "\nThe exception occurred while attempting to log: " . $record->message . $context . $extra;
+ return "\nThe exception occurred while attempting to log: " . $record['message'] . $context . $extra;
}
}
diff --git a/vendor/psr/log/composer.json b/vendor/psr/log/composer.json
index 879fc6f53..ca0569537 100644
--- a/vendor/psr/log/composer.json
+++ b/vendor/psr/log/composer.json
@@ -11,16 +11,16 @@
}
],
"require": {
- "php": ">=8.0.0"
+ "php": ">=5.3.0"
},
"autoload": {
"psr-4": {
- "Psr\\Log\\": "src"
+ "Psr\\Log\\": "Psr/Log/"
}
},
"extra": {
"branch-alias": {
- "dev-master": "3.x-dev"
+ "dev-master": "1.1.x-dev"
}
}
}
diff --git a/vendor/ramsey/collection/composer.json b/vendor/ramsey/collection/composer.json
index 56709015a..f09106a15 100644
--- a/vendor/ramsey/collection/composer.json
+++ b/vendor/ramsey/collection/composer.json
@@ -19,7 +19,8 @@
}
],
"require": {
- "php": "^8.1"
+ "php": "^7.4 || ^8.0",
+ "symfony/polyfill-php81": "^1.23"
},
"require-dev": {
"captainhook/plugin-composer": "^5.3",
diff --git a/vendor/ramsey/collection/src/AbstractArray.php b/vendor/ramsey/collection/src/AbstractArray.php
index 5ce622aa7..9b39dd0cb 100644
--- a/vendor/ramsey/collection/src/AbstractArray.php
+++ b/vendor/ramsey/collection/src/AbstractArray.php
@@ -18,6 +18,8 @@
use Traversable;
use function count;
+use function serialize;
+use function unserialize;
/**
* This class provides a basic implementation of `ArrayInterface`, to minimize
@@ -68,7 +70,7 @@ public function getIterator(): Traversable
*
* @param array-key $offset The offset to check.
*/
- public function offsetExists(mixed $offset): bool
+ public function offsetExists($offset): bool
{
return isset($this->data[$offset]);
}
@@ -80,12 +82,13 @@ public function offsetExists(mixed $offset): bool
*
* @param array-key $offset The offset for which a value should be returned.
*
- * @return T the value stored at the offset, or null if the offset
+ * @return T|null the value stored at the offset, or null if the offset
* does not exist.
*/
- public function offsetGet(mixed $offset): mixed
+ #[\ReturnTypeWillChange] // phpcs:ignore
+ public function offsetGet($offset)
{
- return $this->data[$offset];
+ return $this->data[$offset] ?? null;
}
/**
@@ -93,11 +96,12 @@ public function offsetGet(mixed $offset): mixed
*
* @link http://php.net/manual/en/arrayaccess.offsetset.php ArrayAccess::offsetSet()
*
- * @param array-key | null $offset The offset to set. If `null`, the value
- * may be set at a numerically-indexed offset.
+ * @param array-key|null $offset The offset to set. If `null`, the value may be
+ * set at a numerically-indexed offset.
* @param T $value The value to set at the given offset.
*/
- public function offsetSet(mixed $offset, mixed $value): void
+ // phpcs:ignore SlevomatCodingStandard.TypeHints.ParameterTypeHint.MissingNativeTypeHint
+ public function offsetSet($offset, $value): void
{
if ($offset === null) {
$this->data[] = $value;
@@ -113,11 +117,25 @@ public function offsetSet(mixed $offset, mixed $value): void
*
* @param array-key $offset The offset to remove from the array.
*/
- public function offsetUnset(mixed $offset): void
+ public function offsetUnset($offset): void
{
unset($this->data[$offset]);
}
+ /**
+ * Returns a serialized string representation of this array object.
+ *
+ * @deprecated The Serializable interface will go away in PHP 9.
+ *
+ * @link http://php.net/manual/en/serializable.serialize.php Serializable::serialize()
+ *
+ * @return string a PHP serialized string.
+ */
+ public function serialize(): string
+ {
+ return serialize($this->data);
+ }
+
/**
* Returns data suitable for PHP serialization.
*
@@ -131,6 +149,25 @@ public function __serialize(): array
return $this->data;
}
+ /**
+ * Converts a serialized string representation into an instance object.
+ *
+ * @deprecated The Serializable interface will go away in PHP 9.
+ *
+ * @link http://php.net/manual/en/serializable.unserialize.php Serializable::unserialize()
+ *
+ * @param string $serialized A PHP serialized string to unserialize.
+ *
+ * @phpcsSuppress SlevomatCodingStandard.TypeHints.ParameterTypeHint.MissingNativeTypeHint
+ */
+ public function unserialize($serialized): void
+ {
+ /** @var array $data */
+ $data = unserialize($serialized, ['allowed_classes' => false]);
+
+ $this->data = $data;
+ }
+
/**
* Adds unserialized data to the object.
*
@@ -166,6 +203,6 @@ public function toArray(): array
public function isEmpty(): bool
{
- return $this->data === [];
+ return count($this->data) === 0;
}
}
diff --git a/vendor/ramsey/collection/src/AbstractCollection.php b/vendor/ramsey/collection/src/AbstractCollection.php
index 8cb21ec02..38ef7144c 100644
--- a/vendor/ramsey/collection/src/AbstractCollection.php
+++ b/vendor/ramsey/collection/src/AbstractCollection.php
@@ -17,27 +17,27 @@
use Closure;
use Ramsey\Collection\Exception\CollectionMismatchException;
use Ramsey\Collection\Exception\InvalidArgumentException;
-use Ramsey\Collection\Exception\InvalidPropertyOrMethod;
-use Ramsey\Collection\Exception\NoSuchElementException;
-use Ramsey\Collection\Exception\UnsupportedOperationException;
+use Ramsey\Collection\Exception\InvalidSortOrderException;
+use Ramsey\Collection\Exception\OutOfBoundsException;
use Ramsey\Collection\Tool\TypeTrait;
use Ramsey\Collection\Tool\ValueExtractorTrait;
use Ramsey\Collection\Tool\ValueToStringTrait;
use function array_filter;
-use function array_key_first;
-use function array_key_last;
use function array_map;
use function array_merge;
-use function array_reduce;
use function array_search;
use function array_udiff;
use function array_uintersect;
+use function current;
+use function end;
use function in_array;
use function is_int;
use function is_object;
+use function reset;
use function spl_object_id;
use function sprintf;
+use function unserialize;
use function usort;
/**
@@ -55,24 +55,27 @@ abstract class AbstractCollection extends AbstractArray implements CollectionInt
use ValueExtractorTrait;
/**
- * @throws InvalidArgumentException if $element is of the wrong type.
+ * @inheritDoc
*/
- public function add(mixed $element): bool
+ public function add($element): bool
{
$this[] = $element;
return true;
}
- public function contains(mixed $element, bool $strict = true): bool
+ /**
+ * @inheritDoc
+ */
+ public function contains($element, bool $strict = true): bool
{
return in_array($element, $this->data, $strict);
}
/**
- * @throws InvalidArgumentException if $element is of the wrong type.
+ * @inheritDoc
*/
- public function offsetSet(mixed $offset, mixed $value): void
+ public function offsetSet($offset, $value): void
{
if ($this->checkType($this->getType(), $value) === false) {
throw new InvalidArgumentException(
@@ -88,7 +91,10 @@ public function offsetSet(mixed $offset, mixed $value): void
}
}
- public function remove(mixed $element): bool
+ /**
+ * @inheritDoc
+ */
+ public function remove($element): bool
{
if (($position = array_search($element, $this->data, true)) !== false) {
unset($this[$position]);
@@ -100,11 +106,6 @@ public function remove(mixed $element): bool
}
/**
- * @throws InvalidPropertyOrMethod if the $propertyOrMethod does not exist
- * on the elements in this collection.
- * @throws UnsupportedOperationException if unable to call column() on this
- * collection.
- *
* @inheritDoc
*/
public function column(string $propertyOrMethod): array
@@ -112,55 +113,55 @@ public function column(string $propertyOrMethod): array
$temp = [];
foreach ($this->data as $item) {
+ /** @var mixed $value */
+ $value = $this->extractValue($item, $propertyOrMethod);
+
/** @psalm-suppress MixedAssignment */
- $temp[] = $this->extractValue($item, $propertyOrMethod);
+ $temp[] = $value;
}
return $temp;
}
/**
- * @return T
- *
- * @throws NoSuchElementException if this collection is empty.
+ * @inheritDoc
*/
- public function first(): mixed
+ public function first()
{
- $firstIndex = array_key_first($this->data);
-
- if ($firstIndex === null) {
- throw new NoSuchElementException('Can\'t determine first item. Collection is empty');
+ if ($this->isEmpty()) {
+ throw new OutOfBoundsException('Can\'t determine first item. Collection is empty');
}
- return $this->data[$firstIndex];
+ reset($this->data);
+
+ /** @var T $first */
+ $first = current($this->data);
+
+ return $first;
}
/**
- * @return T
- *
- * @throws NoSuchElementException if this collection is empty.
+ * @inheritDoc
*/
- public function last(): mixed
+ public function last()
{
- $lastIndex = array_key_last($this->data);
-
- if ($lastIndex === null) {
- throw new NoSuchElementException('Can\'t determine last item. Collection is empty');
+ if ($this->isEmpty()) {
+ throw new OutOfBoundsException('Can\'t determine last item. Collection is empty');
}
- return $this->data[$lastIndex];
+ /** @var T $item */
+ $item = end($this->data);
+ reset($this->data);
+
+ return $item;
}
- /**
- * @return CollectionInterface
- *
- * @throws InvalidPropertyOrMethod if the $propertyOrMethod does not exist
- * on the elements in this collection.
- * @throws UnsupportedOperationException if unable to call sort() on this
- * collection.
- */
- public function sort(?string $propertyOrMethod = null, Sort $order = Sort::Ascending): CollectionInterface
+ public function sort(string $propertyOrMethod, string $order = self::SORT_ASC): CollectionInterface
{
+ if (!in_array($order, [self::SORT_ASC, self::SORT_DESC], true)) {
+ throw new InvalidSortOrderException('Invalid sort order given: ' . $order);
+ }
+
$collection = clone $this;
usort(
@@ -169,25 +170,20 @@ public function sort(?string $propertyOrMethod = null, Sort $order = Sort::Ascen
* @param T $a
* @param T $b
*/
- function (mixed $a, mixed $b) use ($propertyOrMethod, $order): int {
+ function ($a, $b) use ($propertyOrMethod, $order): int {
/** @var mixed $aValue */
$aValue = $this->extractValue($a, $propertyOrMethod);
/** @var mixed $bValue */
$bValue = $this->extractValue($b, $propertyOrMethod);
- return ($aValue <=> $bValue) * ($order === Sort::Descending ? -1 : 1);
+ return ($aValue <=> $bValue) * ($order === self::SORT_DESC ? -1 : 1);
},
);
return $collection;
}
- /**
- * @param callable(T): bool $callback A callable to use for filtering elements.
- *
- * @return CollectionInterface
- */
public function filter(callable $callback): CollectionInterface
{
$collection = clone $this;
@@ -197,66 +193,23 @@ public function filter(callable $callback): CollectionInterface
}
/**
- * @return CollectionInterface
- *
- * @throws InvalidPropertyOrMethod if the $propertyOrMethod does not exist
- * on the elements in this collection.
- * @throws UnsupportedOperationException if unable to call where() on this
- * collection.
+ * {@inheritdoc}
*/
- public function where(?string $propertyOrMethod, mixed $value): CollectionInterface
+ public function where(string $propertyOrMethod, $value): CollectionInterface
{
- return $this->filter(
- /**
- * @param T $item
- */
- function (mixed $item) use ($propertyOrMethod, $value): bool {
- /** @var mixed $accessorValue */
- $accessorValue = $this->extractValue($item, $propertyOrMethod);
+ return $this->filter(function ($item) use ($propertyOrMethod, $value) {
+ /** @var mixed $accessorValue */
+ $accessorValue = $this->extractValue($item, $propertyOrMethod);
- return $accessorValue === $value;
- },
- );
+ return $accessorValue === $value;
+ });
}
- /**
- * @param callable(T): TCallbackReturn $callback A callable to apply to each
- * item of the collection.
- *
- * @return CollectionInterface
- *
- * @template TCallbackReturn
- */
public function map(callable $callback): CollectionInterface
{
- /** @var Collection */
return new Collection('mixed', array_map($callback, $this->data));
}
- /**
- * @param callable(TCarry, T): TCarry $callback A callable to apply to each
- * item of the collection to reduce it to a single value.
- * @param TCarry $initial This is the initial value provided to the callback.
- *
- * @return TCarry
- *
- * @template TCarry
- */
- public function reduce(callable $callback, mixed $initial): mixed
- {
- /** @var TCarry */
- return array_reduce($this->data, $callback, $initial);
- }
-
- /**
- * @param CollectionInterface $other The collection to check for divergent
- * items.
- *
- * @return CollectionInterface
- *
- * @throws CollectionMismatchException if the compared collections are of
- * differing types.
- */
public function diff(CollectionInterface $other): CollectionInterface
{
$this->compareCollectionTypes($other);
@@ -273,15 +226,6 @@ public function diff(CollectionInterface $other): CollectionInterface
return $collection;
}
- /**
- * @param CollectionInterface $other The collection to check for
- * intersecting items.
- *
- * @return CollectionInterface
- *
- * @throws CollectionMismatchException if the compared collections are of
- * differing types.
- */
public function intersect(CollectionInterface $other): CollectionInterface
{
$this->compareCollectionTypes($other);
@@ -295,15 +239,6 @@ public function intersect(CollectionInterface $other): CollectionInterface
return $collection;
}
- /**
- * @param CollectionInterface ...$collections The collections to merge.
- *
- * @return CollectionInterface
- *
- * @throws CollectionMismatchException if unable to merge any of the given
- * collections or items within the given collections due to type
- * mismatch errors.
- */
public function merge(CollectionInterface ...$collections): CollectionInterface
{
$mergedCollection = clone $this;
@@ -339,10 +274,19 @@ public function merge(CollectionInterface ...$collections): CollectionInterface
return $mergedCollection;
}
+ /**
+ * @inheritDoc
+ */
+ public function unserialize($serialized): void
+ {
+ /** @var array $data */
+ $data = unserialize($serialized, ['allowed_classes' => [$this->getType()]]);
+
+ $this->data = $data;
+ }
+
/**
* @param CollectionInterface $other
- *
- * @throws CollectionMismatchException
*/
private function compareCollectionTypes(CollectionInterface $other): void
{
@@ -363,7 +307,7 @@ private function getComparator(): Closure
* @param T $a
* @param T $b
*/
- function (mixed $a, mixed $b): int {
+ function ($a, $b): int {
// If the two values are object, we convert them to unique scalars.
// If the collection contains mixed values (unlikely) where some are objects
// and some are not, we leave them as they are.
@@ -383,11 +327,15 @@ function (mixed $a, mixed $b): int {
*/
private function getUniformType(CollectionInterface $collection): string
{
- return match ($collection->getType()) {
- 'integer' => 'int',
- 'boolean' => 'bool',
- 'double' => 'float',
- default => $collection->getType(),
- };
+ switch ($collection->getType()) {
+ case 'integer':
+ return 'int';
+ case 'boolean':
+ return 'bool';
+ case 'double':
+ return 'float';
+ default:
+ return $collection->getType();
+ }
}
}
diff --git a/vendor/ramsey/collection/src/AbstractSet.php b/vendor/ramsey/collection/src/AbstractSet.php
index 7186939d7..1126ccb0a 100644
--- a/vendor/ramsey/collection/src/AbstractSet.php
+++ b/vendor/ramsey/collection/src/AbstractSet.php
@@ -24,7 +24,10 @@
*/
abstract class AbstractSet extends AbstractCollection
{
- public function add(mixed $element): bool
+ /**
+ * @inheritDoc
+ */
+ public function add($element): bool
{
if ($this->contains($element)) {
return false;
@@ -33,7 +36,10 @@ public function add(mixed $element): bool
return parent::add($element);
}
- public function offsetSet(mixed $offset, mixed $value): void
+ /**
+ * @inheritDoc
+ */
+ public function offsetSet($offset, $value): void
{
if ($this->contains($value)) {
return;
diff --git a/vendor/ramsey/collection/src/ArrayInterface.php b/vendor/ramsey/collection/src/ArrayInterface.php
index bc7f6f424..27af6102b 100644
--- a/vendor/ramsey/collection/src/ArrayInterface.php
+++ b/vendor/ramsey/collection/src/ArrayInterface.php
@@ -17,6 +17,7 @@
use ArrayAccess;
use Countable;
use IteratorAggregate;
+use Serializable;
/**
* `ArrayInterface` provides traversable array functionality to data types.
@@ -28,7 +29,8 @@
interface ArrayInterface extends
ArrayAccess,
Countable,
- IteratorAggregate
+ IteratorAggregate,
+ Serializable
{
/**
* Removes all items from this array.
diff --git a/vendor/ramsey/collection/src/Collection.php b/vendor/ramsey/collection/src/Collection.php
index 44d26bf2e..532b971b6 100644
--- a/vendor/ramsey/collection/src/Collection.php
+++ b/vendor/ramsey/collection/src/Collection.php
@@ -75,16 +75,25 @@
*/
class Collection extends AbstractCollection
{
+ /**
+ * The type of elements stored in this collection.
+ *
+ * A collection's type is immutable once it is set. For this reason, this
+ * property is set private.
+ */
+ private string $collectionType;
+
/**
* Constructs a collection object of the specified type, optionally with the
* specified data.
*
- * @param string $collectionType The type or class name associated with this
+ * @param string $collectionType The type (FQCN) associated with this
* collection.
* @param array $data The initial items to store in the collection.
*/
- public function __construct(private readonly string $collectionType, array $data = [])
+ public function __construct(string $collectionType, array $data = [])
{
+ $this->collectionType = $collectionType;
parent::__construct($data);
}
diff --git a/vendor/ramsey/collection/src/CollectionInterface.php b/vendor/ramsey/collection/src/CollectionInterface.php
index e3ad01470..9f86a2837 100644
--- a/vendor/ramsey/collection/src/CollectionInterface.php
+++ b/vendor/ramsey/collection/src/CollectionInterface.php
@@ -14,14 +14,8 @@
namespace Ramsey\Collection;
-use Ramsey\Collection\Exception\CollectionMismatchException;
-use Ramsey\Collection\Exception\InvalidArgumentException;
-use Ramsey\Collection\Exception\InvalidPropertyOrMethod;
-use Ramsey\Collection\Exception\NoSuchElementException;
-use Ramsey\Collection\Exception\UnsupportedOperationException;
-
/**
- * A collection represents a group of values, known as its elements.
+ * A collection represents a group of objects, known as its elements.
*
* Some collections allow duplicate elements and others do not. Some are ordered
* and others unordered.
@@ -31,6 +25,16 @@
*/
interface CollectionInterface extends ArrayInterface
{
+ /**
+ * Ascending sort type.
+ */
+ public const SORT_ASC = 'asc';
+
+ /**
+ * Descending sort type.
+ */
+ public const SORT_DESC = 'desc';
+
/**
* Ensures that this collection contains the specified element (optional
* operation).
@@ -54,11 +58,9 @@ interface CollectionInterface extends ArrayInterface
* @param T $element The element to add to the collection.
*
* @return bool `true` if this collection changed as a result of the call.
- *
- * @throws InvalidArgumentException if the collection refuses to add the
- * $element for any reason other than that it already contains the element.
*/
- public function add(mixed $element): bool;
+ // phpcs:ignore SlevomatCodingStandard.TypeHints.ParameterTypeHint.MissingNativeTypeHint
+ public function add($element): bool;
/**
* Returns `true` if this collection contains the specified element.
@@ -66,7 +68,8 @@ public function add(mixed $element): bool;
* @param T $element The element to check whether the collection contains.
* @param bool $strict Whether to perform a strict type check on the value.
*/
- public function contains(mixed $element, bool $strict = true): bool;
+ // phpcs:ignore SlevomatCodingStandard.TypeHints.ParameterTypeHint.MissingNativeTypeHint
+ public function contains($element, bool $strict = true): bool;
/**
* Returns the type associated with this collection.
@@ -81,20 +84,15 @@ public function getType(): string;
*
* @return bool `true` if an element was removed as a result of this call.
*/
- public function remove(mixed $element): bool;
+ // phpcs:ignore SlevomatCodingStandard.TypeHints.ParameterTypeHint.MissingNativeTypeHint
+ public function remove($element): bool;
/**
- * Returns the values from the given property, method, or array key.
- *
- * @param string $propertyOrMethod The name of the property, method, or
- * array key to evaluate and return.
+ * Returns the values from the given property or method.
*
- * @return array
+ * @param string $propertyOrMethod The property or method name to filter by.
*
- * @throws InvalidPropertyOrMethod if the $propertyOrMethod does not exist
- * on the elements in this collection.
- * @throws UnsupportedOperationException if unable to call column() on this
- * collection.
+ * @return list