mirror of
https://github.com/pmmp/PocketMine-MP.git
synced 2025-06-12 06:25:32 +00:00
Modernize private property declarations in src/event
This commit is contained in:
parent
ec6769a6fc
commit
eb95e2a97e
@ -28,18 +28,14 @@ use function array_fill_keys;
|
|||||||
use function spl_object_id;
|
use function spl_object_id;
|
||||||
|
|
||||||
class HandlerList{
|
class HandlerList{
|
||||||
|
|
||||||
/** @var string */
|
|
||||||
private $class;
|
|
||||||
/** @var RegisteredListener[][] */
|
/** @var RegisteredListener[][] */
|
||||||
private $handlerSlots = [];
|
private array $handlerSlots = [];
|
||||||
/** @var HandlerList|null */
|
|
||||||
private $parentList;
|
|
||||||
|
|
||||||
public function __construct(string $class, ?HandlerList $parentList){
|
public function __construct(
|
||||||
$this->class = $class;
|
private string $class,
|
||||||
|
private ?HandlerList $parentList
|
||||||
|
){
|
||||||
$this->handlerSlots = array_fill_keys(EventPriority::ALL, []);
|
$this->handlerSlots = array_fill_keys(EventPriority::ALL, []);
|
||||||
$this->parentList = $parentList;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -28,15 +28,14 @@ use pocketmine\utils\Utils;
|
|||||||
|
|
||||||
class HandlerListManager{
|
class HandlerListManager{
|
||||||
|
|
||||||
/** @var HandlerListManager|null */
|
private static ?self $globalInstance = null;
|
||||||
private static $globalInstance = null;
|
|
||||||
|
|
||||||
public static function global() : self{
|
public static function global() : self{
|
||||||
return self::$globalInstance ?? (self::$globalInstance = new self);
|
return self::$globalInstance ?? (self::$globalInstance = new self);
|
||||||
}
|
}
|
||||||
|
|
||||||
/** @var HandlerList[] classname => HandlerList */
|
/** @var HandlerList[] classname => HandlerList */
|
||||||
private $allLists = [];
|
private array $allLists = [];
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Unregisters all the listeners
|
* Unregisters all the listeners
|
||||||
|
@ -28,31 +28,16 @@ use pocketmine\timings\TimingsHandler;
|
|||||||
use function in_array;
|
use function in_array;
|
||||||
|
|
||||||
class RegisteredListener{
|
class RegisteredListener{
|
||||||
|
public function __construct(
|
||||||
/** @var \Closure */
|
private \Closure $handler,
|
||||||
private $handler;
|
private int $priority,
|
||||||
|
private Plugin $plugin,
|
||||||
/** @var int */
|
private bool $handleCancelled,
|
||||||
private $priority;
|
private TimingsHandler $timings
|
||||||
|
){
|
||||||
/** @var Plugin */
|
|
||||||
private $plugin;
|
|
||||||
|
|
||||||
/** @var bool */
|
|
||||||
private $handleCancelled;
|
|
||||||
|
|
||||||
/** @var TimingsHandler */
|
|
||||||
private $timings;
|
|
||||||
|
|
||||||
public function __construct(\Closure $handler, int $priority, Plugin $plugin, bool $handleCancelled, TimingsHandler $timings){
|
|
||||||
if(!in_array($priority, EventPriority::ALL, true)){
|
if(!in_array($priority, EventPriority::ALL, true)){
|
||||||
throw new \InvalidArgumentException("Invalid priority number $priority");
|
throw new \InvalidArgumentException("Invalid priority number $priority");
|
||||||
}
|
}
|
||||||
$this->handler = $handler;
|
|
||||||
$this->priority = $priority;
|
|
||||||
$this->plugin = $plugin;
|
|
||||||
$this->handleCancelled = $handleCancelled;
|
|
||||||
$this->timings = $timings;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public function getHandler() : \Closure{
|
public function getHandler() : \Closure{
|
||||||
|
Loading…
x
Reference in New Issue
Block a user