mirror of
https://github.com/pmmp/PocketMine-MP.git
synced 2025-06-10 13:35:29 +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;
|
||||
|
||||
class HandlerList{
|
||||
|
||||
/** @var string */
|
||||
private $class;
|
||||
/** @var RegisteredListener[][] */
|
||||
private $handlerSlots = [];
|
||||
/** @var HandlerList|null */
|
||||
private $parentList;
|
||||
private array $handlerSlots = [];
|
||||
|
||||
public function __construct(string $class, ?HandlerList $parentList){
|
||||
$this->class = $class;
|
||||
public function __construct(
|
||||
private string $class,
|
||||
private ?HandlerList $parentList
|
||||
){
|
||||
$this->handlerSlots = array_fill_keys(EventPriority::ALL, []);
|
||||
$this->parentList = $parentList;
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -28,15 +28,14 @@ use pocketmine\utils\Utils;
|
||||
|
||||
class HandlerListManager{
|
||||
|
||||
/** @var HandlerListManager|null */
|
||||
private static $globalInstance = null;
|
||||
private static ?self $globalInstance = null;
|
||||
|
||||
public static function global() : self{
|
||||
return self::$globalInstance ?? (self::$globalInstance = new self);
|
||||
}
|
||||
|
||||
/** @var HandlerList[] classname => HandlerList */
|
||||
private $allLists = [];
|
||||
private array $allLists = [];
|
||||
|
||||
/**
|
||||
* Unregisters all the listeners
|
||||
|
@ -28,31 +28,16 @@ use pocketmine\timings\TimingsHandler;
|
||||
use function in_array;
|
||||
|
||||
class RegisteredListener{
|
||||
|
||||
/** @var \Closure */
|
||||
private $handler;
|
||||
|
||||
/** @var int */
|
||||
private $priority;
|
||||
|
||||
/** @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){
|
||||
public function __construct(
|
||||
private \Closure $handler,
|
||||
private int $priority,
|
||||
private Plugin $plugin,
|
||||
private bool $handleCancelled,
|
||||
private TimingsHandler $timings
|
||||
){
|
||||
if(!in_array($priority, EventPriority::ALL, true)){
|
||||
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{
|
||||
|
Loading…
x
Reference in New Issue
Block a user