Skip to content

Commit c8ca730

Browse files
perf: use instanceof instead of get_class() for type checking (#91)
Replace get_class() and is_subclass_of() with instanceof check. Faster and handles inheritance automatically.
1 parent 5e65f8c commit c8ca730

File tree

1 file changed

+2
-10
lines changed

1 file changed

+2
-10
lines changed

src/FailedJobNotifier.php

Lines changed: 2 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -26,17 +26,9 @@ public function register(): void
2626
});
2727
}
2828

29-
public function isValidNotificationClass($notification): bool
29+
public function isValidNotificationClass(object $notification): bool
3030
{
31-
if (get_class($notification) === Notification::class) {
32-
return true;
33-
}
34-
35-
if (is_subclass_of($notification, IlluminateNotification::class)) {
36-
return true;
37-
}
38-
39-
return false;
31+
return $notification instanceof IlluminateNotification;
4032
}
4133

4234
public function shouldSendNotification($notification): bool

0 commit comments

Comments
 (0)