Skip to content

Commit

Permalink
fix: issues found by Psalm
Browse files Browse the repository at this point in the history
  • Loading branch information
sjinks authored and renovate[bot] committed Jan 21, 2024
1 parent 63fea7c commit 6d8fa8d
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 1 deletion.
1 change: 1 addition & 0 deletions inc/class-inputfactory.php
Original file line number Diff line number Diff line change
Expand Up @@ -126,6 +126,7 @@ private static function get_attributes( array $params ): string {
* @psalm-param HelpArgs&mixed[] $args
*/
private static function render_help( array $args ): void {
/** @psalm-suppress RiskyTruthyFalsyComparison */
if ( ! empty( $args['help'] ) ) {
printf(
'<p class="help">%s</p>',
Expand Down
2 changes: 1 addition & 1 deletion inc/class-utils.php
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ public static function create_webauthn_server(): ServerInterface {
$builder = new ServerBuilder();
$party = new RelyingParty( get_bloginfo( 'name' ), self::get_u2f_app_id() );

if ( COOKIE_DOMAIN ) {
if ( (string) COOKIE_DOMAIN ) {
$id = ltrim( (string) COOKIE_DOMAIN, '.' );
$party->setId( $id );
}
Expand Down
2 changes: 2 additions & 0 deletions inc/class-webauthn-user.php
Original file line number Diff line number Diff line change
Expand Up @@ -76,6 +76,7 @@ public function get_user_handle_if_exists(): ?UserHandle {
wp_cache_set( $key, $handle, self::CACHE_GROUP_NAME, 3600 );
}

/** @psalm-suppress RiskyTruthyFalsyComparison */
return $handle ? UserHandle::fromString( $handle ) : null;
}

Expand Down Expand Up @@ -103,6 +104,7 @@ public static function get_user_by_handle( UserHandle $handle ): ?WP_User {
wp_cache_set( $key, (int) $user_id, self::CACHE_GROUP_NAME, 3600 );
}

/** @psalm-suppress RiskyTruthyFalsyComparison */
return $user_id ? new WP_User( (int) $user_id ) : null;
}
}

0 comments on commit 6d8fa8d

Please sign in to comment.