mirror of
https://github.com/pestphp/pest.git
synced 2026-03-09 17:27:22 +01:00
Add Initial teamcity support
This commit is contained in:
@ -5,7 +5,6 @@ declare(strict_types=1);
|
||||
namespace Pest\Support;
|
||||
|
||||
use Closure;
|
||||
use ReflectionProperty;
|
||||
use Throwable;
|
||||
|
||||
/**
|
||||
@ -37,32 +36,4 @@ final class ExceptionTrace
|
||||
throw $throwable;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Removes any item from the stack trace referencing Pest so as not to
|
||||
* crowd the error log for the end user.
|
||||
*/
|
||||
public static function removePestReferences(Throwable $t): void
|
||||
{
|
||||
if (! property_exists($t, 'serializableTrace')) {
|
||||
return;
|
||||
}
|
||||
|
||||
$property = new ReflectionProperty($t, 'serializableTrace');
|
||||
$property->setAccessible(true);
|
||||
|
||||
/** @var array<int, array<string, string>> $trace */
|
||||
$trace = $property->getValue($t);
|
||||
|
||||
$cleanedTrace = [];
|
||||
foreach ($trace as $item) {
|
||||
if (array_key_exists('file', $item) && mb_strpos($item['file'], 'vendor/pestphp/pest/') > 0) {
|
||||
continue;
|
||||
}
|
||||
|
||||
$cleanedTrace[] = $item;
|
||||
}
|
||||
|
||||
$property->setValue($t, $cleanedTrace);
|
||||
}
|
||||
}
|
||||
|
||||
@ -76,4 +76,9 @@ final class Str
|
||||
|
||||
return substr($subject, 0, $pos);
|
||||
}
|
||||
|
||||
public static function after(string $subject, string $search): string
|
||||
{
|
||||
return $search === '' ? $subject : array_reverse(explode($search, $subject, 2))[0];
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user