This method should typehint the incoming value once union types are available, but for now this ensures that method_exists() is not called on scalar values, which is unsupported in PHP 8.