In the following code, the check will return the wrong result in the case of $argument being 0:
|
if ( empty( $argument ) || ! is_string( $argument ) ) { |
The check should rather be like this:
if ( ! is_string( $argument ) || 0 === strlen( $argument ) ) {