Re: [Discussion] is_string(), string type and objects implementing __toString()
| From: | Fleshgrinder | Date: | Wed, 08 Mar 2017 15:51:58 +0000 |
| Subject: | Re: [Discussion] is_string(), string type and objects implementing __toString() | ||
| References: | 1 2 3 4 | Groups: | php.internals |
| Request: | Send a blank email to internals+get-98432@lists.php.net to get a copy of this message | ||
Hey! :)
The reference is actually not a problem for a Stringable because you
would get the "Only variables can be passed by reference" error with an
object if
strict_types is enabled.
Simply because the object **MUST** be converted into a string. The
object itself does not satisfy the constraint, but the object clearly
states that it can be converted into a string at any point.
Not doing so would violate what strict_types actually promise us. ;)
--
Richard "Fleshgrinder" Fussenegger