mirror of
https://github.com/pestphp/pest.git
synced 2026-03-07 00:07:22 +01:00
phpstan fix
This commit is contained in:
@ -151,6 +151,7 @@ final class Expectation
|
|||||||
throw new BadMethodCallException('Expectation value is not iterable.');
|
throw new BadMethodCallException('Expectation value is not iterable.');
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//@phpstan-ignore-next-line
|
||||||
$value = is_array($this->value) ? $this->value : iterator_to_array($this->value);
|
$value = is_array($this->value) ? $this->value : iterator_to_array($this->value);
|
||||||
$keys = array_keys($value);
|
$keys = array_keys($value);
|
||||||
$values = array_values($value);
|
$values = array_values($value);
|
||||||
|
|||||||
@ -26,6 +26,8 @@ final class Backtrace
|
|||||||
$current = null;
|
$current = null;
|
||||||
|
|
||||||
foreach (debug_backtrace(self::BACKTRACE_OPTIONS) as $trace) {
|
foreach (debug_backtrace(self::BACKTRACE_OPTIONS) as $trace) {
|
||||||
|
assert(array_key_exists(self::FILE, $trace));
|
||||||
|
|
||||||
if (Str::endsWith($trace[self::FILE], 'overrides/Runner/TestSuiteLoader.php')) {
|
if (Str::endsWith($trace[self::FILE], 'overrides/Runner/TestSuiteLoader.php')) {
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
@ -45,7 +47,11 @@ final class Backtrace
|
|||||||
*/
|
*/
|
||||||
public static function file(): string
|
public static function file(): string
|
||||||
{
|
{
|
||||||
return debug_backtrace(self::BACKTRACE_OPTIONS)[1][self::FILE];
|
$trace = debug_backtrace(self::BACKTRACE_OPTIONS)[1];
|
||||||
|
|
||||||
|
assert(array_key_exists(self::FILE, $trace));
|
||||||
|
|
||||||
|
return $trace[self::FILE];
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -53,7 +59,11 @@ final class Backtrace
|
|||||||
*/
|
*/
|
||||||
public static function dirname(): string
|
public static function dirname(): string
|
||||||
{
|
{
|
||||||
return dirname(debug_backtrace(self::BACKTRACE_OPTIONS)[1][self::FILE]);
|
$trace = debug_backtrace(self::BACKTRACE_OPTIONS)[1];
|
||||||
|
|
||||||
|
assert(array_key_exists(self::FILE, $trace));
|
||||||
|
|
||||||
|
return dirname($trace[self::FILE]);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -61,6 +71,10 @@ final class Backtrace
|
|||||||
*/
|
*/
|
||||||
public static function line(): int
|
public static function line(): int
|
||||||
{
|
{
|
||||||
return debug_backtrace(self::BACKTRACE_OPTIONS)[1]['line'];
|
$trace = debug_backtrace(self::BACKTRACE_OPTIONS)[1];
|
||||||
|
|
||||||
|
assert(array_key_exists('line', $trace));
|
||||||
|
|
||||||
|
return $trace['line'];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user