mirror of
https://github.com/pestphp/pest.git
synced 2026-03-07 00:07:22 +01:00
first
This commit is contained in:
35
src/Support/Backtrace.php
Normal file
35
src/Support/Backtrace.php
Normal file
@ -0,0 +1,35 @@
|
||||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace Pest\Support;
|
||||
|
||||
/**
|
||||
* @internal
|
||||
*/
|
||||
final class Backtrace
|
||||
{
|
||||
/**
|
||||
* Returns the filename that called the current function/method.
|
||||
*/
|
||||
public static function file(): string
|
||||
{
|
||||
return debug_backtrace()[1]['file'];
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the dirname that called the current function/method.
|
||||
*/
|
||||
public static function dirname(): string
|
||||
{
|
||||
return dirname(debug_backtrace()[1]['file']);
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the line that called the current function/method.
|
||||
*/
|
||||
public static function line(): int
|
||||
{
|
||||
return debug_backtrace()[1]['line'];
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user