.. _no-returntype-but-still,-only-string: No Returntype But Still, Only String ------------------------------------ .. meta:: :description lang=en: No Returntype But Still, Only String: Without a return type (or mixed), a method may return any type of data. By `Fred Bouchery `_ Without a return type (or mixed), a method may return any type of data. This is not the case for the magic method ``__toString``, as it really should return a string. So, even without a return type, it complains about the type. That trick requires ``strict_types`` though. .. image:: ../images/no-type-but-string.png * `Magic methods (PHP manual) `_ * `Declare `_