mirror of
https://github.com/pestphp/pest.git
synced 2026-03-05 23:37:22 +01:00
PHP 8 and PHPUnit 9.3 support
This commit is contained in:
@ -76,7 +76,7 @@ final class HigherOrderMessage
|
||||
Reflection::setPropertyValue($throwable, 'file', $this->filename);
|
||||
Reflection::setPropertyValue($throwable, 'line', $this->line);
|
||||
|
||||
if ($throwable->getMessage() === sprintf(self::UNDEFINED_METHOD, $this->methodName)) {
|
||||
if ($throwable->getMessage() === self::getUndefinedMethodMessage($target, $this->methodName)) {
|
||||
/** @var \ReflectionClass $reflection */
|
||||
$reflection = new ReflectionClass($target);
|
||||
/* @phpstan-ignore-next-line */
|
||||
@ -87,4 +87,13 @@ final class HigherOrderMessage
|
||||
throw $throwable;
|
||||
}
|
||||
}
|
||||
|
||||
private static function getUndefinedMethodMessage(object $target, string $methodName): string
|
||||
{
|
||||
if (\PHP_MAJOR_VERSION >= 8) {
|
||||
return sprintf(sprintf(self::UNDEFINED_METHOD, sprintf('%s::%s()', get_class($target), $methodName)));
|
||||
}
|
||||
|
||||
return sprintf(self::UNDEFINED_METHOD, $methodName);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user