typehints for Exception

This commit is contained in:
Ivan Fedorov 2021-07-02 18:06:58 +03:00 committed by Ivan Fedorov
parent d18c6d8669
commit eb1f815f36
1 changed files with 18 additions and 3 deletions

View File

@ -280,7 +280,11 @@ class Exception implements Throwable
* @param null|Throwable $previous [optional] The previous throwable used for the exception chaining.
*/
#[Pure]
public function __construct($message = "", $code = 0, Throwable $previous = null) {}
public function __construct(
#[LanguageLevelTypeAware(['8.0' => 'string'], default: '')] $message = "",
#[LanguageLevelTypeAware(['8.0' => 'int'], default: '')] $code = 0,
#[LanguageLevelTypeAware(['8.0' => 'Throwable|null'], default: 'Throwable')] $previous = null
) {}
/**
* Gets the Exception message
@ -378,7 +382,11 @@ class Error implements Throwable
* @param null|Throwable $previous [optional] The previous throwable used for the exception chaining.
*/
#[Pure]
public function __construct($message = "", $code = 0, Throwable $previous = null) {}
public function __construct(
#[LanguageLevelTypeAware(['8.0' => 'string'], default: '')] $message = "",
#[LanguageLevelTypeAware(['8.0' => 'int'], default: '')] $code = 0,
#[LanguageLevelTypeAware(['8.0' => 'Throwable|null'], default: 'Throwable')] $previous = null
) {}
/***
* Gets the message
@ -539,7 +547,14 @@ class ErrorException extends Exception
* @param Exception $previous [optional] The previous exception used for the exception chaining.
*/
#[\JetBrains\PhpStorm\Pure]
public function __construct($message = "", $code = 0, $severity = 1, $filename = __FILE__, $line = __LINE__, $previous = null) {}
public function __construct(
#[LanguageLevelTypeAware(['8.0' => 'string'], default: '')] $message = "",
#[LanguageLevelTypeAware(['8.0' => 'int'], default: '')] $code = 0,
#[LanguageLevelTypeAware(['8.0' => 'int'], default: '')] $severity = 1,
#[LanguageLevelTypeAware(['8.0' => 'string|null'], default: '')] $filename = __FILE__,
#[LanguageLevelTypeAware(['8.0' => 'int|null'], default: '')] $line = __LINE__,
#[LanguageLevelTypeAware(['8.0' => 'Throwable|null'], default: 'Throwable')] $previous = null
) {}
/**
* Gets the exception severity