mirror of
https://github.com/pmmp/PocketMine-MP.git
synced 2025-10-20 15:41:33 +00:00
Apply union types in some places (BC breaks)
This commit is contained in:
@@ -57,10 +57,7 @@ class HandlerList{
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @param RegisteredListener|Listener|Plugin $object
|
||||
*/
|
||||
public function unregister($object) : void{
|
||||
public function unregister(RegisteredListener|Plugin|Listener $object) : void{
|
||||
if($object instanceof Plugin || $object instanceof Listener){
|
||||
foreach($this->handlerSlots as $priority => $list){
|
||||
foreach($list as $hash => $listener){
|
||||
@@ -71,7 +68,7 @@ class HandlerList{
|
||||
}
|
||||
}
|
||||
}
|
||||
}elseif($object instanceof RegisteredListener){
|
||||
}else{
|
||||
if(isset($this->handlerSlots[$object->getPriority()][spl_object_id($object)])){
|
||||
unset($this->handlerSlots[$object->getPriority()][spl_object_id($object)]);
|
||||
}
|
||||
|
@@ -40,10 +40,8 @@ class HandlerListManager{
|
||||
/**
|
||||
* Unregisters all the listeners
|
||||
* If a Plugin or Listener is passed, all the listeners with that object will be removed
|
||||
*
|
||||
* @param Plugin|Listener|RegisteredListener|null $object
|
||||
*/
|
||||
public function unregisterAll($object = null) : void{
|
||||
public function unregisterAll(RegisteredListener|Plugin|Listener|null $object = null) : void{
|
||||
if($object instanceof Listener || $object instanceof Plugin || $object instanceof RegisteredListener){
|
||||
foreach($this->allLists as $h){
|
||||
$h->unregister($object);
|
||||
|
Reference in New Issue
Block a user