为什么方法不能返回布尔值?

Here is my code:

public function shouldHaveOption(Request $request)
{
    return shouldHaveOption($request->option_key);
}

The result of shouldHaveOption() function is either true or false. And it throws:

The Response content must be a string or object implementing __toString(), "boolean" given.

Why should the returned value a string?


Noted that return jsone_encode(shouldHaveOption($request->option_key)); would work. Because jsone_encode make a boolean to string.