This `any` seems superfluous. If all of `values %entity_to_annotation` are the empty string, then $new_text will also be the empty string, because join($anything, ()) returns the empty string. I think you can just replace this with `if ($new_text ne '')`, which also reads a bit clearer.