What you're describing is "type hinting" and PHP supports it, however (for some reason) it does not allow it for any of the built-in intrinsic types or string
( http://php.net/manual/en/language.oop5.typehinting.php ) which explains the problem you're having.
You can workaround this by manually calling is_string
inside your function, but things like this aren't necessary if you control your upstream callers.