Skip to content

Commit

Permalink
Address phan errors
Browse files Browse the repository at this point in the history
  • Loading branch information
dkmyta committed Jul 17, 2024
1 parent f6eff75 commit 6d52593
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions projects/packages/waf/src/class-waf-stats.php
Original file line number Diff line number Diff line change
Expand Up @@ -151,6 +151,11 @@ public static function get_global_stats( $refresh_from_wpcom = false ) {
$global_stats = self::get_global_stats_from_options();
}

// Ensure that $global_stats is not null and is of the correct type
if ( $global_stats === null || ( ! is_array( $global_stats ) && ! ( $global_stats instanceof \WP_Error ) ) ) {
return new \WP_Error( 'unexpected_type', 'Unexpected type or null returned for global stats' );
}

return $global_stats;
}
}

0 comments on commit 6d52593

Please sign in to comment.