ExceptionDetails now accepts a string as a type for the $line and $code parameter, this will automatically
convert the string to an integer.
This commit is contained in:
parent
61be8c6d73
commit
418353b579
2 changed files with 8 additions and 3 deletions
|
@ -10,7 +10,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
|
|||
Minor changes to the project
|
||||
|
||||
### Changed
|
||||
- ExceptionDetails now accepts a string as a type for the $line parameter, this will automatically
|
||||
- ExceptionDetails now accepts a string as a type for the $line and $code parameter, this will automatically
|
||||
convert the string to an integer.
|
||||
|
||||
|
||||
|
|
|
@ -23,19 +23,24 @@
|
|||
*
|
||||
* @param string $name The name of the exception.
|
||||
* @param string $message The exception message.
|
||||
* @param int|null $code The exception code, or null if not specified.
|
||||
* @param string|int|null $code The exception code, or null if not specified. If a string is provided, it will be converted to an integer.
|
||||
* @param string|null $file The file name, or null if not specified.
|
||||
* @param string|int|null $line The line number, or null if not specified. If a string is provided, it will be converted to an integer.
|
||||
* @param StackTrace[]|null $trace The array of StackTrace instances, or null if not provided.
|
||||
* @param ExceptionDetails|null $previous The previous exception, or null if not specified.
|
||||
*/
|
||||
public function __construct(string $name, string $message, ?int $code=null, ?string $file=null, null|string|int $line=null, ?array $trace=null, ?ExceptionDetails $previous=null)
|
||||
public function __construct(string $name, string $message, null|string|int $code=null, ?string $file=null, null|string|int $line=null, ?array $trace=null, ?ExceptionDetails $previous=null)
|
||||
{
|
||||
if(is_string($line))
|
||||
{
|
||||
$line = (int)$line;
|
||||
}
|
||||
|
||||
if(is_string($code))
|
||||
{
|
||||
$code = (int)$code;
|
||||
}
|
||||
|
||||
$this->name = $name;
|
||||
$this->message = $message;
|
||||
$this->code = $code;
|
||||
|
|
Loading…
Add table
Reference in a new issue