Added more missing native types according to 8.0 standards

This commit is contained in:
Dylan K. Taylor
2022-11-23 14:21:38 +00:00
parent 3b6ff3c42b
commit fdb07cdbcd
14 changed files with 31 additions and 108 deletions

View File

@ -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

View File

@ -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");
}