mirror of
https://github.com/pmmp/PocketMine-MP.git
synced 2025-07-06 10:01:53 +00:00
AsyncTask: fix another phpstan level 7 error about wrong types
this should really be a dedicated type, but everything done with pthreads sucks.
This commit is contained in:
parent
8020912448
commit
88b216a17b
@ -25,6 +25,7 @@ namespace pocketmine\scheduler;
|
|||||||
|
|
||||||
use pocketmine\Collectable;
|
use pocketmine\Collectable;
|
||||||
use pocketmine\Server;
|
use pocketmine\Server;
|
||||||
|
use pocketmine\utils\AssumptionFailedError;
|
||||||
use function is_scalar;
|
use function is_scalar;
|
||||||
use function serialize;
|
use function serialize;
|
||||||
use function unserialize;
|
use function unserialize;
|
||||||
@ -97,7 +98,11 @@ abstract class AsyncTask extends Collectable{
|
|||||||
* @return mixed
|
* @return mixed
|
||||||
*/
|
*/
|
||||||
public function getResult(){
|
public function getResult(){
|
||||||
return $this->serialized ? unserialize($this->result) : $this->result;
|
if($this->serialized){
|
||||||
|
if(!is_string($this->result)) throw new AssumptionFailedError("Result expected to be a serialized string");
|
||||||
|
return unserialize($this->result);
|
||||||
|
}
|
||||||
|
return $this->result;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
Loading…
x
Reference in New Issue
Block a user