1
0
mirror of https://github.com/Seldaek/monolog.git synced 2025-08-08 14:16:42 +02:00

Added some type hints

This commit is contained in:
Jordi Boggiano
2018-11-04 19:47:01 +01:00
parent c5bba4ac64
commit 36b767dc02
3 changed files with 5 additions and 5 deletions

View File

@@ -52,7 +52,7 @@ class Registry
* @param bool $overwrite Overwrite instance in the registry if the given name already exists? * @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 * @throws \InvalidArgumentException If $overwrite set to false and named Logger instance already exists
*/ */
public static function addLogger(Logger $logger, $name = null, $overwrite = false) public static function addLogger(Logger $logger, ?string $name = null, bool $overwrite = false)
{ {
$name = $name ?: $logger->getName(); $name = $name ?: $logger->getName();
@@ -84,7 +84,7 @@ class Registry
* *
* @param string|Logger $logger Name or logger instance * @param string|Logger $logger Name or logger instance
*/ */
public static function removeLogger($logger) public static function removeLogger($logger): void
{ {
if ($logger instanceof Logger) { if ($logger instanceof Logger) {
if (false !== ($idx = array_search($logger, self::$loggers, true))) { if (false !== ($idx = array_search($logger, self::$loggers, true))) {
@@ -98,7 +98,7 @@ class Registry
/** /**
* Clears the registry * Clears the registry
*/ */
public static function clear() public static function clear(): void
{ {
self::$loggers = []; self::$loggers = [];
} }

View File

@@ -33,7 +33,7 @@ class SignalHandler
$this->logger = $logger; $this->logger = $logger;
} }
public function registerSignalHandler($signo, $level = LogLevel::CRITICAL, $callPrevious = true, $restartSyscalls = true, $async = true) public function registerSignalHandler($signo, $level = LogLevel::CRITICAL, bool $callPrevious = true, bool $restartSyscalls = true, bool $async = true): self
{ {
if (!extension_loaded('pcntl') || !function_exists('pcntl_signal')) { if (!extension_loaded('pcntl') || !function_exists('pcntl_signal')) {
return $this; return $this;

View File

@@ -16,7 +16,7 @@ class Utils
/** /**
* @internal * @internal
*/ */
public static function getClass($object) public static function getClass($object): string
{ {
$class = \get_class($object); $class = \get_class($object);