1
0
mirror of https://github.com/danog/amp.git synced 2025-01-22 13:21:16 +01:00

Fix Psalm errors

This commit is contained in:
Aaron Piotrowski 2020-07-17 11:19:36 -05:00
parent 0ddf9a656e
commit 3fb87e2c18
No known key found for this signature in database
GPG Key ID: ADD1EF783EDE9EEB
2 changed files with 7 additions and 1 deletions

View File

@ -12,7 +12,7 @@ final class AsyncGenerator implements Stream
/** @var Internal\EmitSource<TValue, TSend> */
private $source;
/** @var Promise<TReturn> */
/** @var Coroutine<TReturn>|null */
private $coroutine;
/** @var \Generator|null */
@ -121,11 +121,16 @@ final class AsyncGenerator implements Stream
return $this->coroutine;
}
/** @psalm-suppress PossiblyNullArgument */
$this->coroutine = new Coroutine($this->generator);
$this->generator = null;
$source = $this->source;
$this->coroutine->onResolve(static function ($exception) use ($source) {
if ($source->isComplete()) {
return; // AsyncGenerator object was destroyed.
}
if ($exception) {
$source->fail($exception);
return;

View File

@ -43,6 +43,7 @@ final class Deferred
*/
public function isResolved(): bool
{
/** @psalm-suppress UndefinedInterfaceMethod */
return $this->resolver->isResolved();
}