mirror of
https://github.com/pmmp/PocketMine-MP.git
synced 2025-09-07 02:08:21 +00:00
Added more missing native types according to 8.0 standards
This commit is contained in:
@ -124,10 +124,7 @@ abstract class AsyncTask extends \Threaded{
|
||||
return $this->result;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param mixed $result
|
||||
*/
|
||||
public function setResult($result) : void{
|
||||
public function setResult(mixed $result) : void{
|
||||
$this->result = ($this->serialized = !is_scalar($result)) ? igbinary_serialize($result) : $result;
|
||||
}
|
||||
|
||||
@ -166,7 +163,7 @@ abstract class AsyncTask extends \Threaded{
|
||||
*
|
||||
* @param mixed $progress A value that can be safely serialize()'ed.
|
||||
*/
|
||||
public function publishProgress($progress) : void{
|
||||
public function publishProgress(mixed $progress) : void{
|
||||
$this->progressUpdates[] = igbinary_serialize($progress);
|
||||
}
|
||||
|
||||
@ -213,10 +210,8 @@ abstract class AsyncTask extends \Threaded{
|
||||
*
|
||||
* Objects stored in this storage can be retrieved using fetchLocal() on the same thread that this method was called
|
||||
* from.
|
||||
*
|
||||
* @param mixed $complexData the data to store
|
||||
*/
|
||||
protected function storeLocal(string $key, $complexData) : void{
|
||||
protected function storeLocal(string $key, mixed $complexData) : void{
|
||||
if(self::$threadLocalStorage === null){
|
||||
/*
|
||||
* It's necessary to use an object (not array) here because pthreads is stupid. Non-default array statics
|
||||
|
@ -76,10 +76,8 @@ class AsyncWorker extends Worker{
|
||||
/**
|
||||
* Saves mixed data into the worker's thread-local object store. This can be used to store objects which you
|
||||
* want to use on this worker thread from multiple AsyncTasks.
|
||||
*
|
||||
* @param mixed $value
|
||||
*/
|
||||
public function saveToThreadStore(string $identifier, $value) : void{
|
||||
public function saveToThreadStore(string $identifier, mixed $value) : void{
|
||||
if(\Thread::getCurrentThread() !== $this){
|
||||
throw new \LogicException("Thread-local data can only be stored in the thread context");
|
||||
}
|
||||
@ -93,10 +91,8 @@ class AsyncWorker extends Worker{
|
||||
* account for the possibility that what you're trying to retrieve might not exist.
|
||||
*
|
||||
* Objects stored in this storage may ONLY be retrieved while the task is running.
|
||||
*
|
||||
* @return mixed
|
||||
*/
|
||||
public function getFromThreadStore(string $identifier){
|
||||
public function getFromThreadStore(string $identifier) : mixed{
|
||||
if(\Thread::getCurrentThread() !== $this){
|
||||
throw new \LogicException("Thread-local data can only be fetched in the thread context");
|
||||
}
|
||||
|
Reference in New Issue
Block a user