Просмотр исходного кода

Use never return typehint (#1654)

The `never` return typehint was added in PHP 8.1 and can be used
to indicate that a function will never return.

RFC: https://wiki.php.net/rfc/noreturn_type
Dan Hemberger 3 лет назад
Родитель
Сommit
14f39fe0ce
2 измененных файлов с 2 добавлено и 7 удалено
  1. 1 4
      src/Monolog/ErrorHandler.php
  2. 1 3
      src/Monolog/Utils.php

+ 1 - 4
src/Monolog/ErrorHandler.php

@@ -175,10 +175,7 @@ class ErrorHandler
         ];
     }
 
-    /**
-     * @phpstan-return never
-     */
-    private function handleException(\Throwable $e): void
+    private function handleException(\Throwable $e): never
     {
         $level = LogLevel::ERROR;
         foreach ($this->uncaughtExceptionLevelMap as $class => $candidate) {

+ 1 - 3
src/Monolog/Utils.php

@@ -165,10 +165,8 @@ final class Utils
      * @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): void
+    private static function throwEncodeError(int $code, $data): never
     {
         switch ($code) {
             case JSON_ERROR_DEPTH: