ExceptionDetails now accepts a string as a type for the $line parameter, this will automatically convert the string to an integer.
This commit is contained in:
parent
625432e088
commit
61be8c6d73
2 changed files with 11 additions and 2 deletions
|
@ -9,6 +9,10 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
|
||||||
|
|
||||||
Minor changes to the project
|
Minor changes to the project
|
||||||
|
|
||||||
|
### Changed
|
||||||
|
- ExceptionDetails now accepts a string as a type for the $line parameter, this will automatically
|
||||||
|
convert the string to an integer.
|
||||||
|
|
||||||
|
|
||||||
## [1.0.1] - 2025-01-22
|
## [1.0.1] - 2025-01-22
|
||||||
|
|
||||||
|
|
|
@ -25,12 +25,17 @@
|
||||||
* @param string $message The exception message.
|
* @param string $message The exception message.
|
||||||
* @param int|null $code The exception code, or null if not specified.
|
* @param int|null $code The exception code, or null if not specified.
|
||||||
* @param string|null $file The file name, or null if not specified.
|
* @param string|null $file The file name, or null if not specified.
|
||||||
* @param int|null $line The line number, 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 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.
|
* @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, ?int $line=null, ?array $trace=null, ?ExceptionDetails $previous=null)
|
public function __construct(string $name, string $message, ?int $code=null, ?string $file=null, null|string|int $line=null, ?array $trace=null, ?ExceptionDetails $previous=null)
|
||||||
{
|
{
|
||||||
|
if(is_string($line))
|
||||||
|
{
|
||||||
|
$line = (int)$line;
|
||||||
|
}
|
||||||
|
|
||||||
$this->name = $name;
|
$this->name = $name;
|
||||||
$this->message = $message;
|
$this->message = $message;
|
||||||
$this->code = $code;
|
$this->code = $code;
|
||||||
|
|
Loading…
Add table
Reference in a new issue