diff --git a/src/Symfony/Component/Debug/Debug.php b/src/Symfony/Component/Debug/Debug.php index 5d2d55cf9f021..329d50c7e3e50 100644 --- a/src/Symfony/Component/Debug/Debug.php +++ b/src/Symfony/Component/Debug/Debug.php @@ -28,7 +28,7 @@ class Debug * @param int $errorReportingLevel The level of error reporting you want * @param bool $displayErrors Whether to display errors (for development) or just log them (for production) */ - public static function enable($errorReportingLevel = E_ALL, $displayErrors = true) + public static function enable(int $errorReportingLevel = E_ALL, bool $displayErrors = true) { if (static::$enabled) { return; diff --git a/src/Symfony/Component/Debug/DebugClassLoader.php b/src/Symfony/Component/Debug/DebugClassLoader.php index ff9a8d72f903f..0bee58783af1d 100644 --- a/src/Symfony/Component/Debug/DebugClassLoader.php +++ b/src/Symfony/Component/Debug/DebugClassLoader.php @@ -129,9 +129,9 @@ public static function disable() } /** - * @return string|null + * @param string $class */ - public function findFile($class) + public function findFile(string $class) { return $this->isFinder ? $this->classLoader[0]->findFile($class) ?: null : null; } @@ -139,11 +139,9 @@ public function findFile($class) /** * Loads the given class or interface. * - * @param string $class The name of the class - * * @throws \RuntimeException */ - public function loadClass($class) + public function loadClass(string $class) { $e = error_reporting(error_reporting() | E_PARSE | E_ERROR | E_CORE_ERROR | E_COMPILE_ERROR); diff --git a/src/Symfony/Component/Debug/ErrorHandler.php b/src/Symfony/Component/Debug/ErrorHandler.php index a99a000b07fa9..bfe948713f743 100644 --- a/src/Symfony/Component/Debug/ErrorHandler.php +++ b/src/Symfony/Component/Debug/ErrorHandler.php @@ -176,7 +176,7 @@ public function __construct(BufferingLogger $bootstrappingLogger = null) * @param array|int $levels An array map of E_* to LogLevel::* or an integer bit field of E_* constants * @param bool $replace Whether to replace or not any existing logger */ - public function setDefaultLogger(LoggerInterface $logger, $levels = E_ALL, $replace = false) + public function setDefaultLogger(LoggerInterface $logger, $levels = E_ALL, bool $replace = false) { $loggers = []; @@ -526,7 +526,7 @@ public function handleError($type, $message, $file, $line) * * @internal */ - public function handleException($exception, array $error = null) + public function handleException(\Throwable $exception, array $error = null) { if (null === $error) { self::$exitCode = 255; diff --git a/src/Symfony/Component/Debug/Exception/FlattenException.php b/src/Symfony/Component/Debug/Exception/FlattenException.php index eaed1f1fa6f90..d371a16a90ff9 100644 --- a/src/Symfony/Component/Debug/Exception/FlattenException.php +++ b/src/Symfony/Component/Debug/Exception/FlattenException.php @@ -103,7 +103,7 @@ public function getStatusCode() /** * @return $this */ - public function setStatusCode($code) + public function setStatusCode(int $code) { $this->statusCode = $code; @@ -133,7 +133,7 @@ public function getClass() /** * @return $this */ - public function setClass($class) + public function setClass(string $class) { $this->class = 'c' === $class[0] && 0 === strpos($class, "class@anonymous\0") ? get_parent_class($class).'@anonymous' : $class; @@ -148,7 +148,7 @@ public function getFile() /** * @return $this */ - public function setFile($file) + public function setFile(string $file) { $this->file = $file; @@ -163,7 +163,7 @@ public function getLine() /** * @return $this */ - public function setLine($line) + public function setLine(int $line) { $this->line = $line; @@ -178,7 +178,7 @@ public function getMessage() /** * @return $this */ - public function setMessage($message) + public function setMessage(string $message) { if (false !== strpos($message, "class@anonymous\0")) { $message = preg_replace_callback('/class@anonymous\x00.*?\.php0x?[0-9a-fA-F]++/', function ($m) { @@ -199,7 +199,7 @@ public function getCode() /** * @return $this */ - public function setCode($code) + public function setCode(int $code) { $this->code = $code; @@ -257,7 +257,7 @@ public function setTraceFromThrowable(\Throwable $throwable) /** * @return $this */ - public function setTrace($trace, $file, $line) + public function setTrace(array $trace, string $file, int $line) { $this->trace = []; $this->trace[] = [ @@ -294,7 +294,7 @@ public function setTrace($trace, $file, $line) return $this; } - private function flattenArgs($args, $level = 0, &$count = 0) + private function flattenArgs(array $args, int $level = 0, int &$count = 0) { $result = []; foreach ($args as $key => $value) { diff --git a/src/Symfony/Component/Debug/ExceptionHandler.php b/src/Symfony/Component/Debug/ExceptionHandler.php index e36610c82e14a..5bea8a5f1cbf1 100644 --- a/src/Symfony/Component/Debug/ExceptionHandler.php +++ b/src/Symfony/Component/Debug/ExceptionHandler.php @@ -60,11 +60,11 @@ public function __construct(bool $debug = true, string $charset = null, $fileLin * * @param bool $debug Enable/disable debug mode, where the stack trace is displayed * @param string|null $charset The charset used by exception messages - * @param string|null $fileLinkFormat The IDE link template + * @param string|FileLinkFormatter|null $fileLinkFormat The IDE link template * * @return static */ - public static function register($debug = true, $charset = null, $fileLinkFormat = null) + public static function register(bool $debug = true, string $charset = null, $fileLinkFormat = null) { $handler = new static($debug, $charset, $fileLinkFormat);