1
0
mirror of https://github.com/Seldaek/monolog.git synced 2025-10-20 08:06:19 +02:00

Add Record/Level/LevelName type aliases and improve phpstan type coverage to level 6

This commit is contained in:
Jordi Boggiano
2021-05-28 10:29:33 +02:00
parent 5c9d9bf43e
commit 01d104aa78
88 changed files with 791 additions and 180 deletions

View File

@@ -21,8 +21,10 @@ use Monolog\Logger;
*/
class GitProcessor implements ProcessorInterface
{
/** @var int */
private $level;
private static $cache;
/** @var array{branch: string, commit: string}|array<never>|null */
private static $cache = null;
/**
* @param string|int $level The minimum logging level at which this Processor will be triggered
@@ -32,6 +34,9 @@ class GitProcessor implements ProcessorInterface
$this->level = Logger::toMonologLevel($level);
}
/**
* {@inheritDoc}
*/
public function __invoke(array $record): array
{
// return if the level is not high enough
@@ -44,6 +49,9 @@ class GitProcessor implements ProcessorInterface
return $record;
}
/**
* @return array{branch: string, commit: string}|array<never>
*/
private static function getGitInfo(): array
{
if (self::$cache) {