diff --git a/src/GeneralOptions/Base.php b/src/GeneralOptions/Base.php index d23f0232..f793b6ff 100644 --- a/src/GeneralOptions/Base.php +++ b/src/GeneralOptions/Base.php @@ -42,7 +42,7 @@ abstract class Base implements Controllable { * * @return string */ - public static function get_slug() { + public static function get_slug(): string { return static::$slug; } @@ -75,7 +75,7 @@ public static function init() { * @return array Updated options. * @since 3.0.0 */ - public static function add_general_option( $options ) { + public static function add_general_option( array $options ): array { $options[] = static::class; return $options; @@ -88,7 +88,7 @@ public static function add_general_option( $options ) { * * @return mixed|null */ - public static function is_active( $type = 'general' ) { + public static function is_active( string $type = 'general' ) { return Settings::get_option( static::get_option_name( 'active' ), $type ); } @@ -98,7 +98,7 @@ public static function is_active( $type = 'general' ) { * * @return bool */ - public static function only_print_custom_options() { + public static function only_print_custom_options(): bool { return static::$only_custom_options; } @@ -107,7 +107,7 @@ public static function only_print_custom_options() { * * @return string[] */ - public static function get_supported_types() { + public static function get_supported_types(): array { return [ 'general' ]; } @@ -116,7 +116,7 @@ public static function get_supported_types() { * * @return string */ - public static function get_type() { + public static function get_type(): string { return static::$type; } @@ -127,7 +127,7 @@ public static function get_type() { * @param string $name Name suffix. * @return string Corresponding option name */ - public static function get_option_name( $name ) { + public static function get_option_name( string $name ): string { $type = static::get_type(); $slug = static::get_slug(); $option_name = "{$type}_{$slug}_{$name}"; diff --git a/src/GeneralOptions/DeleteOldSpam.php b/src/GeneralOptions/DeleteOldSpam.php index 2696aab2..3f5ffbb5 100644 --- a/src/GeneralOptions/DeleteOldSpam.php +++ b/src/GeneralOptions/DeleteOldSpam.php @@ -27,7 +27,7 @@ class DeleteOldSpam extends Base { * * @return string */ - public static function get_name() { + public static function get_name(): string { return __( 'Delete old spam', 'antispam-bee' ); } @@ -56,7 +56,7 @@ public static function get_description() { * * @return array */ - public static function get_options() { + public static function get_options(): array { return [ [ 'type' => 'inline', diff --git a/src/GeneralOptions/IgnoreLinkbacks.php b/src/GeneralOptions/IgnoreLinkbacks.php index e0370975..0556059b 100644 --- a/src/GeneralOptions/IgnoreLinkbacks.php +++ b/src/GeneralOptions/IgnoreLinkbacks.php @@ -24,7 +24,7 @@ class IgnoreLinkbacks extends Base { * * @return string */ - public static function get_name() { + public static function get_name(): string { return __( 'Linkbacks', 'antispam-bee' ); } diff --git a/src/GeneralOptions/Statistics.php b/src/GeneralOptions/Statistics.php index 93411393..b3e27d9a 100644 --- a/src/GeneralOptions/Statistics.php +++ b/src/GeneralOptions/Statistics.php @@ -24,7 +24,7 @@ class Statistics extends Base { * * @return string */ - public static function get_name() { + public static function get_name(): string { return __( 'Statistics', 'antispam-bee' ); } diff --git a/src/GeneralOptions/Uninstall.php b/src/GeneralOptions/Uninstall.php index 460c9124..addffe6c 100644 --- a/src/GeneralOptions/Uninstall.php +++ b/src/GeneralOptions/Uninstall.php @@ -24,7 +24,7 @@ class Uninstall extends Base { * * @return string */ - public static function get_name() { + public static function get_name(): string { return __( 'Uninstall', 'antispam-bee' ); } diff --git a/src/Interfaces/Controllable.php b/src/Interfaces/Controllable.php index e36912a4..7841707a 100644 --- a/src/Interfaces/Controllable.php +++ b/src/Interfaces/Controllable.php @@ -18,7 +18,7 @@ interface Controllable { * * @return string */ - public static function get_name(); + public static function get_name(): string; /** * Get element label (optional). @@ -54,7 +54,7 @@ public static function get_description(); * ] * ] * - * @return mixed + * @return array|null */ public static function get_options(); @@ -66,7 +66,7 @@ public static function get_options(); * * @return mixed|null */ - public static function is_active( $type ); + public static function is_active( string $type ); /** * Only print custom options? @@ -74,28 +74,28 @@ public static function is_active( $type ); * * @return bool */ - public static function only_print_custom_options(); + public static function only_print_custom_options(): bool; /** * Get a list of supported types. * * @return string[] */ - public static function get_supported_types(); + public static function get_supported_types(): array; /** * Get type of the controllable. * * @return string */ - public static function get_type(); + public static function get_type(): string; /** * Get controllable slug. * * @return string */ - public static function get_slug(); + public static function get_slug(): string; /** * Get option name. @@ -104,5 +104,5 @@ public static function get_slug(); * @param string $name Name suffix. * @return string Corresponding option name */ - public static function get_option_name( $name ); + public static function get_option_name( string $name ): string; } diff --git a/src/Interfaces/PostProcessor.php b/src/Interfaces/PostProcessor.php index 4848b132..22490b80 100644 --- a/src/Interfaces/PostProcessor.php +++ b/src/Interfaces/PostProcessor.php @@ -15,26 +15,26 @@ interface PostProcessor { * @param array $item Item to process. * @return array Processed item. */ - public static function process( $item ); + public static function process( array $item ): array; /** * Get post processor slug. * * @return string The slug. */ - public static function get_slug(); + public static function get_slug(): string; /** * Get a list of supported types. * * @return string[] */ - public static function get_supported_types(); + public static function get_supported_types(): array; /** * Does this processor mark am element as deleted? * * @return bool */ - public static function marks_as_delete(); + public static function marks_as_delete(): bool; } diff --git a/src/Interfaces/SpamReason.php b/src/Interfaces/SpamReason.php index a52c170f..e78330c6 100644 --- a/src/Interfaces/SpamReason.php +++ b/src/Interfaces/SpamReason.php @@ -17,5 +17,5 @@ interface SpamReason { * * @return string */ - public static function get_reason_text(); + public static function get_reason_text(): string; } diff --git a/src/Interfaces/Verifiable.php b/src/Interfaces/Verifiable.php index 4eb5465b..36da7683 100644 --- a/src/Interfaces/Verifiable.php +++ b/src/Interfaces/Verifiable.php @@ -18,7 +18,7 @@ interface Verifiable { * @param array $item Item to verify. * @return int Weighted result. */ - public static function verify( $item ); + public static function verify( array $item ): int; /** * Get rule weight. @@ -26,26 +26,26 @@ public static function verify( $item ); * * @return int Weight factor. */ - public static function get_weight(); + public static function get_weight(): int; /** * Get element slug. * * @return string The slug. */ - public static function get_slug(); + public static function get_slug(): string; /** * Get a list of supported types. * * @return string[] */ - public static function get_supported_types(); + public static function get_supported_types(): array; /** * It this rule final? * * @return bool */ - public static function is_final(); + public static function is_final(): bool; } diff --git a/src/PostProcessors/Base.php b/src/PostProcessors/Base.php index d2eaff15..f05e5f75 100644 --- a/src/PostProcessors/Base.php +++ b/src/PostProcessors/Base.php @@ -52,7 +52,7 @@ public static function init() { * * @return PostProcessor[] Updated list of post processors. */ - public static function add_post_processor( $post_processors ) { + public static function add_post_processor( array $post_processors ): array { $post_processors[] = static::class; return $post_processors; @@ -63,7 +63,7 @@ public static function add_post_processor( $post_processors ) { * * @return string The slug. */ - public static function get_slug() { + public static function get_slug(): string { return static::$slug; } @@ -72,7 +72,7 @@ public static function get_slug() { * * @return string[] */ - public static function get_supported_types() { + public static function get_supported_types(): array { // @todo: add filter return static::$supported_types; } @@ -82,7 +82,7 @@ public static function get_supported_types() { * * @return bool */ - public static function marks_as_delete() { + public static function marks_as_delete(): bool { return static::$marks_as_delete; } } diff --git a/src/PostProcessors/ControllableBase.php b/src/PostProcessors/ControllableBase.php index 159ddfde..83f66e43 100644 --- a/src/PostProcessors/ControllableBase.php +++ b/src/PostProcessors/ControllableBase.php @@ -35,7 +35,7 @@ abstract class ControllableBase extends Base implements Controllable { * * @return mixed|null */ - public static function is_active( $type ) { + public static function is_active( string $type ) { return Settings::get_option( static::get_option_name( 'active' ), $type ); } @@ -56,7 +56,7 @@ public static function get_options() { * * @return bool */ - public static function only_print_custom_options() { + public static function only_print_custom_options(): bool { return static::$only_print_custom_options; } @@ -65,7 +65,7 @@ public static function only_print_custom_options() { * * @return string */ - public static function get_type() { + public static function get_type(): string { return static::$type; } @@ -76,7 +76,7 @@ public static function get_type() { * @param string $name Name suffix. * @return string Corresponding option name */ - public static function get_option_name( $name ) { + public static function get_option_name( string $name ): string { $type = static::get_type(); $slug = static::get_slug(); $option_name = "{$type}_{$slug}_{$name}"; diff --git a/src/PostProcessors/Delete.php b/src/PostProcessors/Delete.php index 18fd07dd..a38975a6 100644 --- a/src/PostProcessors/Delete.php +++ b/src/PostProcessors/Delete.php @@ -32,7 +32,7 @@ class Delete extends ControllableBase { * @param array $item Item to process. * @return array Processed item. */ - public static function process( $item ) { + public static function process( array $item ): array { $item['asb_marked_as_delete'] = true; return $item; @@ -43,7 +43,7 @@ public static function process( $item ) { * * @return string */ - public static function get_name() { + public static function get_name(): string { return __( 'Delete spam', 'antispam-bee' ); } diff --git a/src/PostProcessors/DeleteForReasons.php b/src/PostProcessors/DeleteForReasons.php index 225b0af6..c4bb0faf 100644 --- a/src/PostProcessors/DeleteForReasons.php +++ b/src/PostProcessors/DeleteForReasons.php @@ -36,7 +36,7 @@ class DeleteForReasons extends ControllableBase { * @param array $item Item to process. * @return array Processed item. */ - public static function process( $item ) { + public static function process( array $item ): array { if ( isset( $item['asb_marked_as_delete'] ) && true === $item['asb_marked_as_delete'] ) { return $item; } @@ -58,7 +58,7 @@ public static function process( $item ) { * * @return string */ - public static function get_name() { + public static function get_name(): string { return __( 'Delete by reasons', 'antispam-bee' ); } diff --git a/src/PostProcessors/SaveReason.php b/src/PostProcessors/SaveReason.php index d95ce980..2b9c4288 100644 --- a/src/PostProcessors/SaveReason.php +++ b/src/PostProcessors/SaveReason.php @@ -26,7 +26,7 @@ class SaveReason extends ControllableBase { * @param array $item Item to process. * @return array Processed item. */ - public static function process( $item ) { + public static function process( array $item ): array { if ( isset( $item['asb_marked_as_delete'] ) && true === $item['asb_marked_as_delete'] ) { return $item; } @@ -55,7 +55,7 @@ function ( $comment_id ) use ( $item ) { * * @return string */ - public static function get_name() { + public static function get_name(): string { return __( 'Save reasons', 'antispam-bee' ); } diff --git a/src/PostProcessors/SendEmail.php b/src/PostProcessors/SendEmail.php index 25934db6..34267a25 100644 --- a/src/PostProcessors/SendEmail.php +++ b/src/PostProcessors/SendEmail.php @@ -29,7 +29,7 @@ class SendEmail extends ControllableBase { * @param array $item Item to process. * @return array Processed item. */ - public static function process( $item ) { + public static function process( array $item ): array { if ( isset( $item['asb_marked_as_delete'] ) && true === $item['asb_marked_as_delete'] ) { return $item; } @@ -85,7 +85,7 @@ function ( $id ) use ( $item ) { * * @return string */ - public static function get_name() { + public static function get_name(): string { return __( 'Send email', 'antispam-bee' ); } diff --git a/src/PostProcessors/UpdateSpamCount.php b/src/PostProcessors/UpdateSpamCount.php index 1d800efb..a1cd24cc 100644 --- a/src/PostProcessors/UpdateSpamCount.php +++ b/src/PostProcessors/UpdateSpamCount.php @@ -29,7 +29,7 @@ class UpdateSpamCount extends Base { * @param array $item Item to process. * @return array Processed item. */ - public static function process( $item ) { + public static function process( array $item ): array { if ( ! Statistics::is_active() ) { return $item; } diff --git a/src/PostProcessors/UpdateSpamLog.php b/src/PostProcessors/UpdateSpamLog.php index 6048ff9f..b2204c8c 100644 --- a/src/PostProcessors/UpdateSpamLog.php +++ b/src/PostProcessors/UpdateSpamLog.php @@ -26,7 +26,7 @@ class UpdateSpamLog extends Base { * @param array $item Item to process. * @return array Processed item. */ - public static function process( $item ) { + public static function process( array $item ): array { if ( ! isset( $item['comment_post_ID'] ) || ! isset( $item['comment_author_IP'] ) ) { $item['asb_post_processors_failed'][] = self::get_slug(); return $item; diff --git a/src/Rules/ApprovedEmail.php b/src/Rules/ApprovedEmail.php index f733c43c..f248677b 100644 --- a/src/Rules/ApprovedEmail.php +++ b/src/Rules/ApprovedEmail.php @@ -37,7 +37,7 @@ class ApprovedEmail extends ControllableBase { * @param array $item Item to verify. * @return int Numeric result. */ - public static function verify( $item ) { + public static function verify( array $item ): int { $email = DataHelper::get_values_where_key_contains( [ 'email' ], $item ); if ( empty( $email ) ) { return 0; @@ -65,7 +65,7 @@ public static function verify( $item ) { * * @return string */ - public static function get_name() { + public static function get_name(): string { return __( 'Approved Email', 'antispam-bee' ); } diff --git a/src/Rules/BBCode.php b/src/Rules/BBCode.php index 921d086c..1f34ef87 100644 --- a/src/Rules/BBCode.php +++ b/src/Rules/BBCode.php @@ -29,7 +29,7 @@ class BBCode extends ControllableBase implements SpamReason { * @param array $item Item to verify. * @return int Numeric result. */ - public static function verify( $item ) { + public static function verify( array $item ): int { foreach ( $item as $value ) { if ( true === (bool) preg_match( '/\[url[=\]].*\[\/url\]/is', $value ) ) { return 1; @@ -44,7 +44,7 @@ public static function verify( $item ) { * * @return string */ - public static function get_name() { + public static function get_name(): string { return _x( 'BBCode', 'spam-reason-form-name', 'antispam-bee' ); } @@ -71,7 +71,7 @@ public static function get_description() { * * @return string */ - public static function get_reason_text() { + public static function get_reason_text(): string { return _x( 'BBCode', 'spam-reason-text', 'antispam-bee' ); } } diff --git a/src/Rules/Base.php b/src/Rules/Base.php index b6d8206f..46ab48cc 100644 --- a/src/Rules/Base.php +++ b/src/Rules/Base.php @@ -68,7 +68,7 @@ public static function init() { * * @return array */ - public static function add_rule( $rules ) { + public static function add_rule( array $rules ): array { $rules[] = static::class; return $rules; @@ -79,7 +79,7 @@ public static function add_rule( $rules ) { * * @return array */ - public static function get_supported_types() { + public static function get_supported_types(): array { /** * Filter the reaction types that are supported by the rule. * @@ -97,7 +97,7 @@ public static function get_supported_types() { * * @return int Weight factor. */ - public static function get_weight() { + public static function get_weight(): int { return static::$weight; } @@ -106,7 +106,7 @@ public static function get_weight() { * * @return string The slug. */ - public static function get_slug() { + public static function get_slug(): string { return static::$slug; } @@ -115,7 +115,7 @@ public static function get_slug() { * * @return bool */ - public static function is_final() { + public static function is_final(): bool { return static::$is_final; } @@ -124,7 +124,7 @@ public static function is_final() { * * @return bool */ - public static function is_invisible() { + public static function is_invisible(): bool { return static::$is_invisible; } } diff --git a/src/Rules/ControllableBase.php b/src/Rules/ControllableBase.php index f36c0321..cc52f2c0 100644 --- a/src/Rules/ControllableBase.php +++ b/src/Rules/ControllableBase.php @@ -36,7 +36,7 @@ abstract class ControllableBase extends Base implements Controllable { * * @return mixed|null */ - public static function is_active( $type ) { + public static function is_active( string $type ) { return Settings::get_option( static::get_option_name( 'active' ), $type ); } @@ -57,7 +57,7 @@ public static function get_options() { * * @return bool */ - public static function only_print_custom_options() { + public static function only_print_custom_options(): bool { return static::$only_print_custom_options; } @@ -66,7 +66,7 @@ public static function only_print_custom_options() { * * @return string */ - public static function get_type() { + public static function get_type(): string { return static::$type; } @@ -77,7 +77,7 @@ public static function get_type() { * @param string $name Name suffix. * @return string Corresponding option name */ - public static function get_option_name( $name ) { + public static function get_option_name( string $name ): string { $type = static::get_type(); $slug = static::get_slug(); $option_name = "{$type}_{$slug}_{$name}"; diff --git a/src/Rules/CountrySpam.php b/src/Rules/CountrySpam.php index 2ea973df..39f7203c 100644 --- a/src/Rules/CountrySpam.php +++ b/src/Rules/CountrySpam.php @@ -32,7 +32,7 @@ class CountrySpam extends ControllableBase implements SpamReason { * @param array $item Item to verify. * @return int Numeric result. */ - public static function verify( $item ) { + public static function verify( array $item ): int { if ( ! isset( $item['comment_author_IP'] ) || empty( $item['comment_author_IP'] ) ) { return 0; } @@ -137,7 +137,7 @@ public static function verify( $item ) { * * @return string */ - public static function get_name() { + public static function get_name(): string { return __( 'Country Check', 'antispam-bee' ); } @@ -248,7 +248,7 @@ private static function sanitize_iso_codes_string( $value ) { * * @return string */ - public static function get_reason_text() { + public static function get_reason_text(): string { return __( 'Country', 'antispam-bee' ); } } diff --git a/src/Rules/DbSpam.php b/src/Rules/DbSpam.php index 3f53f0c5..f4e9d7e9 100644 --- a/src/Rules/DbSpam.php +++ b/src/Rules/DbSpam.php @@ -30,7 +30,7 @@ class DbSpam extends ControllableBase implements SpamReason { * @param array $item Item to verify. * @return int Numeric result. */ - public static function verify( $item ) { + public static function verify( array $item ): int { $params = []; $filter = []; $url = wp_unslash( array_shift( DataHelper::get_values_where_key_contains( [ 'url' ], $item ) ) ); @@ -83,7 +83,7 @@ public static function verify( $item ) { * * @return string */ - public static function get_name() { + public static function get_name(): string { return __( 'Local DB Spam', 'antispam-bee' ); } @@ -110,7 +110,7 @@ public static function get_description() { * * @return string */ - public static function get_reason_text() { + public static function get_reason_text(): string { return __( 'Local DB', 'antispam-bee' ); } } diff --git a/src/Rules/EmptyData.php b/src/Rules/EmptyData.php index add1ffc3..f6f26944 100644 --- a/src/Rules/EmptyData.php +++ b/src/Rules/EmptyData.php @@ -30,7 +30,7 @@ class EmptyData extends Base implements SpamReason { * @param array $item Item to verify. * @return int Numeric result. */ - public static function verify( $item ) { + public static function verify( array $item ): int { // phpcs:ignore WordPress.NamingConventions.PrefixAllGlobals.NonPrefixedHooknameFound $allow_empty_reaction = apply_filters( 'allow_empty_comment', false, $item ); $content = $item['comment_content'] ?? ''; @@ -63,7 +63,7 @@ public static function verify( $item ) { * * @return string */ - public static function get_name() { + public static function get_name(): string { return _x( 'Empty Data', 'spam-reason-form-name', 'antispam-bee' ); } @@ -72,7 +72,7 @@ public static function get_name() { * * @return string */ - public static function get_reason_text() { + public static function get_reason_text(): string { return _x( 'Empty Data', 'spam-reason-text', 'antispam-bee' ); } } diff --git a/src/Rules/Honeypot.php b/src/Rules/Honeypot.php index 0c793e36..0c58088f 100644 --- a/src/Rules/Honeypot.php +++ b/src/Rules/Honeypot.php @@ -61,7 +61,7 @@ function ( $field_markup ) { * @param array $item Item to verify. * @return int Numeric result. */ - public static function verify( $item ) { + public static function verify( array $item ): int { // phpcs:ignore WordPress.Security.NonceVerification.Missing if ( isset( $_POST['ab_spam__hidden_field'] ) && 1 === $_POST['ab_spam__hidden_field'] ) { return 999; @@ -120,7 +120,7 @@ public static function precheck() { * * @return string */ - public static function get_name() { + public static function get_name(): string { return _x( 'Honeypot', 'spam-reason-form-name', 'antispam-bee' ); } @@ -147,7 +147,7 @@ public static function get_description() { * * @return string */ - public static function get_reason_text() { + public static function get_reason_text(): string { return _x( 'Honeypot', 'spam-reason-text', 'antispam-bee' ); } } diff --git a/src/Rules/InvalidRequest.php b/src/Rules/InvalidRequest.php index 153c62ef..4f1f20e6 100644 --- a/src/Rules/InvalidRequest.php +++ b/src/Rules/InvalidRequest.php @@ -29,7 +29,7 @@ class InvalidRequest extends Base implements SpamReason { * @param array $item Item to verify. * @return int Numeric result. */ - public static function verify( $item ) { + public static function verify( array $item ): int { // phpcs:ignore WordPress.Security.NonceVerification.Missing,WordPress.Security.ValidatedSanitizedInput if ( isset( $_POST['ab_spam__invalid_request'] ) && $_POST['ab_spam__invalid_request'] ) { return 999; @@ -43,7 +43,7 @@ public static function verify( $item ) { * * @return string */ - public static function get_name() { + public static function get_name(): string { return _x( 'Invalid Request', 'spam-reason-form-name', 'antispam-bee' ); } @@ -52,7 +52,7 @@ public static function get_name() { * * @return string */ - public static function get_reason_text() { + public static function get_reason_text(): string { return _x( 'Invalid Request', 'spam-reason-text', 'antispam-bee' ); } } diff --git a/src/Rules/LangSpam.php b/src/Rules/LangSpam.php index 443b3b22..b164b909 100644 --- a/src/Rules/LangSpam.php +++ b/src/Rules/LangSpam.php @@ -33,7 +33,7 @@ class LangSpam extends ControllableBase implements SpamReason { * @param array $item Item to verify. * @return int Numeric result. */ - public static function verify( $item ) { + public static function verify( array $item ): int { $allowed_languages = array_keys( (array) Settings::get_option( static::get_option_name( 'allowed' ), $item['reaction_type'] ) ); $comment_content = DataHelper::get_values_where_key_contains( [ 'content' ], $item ); @@ -118,7 +118,7 @@ public static function verify( $item ) { * * @return string */ - public static function get_name() { + public static function get_name(): string { return __( 'Language', 'antispam-bee' ); } @@ -199,7 +199,7 @@ public static function get_options() { * * @return string */ - public static function get_reason_text() { + public static function get_reason_text(): string { return __( 'Language', 'antispam-bee' ); } } diff --git a/src/Rules/LinkbackFromMyself.php b/src/Rules/LinkbackFromMyself.php index 0f636a2c..3fe13b2b 100644 --- a/src/Rules/LinkbackFromMyself.php +++ b/src/Rules/LinkbackFromMyself.php @@ -46,7 +46,7 @@ class LinkbackFromMyself extends Base implements SpamReason { * @param array $item Item to verify. * @return int Numeric result. */ - public static function verify( $item ) { + public static function verify( array $item ): int { $url = isset( $item['comment_author_url'] ) ? $item['comment_author_url'] : null; $target_post_id = isset( $item['comment_post_ID'] ) ? $item['comment_post_ID'] : null; if ( empty( $url ) || empty( $target_post_id ) ) { @@ -88,7 +88,7 @@ public static function verify( $item ) { * * @return string */ - public static function get_name() { + public static function get_name(): string { return __( 'Linkback from myself', 'antispam-bee' ); } @@ -97,7 +97,7 @@ public static function get_name() { * * @return string */ - public static function get_reason_text() { + public static function get_reason_text(): string { return _x( 'Linkback from myself', 'spam-reason-text', 'antispam-bee' ); } } diff --git a/src/Rules/LinkbackPostTitleIsBlogName.php b/src/Rules/LinkbackPostTitleIsBlogName.php index f18d90d9..633d6439 100644 --- a/src/Rules/LinkbackPostTitleIsBlogName.php +++ b/src/Rules/LinkbackPostTitleIsBlogName.php @@ -37,7 +37,7 @@ class LinkbackPostTitleIsBlogName extends Base implements SpamReason { * @param array $item Item to verify. * @return int Numeric result. */ - public static function verify( $item ) { + public static function verify( array $item ): int { $body = isset( $item['comment_content'] ) ? $item['comment_content'] : null; $blog_name = isset( $item['comment_author'] ) ? $item['comment_author'] : null; preg_match( '/(.*)<\/strong>\\n\\n/', $body, $matches ); @@ -53,7 +53,7 @@ public static function verify( $item ) { * * @return string */ - public static function get_name() { + public static function get_name(): string { return __( 'Linkback post title is blog name', 'antispam-bee' ); } @@ -62,7 +62,7 @@ public static function get_name() { * * @return string */ - public static function get_reason_text() { + public static function get_reason_text(): string { return _x( 'Linkback Post Title', 'spam-reason-text', 'antispam-bee' ); } } diff --git a/src/Rules/RegexpSpam.php b/src/Rules/RegexpSpam.php index e24d49ce..07cca24a 100644 --- a/src/Rules/RegexpSpam.php +++ b/src/Rules/RegexpSpam.php @@ -32,7 +32,7 @@ class RegexpSpam extends ControllableBase implements SpamReason { * @param array $item Item to verify. * @return int Numeric result. */ - public static function verify( $item ) { + public static function verify( array $item ): int { $fields = [ 'ip', 'host', @@ -178,7 +178,7 @@ public static function verify( $item ) { * * @return string */ - public static function get_name() { + public static function get_name(): string { return __( 'Regular Expression', 'antispam-bee' ); } @@ -205,7 +205,7 @@ public static function get_description() { * * @return string */ - public static function get_reason_text() { + public static function get_reason_text(): string { return _x( 'RegExp match', 'spam-reason-text', 'antispam-bee' ); } } diff --git a/src/Rules/TooFastSubmit.php b/src/Rules/TooFastSubmit.php index 31587210..cea9f6f1 100644 --- a/src/Rules/TooFastSubmit.php +++ b/src/Rules/TooFastSubmit.php @@ -75,7 +75,7 @@ function ( $field_markup ) { * @param array $item Item to verify. * @return int Numeric result. */ - public static function verify( $item ) { + public static function verify( array $item ): int { // phpcs:disable WordPress.Security.NonceVerification.Missing // Everybody can Post. if ( ! isset( $_POST['ab_init_time'] ) ) { @@ -100,7 +100,7 @@ public static function verify( $item ) { * * @return string */ - public static function get_name() { + public static function get_name(): string { return __( 'Comment time', 'antispam-bee' ); } @@ -127,7 +127,7 @@ public static function get_description() { * * @return string */ - public static function get_reason_text() { + public static function get_reason_text(): string { return _x( 'Created too quickly', 'spam-reason-text', 'antispam-bee' ); } } diff --git a/src/Rules/ValidGravatar.php b/src/Rules/ValidGravatar.php index 62bd7f9e..b06b5c0b 100644 --- a/src/Rules/ValidGravatar.php +++ b/src/Rules/ValidGravatar.php @@ -37,7 +37,7 @@ class ValidGravatar extends ControllableBase { * @param array $item Item to verify. * @return int Numeric result. */ - public static function verify( $item ) { + public static function verify( array $item ): int { $email = DataHelper::get_values_where_key_contains( [ 'email' ], $item ); if ( empty( $email ) ) { return 0; @@ -67,7 +67,7 @@ public static function verify( $item ) { * * @return string */ - public static function get_name() { + public static function get_name(): string { return __( 'Valid Gravatar', 'antispam-bee' ); }