<?php
use Zend\Validator\ValidatorChain;
use Zend\Validator\NotEmpty;
use Zend\Validator\Between;
use Zend\Debug\Debug;
$chain = new ValidatorChain();
$chain->attach(new NotEmpty());
$chain->attach(new Between([
'min' => 3,
'max' => 9,
]));
Debug::dump($chain->isValid(''));
Debug::dump($chain->getMessages());
Debug::dump($chain->isValid(1));
Debug::dump($chain->getMessages());
Debug::dump($chain->isValid(5));
Debug::dump($chain->getMessages());
bool(false)
array(2) { ["isEmpty"] => string(36) "Value is required and can't be empty" ["valueNotNumeric"] => string(68) "The min ('3') and max ('9') values are numeric, but the input is not" }
bool(false)
array(1) { ["notBetween"] => string(49) "The input is not between '3' and '9', inclusively" }
bool(true)
array(0) { }