Replace disallowed operators in src/event/

This commit is contained in:
Dylan K. Taylor 2022-01-20 19:17:17 +00:00
parent 22fb02c4e6
commit aa6bd4438a
No known key found for this signature in database
GPG Key ID: 8927471A91CAFD3D
3 changed files with 5 additions and 5 deletions

View File

@ -65,11 +65,11 @@ class HandlerList{
* @param RegisteredListener|Listener|Plugin $object
*/
public function unregister($object) : void{
if($object instanceof Plugin or $object instanceof Listener){
if($object instanceof Plugin || $object instanceof Listener){
foreach($this->handlerSlots as $priority => $list){
foreach($list as $hash => $listener){
if(($object instanceof Plugin and $listener->getPlugin() === $object)
or ($object instanceof Listener and (new \ReflectionFunction($listener->getHandler()))->getClosureThis() === $object) //this doesn't even need to be a listener :D
if(($object instanceof Plugin && $listener->getPlugin() === $object)
|| ($object instanceof Listener && (new \ReflectionFunction($listener->getHandler()))->getClosureThis() === $object) //this doesn't even need to be a listener :D
){
unset($this->handlerSlots[$priority][$hash]);
}

View File

@ -45,7 +45,7 @@ class HandlerListManager{
* @param Plugin|Listener|RegisteredListener|null $object
*/
public function unregisterAll($object = null) : void{
if($object instanceof Listener or $object instanceof Plugin or $object instanceof RegisteredListener){
if($object instanceof Listener || $object instanceof Plugin || $object instanceof RegisteredListener){
foreach($this->allLists as $h){
$h->unregister($object);
}

View File

@ -68,7 +68,7 @@ class RegisteredListener{
}
public function callEvent(Event $event) : void{
if($event instanceof Cancellable and $event->isCancelled() and !$this->isHandlingCancelled()){
if($event instanceof Cancellable && $event->isCancelled() && !$this->isHandlingCancelled()){
return;
}
$this->timings->startTiming();