Not sure from which version, but count argument not used anymore.
Just checked WP_Term_Query class and found nothing related to count argument in get_terms() method, but you can still find it in constructor of this class.
To return terms count only, you need to set count for fields argument.
get_terms(
array(
'parent' => $categoryId,
'taxonomy' => 'category',
'fields' => 'count'
)
);
The function wp_count_terms() just do the same.
function wp_count_terms( $taxonomy, $args = array() ) {
$defaults = array('hide_empty' => false);
$args = wp_parse_args($args, $defaults);
if ( isset($args['ignore_empty']) ) {
$args['hide_empty'] = $args['ignore_empty'];
unset($args['ignore_empty']);
}
//HERE IT SETS COUNT VALUE FOR YOU
$args['fields'] = 'count';
return get_terms($taxonomy, $args);
}
It’s not the first time I noticed, that english version of codex is outdated. For example spanish codex don’t have a ‘count’ argument – https://codex.wordpress.org/es:Function_Reference/get_terms