From dc406b342c50110b44df6c43f576a9498e289398 Mon Sep 17 00:00:00 2001 From: Stefan Kalscheuer Date: Sun, 24 Mar 2024 10:48:06 +0100 Subject: [PATCH] refactor: remove superfluous type checks Types are now checked at function call, so we can assume the type is always correct at time of execution. --- src/Helpers/InterfaceHelper.php | 2 +- src/Helpers/Settings.php | 4 ---- 2 files changed, 1 insertion(+), 5 deletions(-) diff --git a/src/Helpers/InterfaceHelper.php b/src/Helpers/InterfaceHelper.php index 407af556..64501e62 100644 --- a/src/Helpers/InterfaceHelper.php +++ b/src/Helpers/InterfaceHelper.php @@ -34,7 +34,7 @@ public static function class_implements_interface( string $class_name, string $i * @return bool */ public static function class_implements_interfaces( string $class_name, array $interfaces ): bool { - if ( ! is_string( $class_name ) || ! class_exists( $class_name ) ) { + if ( ! class_exists( $class_name ) ) { return false; } diff --git a/src/Helpers/Settings.php b/src/Helpers/Settings.php index f3a805ae..b4c5a348 100644 --- a/src/Helpers/Settings.php +++ b/src/Helpers/Settings.php @@ -114,10 +114,6 @@ public static function get_option( string $option_name, string $type = 'general' * @return null|mixed Value at given path, if present. */ public static function get_array_value_by_path( string $path, array $array ) { - if ( ! is_array( $array ) ) { - return null; - } - $path_array = self::get_path_parts( $path ); if ( empty( $path_array ) ) { return null;