Ver Fonte

Added some type hints

Jordi Boggiano há 7 anos atrás
pai
commit
36b767dc02
3 ficheiros alterados com 5 adições e 5 exclusões
  1. 3 3
      src/Monolog/Registry.php
  2. 1 1
      src/Monolog/SignalHandler.php
  3. 1 1
      src/Monolog/Utils.php

+ 3 - 3
src/Monolog/Registry.php

@@ -52,7 +52,7 @@ class Registry
      * @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
      */
-    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();
 
@@ -84,7 +84,7 @@ class Registry
      *
      * @param string|Logger $logger Name or logger instance
      */
-    public static function removeLogger($logger)
+    public static function removeLogger($logger): void
     {
         if ($logger instanceof Logger) {
             if (false !== ($idx = array_search($logger, self::$loggers, true))) {
@@ -98,7 +98,7 @@ class Registry
     /**
      * Clears the registry
      */
-    public static function clear()
+    public static function clear(): void
     {
         self::$loggers = [];
     }

+ 1 - 1
src/Monolog/SignalHandler.php

@@ -33,7 +33,7 @@ class SignalHandler
         $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')) {
             return $this;

+ 1 - 1
src/Monolog/Utils.php

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