On Sep 18, 2013, at 11:53 AM, Leigh <[email protected]> wrote:
> Hi Internals.
>
> How do you feel about expanding the is_* functions to accept multiple
> parameters similar to the way isset() already does?
>
> ...
>
> Thoughts?
For isset() there is a good reason to do this, because the var might not exist at all, and as such
you cannot use a function, as it would produce warnings.
However, for is_* functions, this could easily be done with a higher-order "every"
function. You pass a predicate and an array of values. It returns a boolean.
Example:
if (!every('is_int', $numbers)) {
throw new \InvalidArgumentException(...);
}
Not only is that much cleaner in my opinion, it also is composable without having to change *all* of
the is_* predicates.
As such, I don't see much value in changing this.
Igor