Re: [VOTE] Object-based token_get_all() alternative
| From: | Côme Chilliet | Date: | Thu, 12 Mar 2020 11:07:39 +0000 |
| Subject: | Re: [VOTE] Object-based token_get_all() alternative | ||
| References: | 1 2 3 | Groups: | php.internals |
| Request: | Send a blank email to internals+get-108994@lists.php.net to get a copy of this message | ||
Le mercredi 11 mars 2020, 10:59:19 CET Larry Garfield a écrit :
> I forget who it was but someone on the list a while back offered a heuristic of
> "__toString should be used iff there is one and only one logical string representation of a
> value, because the value is conceptually just a string with extra metadata on it".
>
> That sounds like a really solid heuristic to me. In this case, I think yes, ->text is the
> only reasonable thing to produce for __toString().
Yes that was my reasoning, a token is essentially a substring, so I was expecting __toString to
reflect this and allow me to use it as a string.
--
Côme Chilliet
FusionDirectory - https://www.fusiondirectory.org