mirror of
https://github.com/danog/amp.git
synced 2024-11-26 20:15:00 +01:00
Move Coroutine::__destruct to Placeholder
This commit is contained in:
parent
58c7bfb689
commit
944a2dd29d
@ -144,15 +144,4 @@ final class Coroutine implements Promise
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public function __destruct()
|
|
||||||
{
|
|
||||||
try {
|
|
||||||
$this->result = null;
|
|
||||||
} catch (\Throwable $e) {
|
|
||||||
Loop::defer(static function () use ($e) {
|
|
||||||
throw $e;
|
|
||||||
});
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
@ -155,4 +155,15 @@ trait Placeholder
|
|||||||
{
|
{
|
||||||
$this->resolve(new Failure($reason));
|
$this->resolve(new Failure($reason));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public function __destruct()
|
||||||
|
{
|
||||||
|
try {
|
||||||
|
$this->result = null;
|
||||||
|
} catch (\Throwable $e) {
|
||||||
|
Loop::defer(static function () use ($e) {
|
||||||
|
throw $e;
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user