Skip to content

Commit

Permalink
Move Coroutine::__destruct to Placeholder
Browse files Browse the repository at this point in the history
  • Loading branch information
kelunik authored and trowski committed May 31, 2019
1 parent 58c7bfb commit 944a2dd
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 11 deletions.
11 changes: 0 additions & 11 deletions lib/Coroutine.php
Original file line number Diff line number Diff line change
Expand Up @@ -144,15 +144,4 @@ public function __construct(\Generator $generator)
});
}
}

public function __destruct()
{
try {
$this->result = null;
} catch (\Throwable $e) {
Loop::defer(static function () use ($e) {
throw $e;
});
}
}
}
11 changes: 11 additions & 0 deletions lib/Internal/Placeholder.php
Original file line number Diff line number Diff line change
Expand Up @@ -155,4 +155,15 @@ private function fail(\Throwable $reason)
{
$this->resolve(new Failure($reason));
}

public function __destruct()
{
try {
$this->result = null;
} catch (\Throwable $e) {
Loop::defer(static function () use ($e) {
throw $e;
});
}
}
}

0 comments on commit 944a2dd

Please sign in to comment.