diff --git a/src/scheduler/AsyncPool.php b/src/scheduler/AsyncPool.php index 5ac526afc0..a33740bb3d 100644 --- a/src/scheduler/AsyncPool.php +++ b/src/scheduler/AsyncPool.php @@ -57,7 +57,10 @@ class AsyncPool{ /** @var int[] */ private $workerLastUsed = []; - /** @var \Closure[] */ + /** + * @var \Closure[] + * @phpstan-var (\Closure(int $workerId) : void)[] + */ private $workerStartHooks = []; public function __construct(int $size, int $workerMemoryLimit, \ClassLoader $classLoader, \ThreadedLogger $logger){ @@ -88,6 +91,8 @@ class AsyncPool{ * The signature should be `function(int $worker) : void` * * This function will call the hook for every already-running worker. + * + * @phpstan-param \Closure(int $workerId) : void $hook */ public function addWorkerStartHook(\Closure $hook) : void{ Utils::validateCallableSignature(function(int $worker) : void{}, $hook); @@ -99,6 +104,8 @@ class AsyncPool{ /** * Removes a previously-registered callback listening for workers being started. + * + * @phpstan-param \Closure(int $workerId) : void $hook */ public function removeWorkerStartHook(\Closure $hook) : void{ unset($this->workerStartHooks[spl_object_id($hook)]); diff --git a/src/scheduler/ClosureTask.php b/src/scheduler/ClosureTask.php index f306143d27..6152469c05 100644 --- a/src/scheduler/ClosureTask.php +++ b/src/scheduler/ClosureTask.php @@ -38,11 +38,15 @@ use pocketmine\utils\Utils; */ class ClosureTask extends Task{ - /** @var \Closure */ + /** + * @var \Closure + * @phpstan-var \Closure(int) : void + */ private $closure; /** * @param \Closure $closure Must accept only ONE parameter, $currentTick + * @phpstan-param \Closure(int) : void $closure */ public function __construct(\Closure $closure){ Utils::validateCallableSignature(function(int $currentTick){}, $closure); diff --git a/src/utils/Internet.php b/src/utils/Internet.php index c2ce7c14ed..fd9bc92fd2 100644 --- a/src/utils/Internet.php +++ b/src/utils/Internet.php @@ -183,6 +183,7 @@ class Internet{ * @param string[] $extraHeaders extra headers to send as a plain string array * @param array $extraOpts extra CURLOPT_* to set as an [opt => value] map * @param \Closure|null $onSuccess function to be called if there is no error. Accepts a resource argument as the cURL handle. + * @phpstan-param (\Closure(resource) : void)|null $onSuccess * * @return array a plain array of three [result body : string, headers : array[], HTTP response code : int]. Headers are grouped by requests with strtolower(header name) as keys and header value as values *