mirror of
https://github.com/pmmp/PocketMine-MP.git
synced 2025-06-07 12:18:46 +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{
|
private function waitForPromises() : Promise{
|
||||||
$array = $this->promises->toArray();
|
$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{
|
final protected function callDepth(\Closure $closure) : mixed{
|
||||||
if(self::$eventCallDepth >= self::MAX_EVENT_CALL_DEPTH){
|
if(self::$eventCallDepth >= self::MAX_EVENT_CALL_DEPTH){
|
||||||
//this exception will be caught by the parent event call if all else fails
|
//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;
|
use pocketmine\timings\TimingsHandler;
|
||||||
|
|
||||||
class RegisteredAsyncListener extends RegisteredListener{
|
class RegisteredAsyncListener extends RegisteredListener{
|
||||||
|
/** @phpstan-var Promise<null> $returnPromise */
|
||||||
private Promise $returnPromise;
|
private Promise $returnPromise;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @phpstan-param \Closure(AsyncEvent&Event) : Promise<null> $handler
|
||||||
|
*/
|
||||||
public function __construct(
|
public function __construct(
|
||||||
\Closure $handler,
|
\Closure $handler,
|
||||||
int $priority,
|
int $priority,
|
||||||
@ -51,6 +55,9 @@ class RegisteredAsyncListener extends RegisteredListener{
|
|||||||
return !$this->noConcurrentCall;
|
return !$this->noConcurrentCall;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @phpstan-return Promise<null>
|
||||||
|
*/
|
||||||
public function callAsync(AsyncEvent&Event $event) : Promise{
|
public function callAsync(AsyncEvent&Event $event) : Promise{
|
||||||
$this->callEvent($event);
|
$this->callEvent($event);
|
||||||
return $this->returnPromise;
|
return $this->returnPromise;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user