src/Validator/Length.php
public function isValid($value)
    {
        $this->resetMessages();

        $this->value = $value;

        if (!is_string($value)) {
            throw new \InvalidArgumentException('Unexpected type: '.gettype($value));
        }

        if (strlen($value) < $this->min) {
            $this->addMessage(self::TOO_SHORT);

            return false;
        }

        if ($this->max !== null && strlen($value) > $this->max) {
            $this->addMessage(self::TOO_LONG);

            return false;
        }

        return true;
    }
public function isValid($value)
    {
        $this->resetMessages();

        $this->value = $value;

        if (!is_string($value)) {
            throw new \InvalidArgumentException('Unexpected type: '.gettype($value));
        }

        if (strlen($value) < $this->min) {
            $this->addMessage(self::TOO_SHORT);

            return false;
        }

        if ($this->max !== null && strlen($value) > $this->max) {
            $this->addMessage(self::TOO_LONG);

            return false;
        }

        return true;
    }
{@inheritdoc}