Apply union types in some places (BC breaks)

This commit is contained in:
Dylan K. Taylor
2022-11-23 14:03:35 +00:00
parent 23ae0c7cac
commit 3b6ff3c42b
13 changed files with 30 additions and 83 deletions

View File

@@ -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)]);
}

View File

@@ -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);