mirror of
https://github.com/pmmp/PocketMine-MP.git
synced 2025-06-06 11:57:10 +00:00
fix PHPstan
This commit is contained in:
parent
c250bb0da7
commit
58155a77fb
@ -120,7 +120,7 @@ final class AsyncEventDelegate extends Event{
|
||||
}
|
||||
|
||||
/**
|
||||
* @phpstan-return Promise<null>
|
||||
* @phpstan-return Promise<array<int, null>>
|
||||
*/
|
||||
private function waitForPromises() : Promise{
|
||||
$array = $this->promises->toArray();
|
||||
|
@ -56,6 +56,11 @@ abstract class Event{
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* @template T
|
||||
* @phpstan-param \Closure() : T $closure
|
||||
* @phpstan-return T
|
||||
*/
|
||||
final protected function callDepth(\Closure $closure) : mixed{
|
||||
if(self::$eventCallDepth >= self::MAX_EVENT_CALL_DEPTH){
|
||||
//this exception will be caught by the parent event call if all else fails
|
||||
|
@ -28,8 +28,12 @@ use pocketmine\promise\Promise;
|
||||
use pocketmine\timings\TimingsHandler;
|
||||
|
||||
class RegisteredAsyncListener extends RegisteredListener{
|
||||
/** @phpstan-var Promise<null> $returnPromise */
|
||||
private Promise $returnPromise;
|
||||
|
||||
/**
|
||||
* @phpstan-param \Closure(AsyncEvent&Event) : Promise<null> $handler
|
||||
*/
|
||||
public function __construct(
|
||||
\Closure $handler,
|
||||
int $priority,
|
||||
@ -51,6 +55,9 @@ class RegisteredAsyncListener extends RegisteredListener{
|
||||
return !$this->noConcurrentCall;
|
||||
}
|
||||
|
||||
/**
|
||||
* @phpstan-return Promise<null>
|
||||
*/
|
||||
public function callAsync(AsyncEvent&Event $event) : Promise{
|
||||
$this->callEvent($event);
|
||||
return $this->returnPromise;
|
||||
|
Loading…
x
Reference in New Issue
Block a user