Re: [RFC] get_debug_type
| From: | tyson andre | Date: | Mon, 17 Feb 2020 02:22:46 +0000 |
| Subject: | Re: [RFC] get_debug_type | ||
| References: | 1 | Groups: | php.internals |
| Request: | Send a blank email to internals+get-108631@lists.php.net to get a copy of this message | ||
I'd definitely agree on returning
int instead of integer.
PHP allows both class integer and class resource, so int
(plus documenting exact return values for examples, as Nikita mentioned) would be useful to prevent
ambiguity.
Also, it'd be nice to have null return the lowercase string null instead of
uppercase.
get_canonical_type() is my weak preference. I'd also considered suggesting get_class_or_type(),
but that seemed misleading since the value of get_class_or_type(2) would be different from
gettype(2).
This would save some time and make it easier to write better messages debugging, syslogging,
throwing exceptions for unexpected values, etc.
- Tyson