On 3/9/2017 3:18 AM, Stanislav Malyshev wrote:
> Hi!
> 
>> I submitted a GitHub PR* to allow objects implementing __toString() to
>> *optionally* pass is_string() validation. More verbose wording of my
>> motivation can be seen in the PR description, but here are the main
>> points:
> 
> I don't think it's right approach. is_* functions check the current type
> of the value, not whether it can be converted to another type. If we
> need ones that express the latter, we should have different functions.
> 
> Also, as already noted, having __toString doesn't mean it returns
> something useful.
> 

This is not true at all:

1. is_dir
2. is_executable
3. is_file
4. is_finite
5. is_infinite
6. is_link
7. is_nan
8. is_readable
9. is_resource (checks the resource's type too)
10. is_uploaded_file
11. is_writable

All other `is_*` functions are either checking the type or the instance
of an object in some way.

-- 
Richard "Fleshgrinder" Fussenegger

-- 
PHP Internals - PHP Runtime Development Mailing List
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to