diff --git a/inc/class-authenticator.php b/inc/class-authenticator.php index ca58b37..765516d 100644 --- a/inc/class-authenticator.php +++ b/inc/class-authenticator.php @@ -24,7 +24,6 @@ public function init(): void { * WP_Error or null otherwise. * @param string $username Username or email address. * @return null|WP_User|WP_Error - * @psalm-suppress RedundantCastGivenDocblockType */ public function authenticate( $user, $username ) { if ( ! is_wp_error( $user ) ) { @@ -49,8 +48,7 @@ public function authenticate( $user, $username ) { /** * @param string $error Login error message. - * @return string - * @psalm-suppress RedundantCastGivenDocblockType + * @return string */ public function login_errors( $error ): string { global $errors; diff --git a/inc/class-ip-api.php b/inc/class-ip-api.php index 3a75ae7..e23bb9f 100644 --- a/inc/class-ip-api.php +++ b/inc/class-ip-api.php @@ -148,7 +148,7 @@ private static function decode_entry( $entry ): ?array { 'as' => $entry['as'] ?? '', 'mobile' => isset( $entry['mobile'] ) ? (bool) $entry['mobile'] : null, 'proxy' => isset( $entry['proxy'] ) ? (bool) $entry['proxy'] : null, - 'hosting' => isset( $entry['hosting'] ) ? (bool) $entry['proxy'] : null, + 'hosting' => isset( $entry['hosting'] ) ? (bool) $entry['hosting'] : null, ]; $key = self::get_cache_key( $data['ip'] ); diff --git a/inc/class-location-watcher.php b/inc/class-location-watcher.php index 523979c..495bb8a 100644 --- a/inc/class-location-watcher.php +++ b/inc/class-location-watcher.php @@ -61,7 +61,7 @@ public function wp_login( $_user_login, WP_User $user ): void { } /** - * @param mixed[] $info + * @param mixed[] $info * @return mixed[] */ public function attach_session_information( array $info ): array { diff --git a/inc/class-login-limiter.php b/inc/class-login-limiter.php index d71ef6d..c5c175b 100644 --- a/inc/class-login-limiter.php +++ b/inc/class-login-limiter.php @@ -32,7 +32,6 @@ public function init(): void { public function wp_login_failed( $username_or_email ): void { $ip = Utils::get_ip(); if ( $ip ) { - /** @psalm-suppress RedundantCastGivenDocblockType */ list( $key1, $key2 ) = $this->get_cache_keys( (string) $username_or_email, $ip ); wp_cache_add( $key1, 0, self::CACHE_GROUP, 10 * MINUTE_IN_SECONDS ); @@ -45,7 +44,6 @@ public function wp_login_failed( $username_or_email ): void { /** * @param string $username - * @psalm-suppress RedundantCastGivenDocblockType */ public function wp_login( $username ): void { $ip = Utils::get_ip(); @@ -70,7 +68,6 @@ public function wp_login( $username ): void { * @param string $username Username or email address. * @param string $password User password * @return null|WP_User|WP_Error - * @psalm-suppress RedundantCastGivenDocblockType */ public function authenticate( $user, $username, $password ) { if ( ! empty( $username ) && ! empty( $password ) ) { @@ -92,7 +89,6 @@ public function login_form_login(): void { if ( 'POST' === Utils::get_request_method() && ! empty( $_POST['log'] ) && is_scalar( $_POST['log'] ) ) { $ip = Utils::get_ip(); if ( $ip ) { - /** @psalm-suppress RedundantCast */ $username = sanitize_user( wp_unslash( (string) $_POST['log'] ) ); $limited = $this->check_limits( $username, $ip ); if ( is_wp_error( $limited ) ) { diff --git a/inc/class-login-logger.php b/inc/class-login-logger.php index edc7a8b..7e0fbed 100644 --- a/inc/class-login-logger.php +++ b/inc/class-login-logger.php @@ -24,7 +24,6 @@ public function init(): void { * WP_Error or null otherwise. * @param string $username Username or email address. * @return null|WP_User|WP_Error - * @psalm-suppress RedundantCastGivenDocblockType */ public function authenticate( $user, $username ) { $message = sprintf( 'Login attempt: %s', $this->construct_message( (string) $username ) ); @@ -33,8 +32,7 @@ public function authenticate( $user, $username ) { } /** - * @param string $login - * @psalm-suppress RedundantCastGivenDocblockType + * @param string $login */ public function wp_login( $login ): void { $message = sprintf( 'Login successful: %s', $this->construct_message( (string) $login ) ); @@ -42,8 +40,7 @@ public function wp_login( $login ): void { } /** - * @param string $login - * @psalm-suppress RedundantCastGivenDocblockType + * @param string $login */ public function wp_login_failed( $login ): void { $user = Auth_Utils::get_user_by_login_or_email( (string) $login ); diff --git a/psalm.xml.dist b/psalm.xml.dist index f441cc4..4989c55 100644 --- a/psalm.xml.dist +++ b/psalm.xml.dist @@ -4,6 +4,8 @@ resolveFromConfigFile="true" phpVersion="7.4" findUnusedPsalmSuppress="true" + findUnusedCode="true" + findUnusedBaselineEntry="true" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns="https://getpsalm.org/schema/config" xsi:schemaLocation="https://getpsalm.org/schema/config vendor/vimeo/psalm/config.xsd" @@ -12,6 +14,13 @@ + + + + + + +