From 265e1c6bf90b5516185792c41bec3ea6d9bab74c Mon Sep 17 00:00:00 2001 From: Stefan Kalscheuer Date: Fri, 26 Apr 2024 16:53:52 +0200 Subject: [PATCH] add type hints to method signatures --- inc/class-statifyblacklist-admin.php | 12 +++---- inc/class-statifyblacklist-settings.php | 46 ++++++++++++------------- inc/class-statifyblacklist-system.php | 14 ++++---- inc/class-statifyblacklist.php | 24 ++++++------- statify-blacklist.php | 8 ++--- test/StatifyBlacklist_Settings_Test.php | 6 ++-- test/StatifyBlacklist_System_Test.php | 2 +- test/StatifyBlacklist_Test.php | 16 ++++----- 8 files changed, 64 insertions(+), 64 deletions(-) diff --git a/inc/class-statifyblacklist-admin.php b/inc/class-statifyblacklist-admin.php index 023321b..f257413 100644 --- a/inc/class-statifyblacklist-admin.php +++ b/inc/class-statifyblacklist-admin.php @@ -26,7 +26,7 @@ class StatifyBlacklist_Admin extends StatifyBlacklist { * * @since 1.5.0 */ - public static function init() { + public static function init(): void { // Add actions. add_action( 'wpmu_new_blog', array( 'StatifyBlacklist_System', 'install_site' ) ); add_action( 'delete_blog', array( 'StatifyBlacklist_System', 'uninstall_site' ) ); @@ -55,7 +55,7 @@ public static function init() { * * @since 1.0.0 */ - public static function add_menu_page() { + public static function add_menu_page(): void { $title = __( 'Statify Filter', 'statify-blacklist' ); if ( self::$multisite ) { add_options_page( @@ -86,7 +86,7 @@ public static function add_menu_page() { * * @since 1.0.0 */ - public static function plugin_meta_link( $links, $file ) { + public static function plugin_meta_link( array $links, string $file ): array { if ( STATIFYBLACKLIST_BASE === $file ) { $links[] = 'GitHub'; } @@ -104,7 +104,7 @@ public static function plugin_meta_link( $links, $file ) { * * @since 1.0.0 */ - public static function plugin_actions_links( $links, $file ) { + public static function plugin_actions_links( array $links, string $file ): array { $base = self::$multisite ? network_admin_url( 'settings.php' ) : admin_url( 'options-general.php' ); if ( STATIFYBLACKLIST_BASE === $file && current_user_can( 'manage_options' ) ) { @@ -124,7 +124,7 @@ public static function plugin_actions_links( $links, $file ) { * * @global wpdb $wpdb WordPress database. */ - public static function cleanup_database() { + public static function cleanup_database(): void { // Check user permissions. if ( ! current_user_can( 'manage_options' ) && ! ( defined( 'DOING_CRON' ) && DOING_CRON ) ) { die( esc_html__( 'Are you sure you want to do this?', 'statify-blacklist' ) ); @@ -206,7 +206,7 @@ public static function cleanup_database() { * * @since 1.1.1 */ - private static function sanitize_urls( $urls ) { + private static function sanitize_urls( array $urls ): array { return array_flip( array_filter( array_map( diff --git a/inc/class-statifyblacklist-settings.php b/inc/class-statifyblacklist-settings.php index 3944816..f97bec5 100644 --- a/inc/class-statifyblacklist-settings.php +++ b/inc/class-statifyblacklist-settings.php @@ -20,7 +20,7 @@ class StatifyBlacklist_Settings extends StatifyBlacklist { * * @return void */ - public static function register_settings() { + public static function register_settings(): void { register_setting( 'statify-blacklist', 'statify-blacklist', @@ -166,7 +166,7 @@ public static function register_settings() { * * @return void */ - public static function create_settings_page() { + public static function create_settings_page(): void { ?>

@@ -225,7 +225,7 @@ public static function create_settings_page() { * * @return void */ - public static function option_referer_active() { + public static function option_referer_active(): void { ?>
@@ -245,7 +245,7 @@ public static function option_referer_active() { * * @return void */ - public static function option_referer_cron() { + public static function option_referer_cron(): void { ?>
@@ -265,7 +265,7 @@ public static function option_referer_cron() { * * @return void */ - public static function option_referer_regexp() { + public static function option_referer_regexp(): void { ?>