Re: [Discussion] is_string(), string type and objects implementing __toString()
| From: | Rowan Collins | Date: | Wed, 08 Mar 2017 22:42:05 +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-98444@lists.php.net to get a copy of this message | ||
On 08/03/2017 22:24, Andrey Andreev wrote:
This is why I was concerned about the discussion becoming too broad - it brings us (or me anyway) back to square 1, if not even out of bounds.Sorry :(
I do agree that we can't have pseudo-types for everything, but can we at least have meaningful ones?Sure, but you need to justify why your particular choice of pseudo-type is more meaningful than any of the other combinations. I still don't understand what you're using this check for that means you want to exclude integers. If you're passing on the value to anything that actually needs a string, you're doing a string cast, either explicitly or implicitly, so there's no difference between me passing you (string)'42', (int)42, or new class { function __toString() { return '42'; } } My best guess was that you wanted to do something *different* if it was an integer, but as I showed in my last example that doesn't actually need you to exclude them from the new function. Regards, -- Rowan Collins [IMSoP]