Count total number across post types

Why not just get the count for each post type and sum them?

function get_all_them_ven_posts(){
  $count= 0;
  $post_types = [ 'postType1', 'postType2', 'postType3' ];
  foreach( $post_types as $post_type ) {
    $count_posts =  wp_count_posts( $post_type );
    $count = $count + $count_posts->publish;
  }
  return $count;
}

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)