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

Add scalar types to processor/formatters and top level classes

This commit is contained in:
Jordi Boggiano
2016-09-25 21:23:35 +02:00
parent 760dc44ebd
commit 6e6586257d
29 changed files with 130 additions and 196 deletions

View File

@@ -20,7 +20,7 @@ class UidProcessor
{
private $uid;
public function __construct($length = 7)
public function __construct(int $length = 7)
{
if (!is_int($length) || $length > 32 || $length < 1) {
throw new \InvalidArgumentException('The uid length must be an integer between 1 and 32');
@@ -29,7 +29,7 @@ class UidProcessor
$this->uid = substr(hash('md5', uniqid('', true)), 0, $length);
}
public function __invoke(array $record)
public function __invoke(array $record): array
{
$record['extra']['uid'] = $this->uid;
@@ -39,7 +39,7 @@ class UidProcessor
/**
* @return string
*/
public function getUid()
public function getUid(): string
{
return $this->uid;
}