Backport when condition in validators from yii2