AsyncPool: assert() that the unstacked task is actually an AsyncTask

it's possible that it might not be if the workers were accessed directly, but that shouldn't be possible.
This also silences a PHPStan warning on level 2.
This commit is contained in:
Dylan K. Taylor 2019-12-01 19:28:05 +00:00
parent 163ed225f2
commit 0890b5fc99

View File

@ -263,6 +263,7 @@ class AsyncPool{
while(($task = $worker->unstack()) !== null){
//cancelRun() is not strictly necessary here, but it might be used to inform plugins of the task state
//(i.e. it never executed).
assert($task instanceof AsyncTask);
$task->cancelRun();
$this->removeTask($task, true);
}