danielstjules/Stringy — pull request #18 by gotterdemarung (2013-12-10 20:43:43+00:00)
Title: Ensuring, that __toString would not cause fatal errors

`__toString` method in PHP can cause:
*Catchable fatals*
http://sandbox.onlinephpfunctions.com/code/f9fc435ff703a2310e25ded726a661389ab3821b

*Fatals with interesting description*
http://sandbox.onlinephpfunctions.com/code/1a2324bc459e8a5066c5e9b07bc53b3b69964051

To avoid first one you can use implicit cast `function __toString(){ return (string) $str; }`
But if you want to avoid both, you must cast to string in setter method (i.e. in constructor) and make Stringy->str private