Check and set label

I ran into an 'illegal offset' warning when using this particular combination of rules and messages. checkAndSetLabel() was trying to use a DateTime object as an array key. I changed the check from !is_array() to (is_numeric($params[$k]) || is_string($params[$k])).
From the docs, it looks like is_scalar would pass true on booleans and
floats, which aren't valid array keys. Though I'd prefer to have only a
single call rather than two.
On Sep 18, 2014 5:01 PM, "Vance Lucas" <notifications@github.com> wrote:

> In src/Valitron/Validator.php:
>
> > @@ -992,7 +992,7 @@ private function checkAndSetLabel($field, $msg, $params)
> >                  $i = 1;
> >                  foreach ($params as $k => $v) {
> >                      $tag = '{field'. $i .'}';
> > -                    $label = isset($params[$k]) && !is_array($params[$k]) && isset($this->_labels[$params[$k]]) ? $this->_labels[$params[$k]] : $tag;
> > +                    $label = isset($params[$k]) && (is_numeric($params[$k]) || is_string($params[$k])) && isset($this->_labels[$params[$k]]) ? $this->_labels[$params[$k]] : $tag;
>
> You should probably use is_scalar here instead.
>
> —
> Reply to this email directly or view it on GitHub
> <https://github.com/vlucas/valitron/pull/107/files#r17757888>.
>