mirror of
https://github.com/pestphp/pest.git
synced 2026-03-06 07:47:22 +01:00
optimise debug_backtrace calls
This commit is contained in:
@ -15,6 +15,8 @@ final class Backtrace
|
|||||||
* @var string
|
* @var string
|
||||||
*/
|
*/
|
||||||
private const FILE = 'file';
|
private const FILE = 'file';
|
||||||
|
|
||||||
|
private const BACKTRACE_OPTIONS = DEBUG_BACKTRACE_IGNORE_ARGS;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Returns the current test file.
|
* Returns the current test file.
|
||||||
@ -43,7 +45,7 @@ final class Backtrace
|
|||||||
*/
|
*/
|
||||||
public static function file(): string
|
public static function file(): string
|
||||||
{
|
{
|
||||||
return debug_backtrace()[1][self::FILE];
|
return debug_backtrace(self::BACKTRACE_OPTIONS)[1][self::FILE];
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -51,7 +53,7 @@ final class Backtrace
|
|||||||
*/
|
*/
|
||||||
public static function dirname(): string
|
public static function dirname(): string
|
||||||
{
|
{
|
||||||
return dirname(debug_backtrace()[1][self::FILE]);
|
return dirname(debug_backtrace(self::BACKTRACE_OPTIONS)[1][self::FILE]);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -59,6 +61,6 @@ final class Backtrace
|
|||||||
*/
|
*/
|
||||||
public static function line(): int
|
public static function line(): int
|
||||||
{
|
{
|
||||||
return debug_backtrace()[1]['line'];
|
return debug_backtrace(self::BACKTRACE_OPTIONS)[1]['line'];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user