This commit is contained in:
Nuno Maduro
2020-05-11 18:38:30 +02:00
commit de2929077b
112 changed files with 6211 additions and 0 deletions

35
src/Support/Backtrace.php Normal file
View 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'];
}
}