-
-
Notifications
You must be signed in to change notification settings - Fork 163
Closed
Description
Given a function that declares a never return type.
final public function unwrap(): never
{
if ($this->value instanceof \Throwable) {
throw $this->value;
}
throw new \RuntimeException(\sprintf("Unwrapping `Err`: %s", \serialize($this->value)));
}It gets transformed into the following code with an added statement return $__am_res; and causes PHP to throw a fatal exception:
Fatal error: A never-returning function must not return in Err.php on line 55
final public function unwrap(): never
{ if (($__am_res = __amock_before($this, __CLASS__, __FUNCTION__, array(), false)) !== __AM_CONTINUE__) return $__am_res;
if ($this->value instanceof \Throwable) {
throw $this->value;
}
throw new \RuntimeException(\sprintf("Unwrapping `Err`: %s", \serialize($this->value)));
}Metadata
Metadata
Assignees
Labels
No labels