Skip to content
This repository was archived by the owner on Jan 30, 2020. It is now read-only.

Commit 0be6691

Browse files
committed
Check for existing notEmpty validator only in the first position of validator list
1 parent e3dc128 commit 0be6691

File tree

1 file changed

+6
-8
lines changed

1 file changed

+6
-8
lines changed

Input.php

+6-8
Original file line numberDiff line numberDiff line change
@@ -283,15 +283,13 @@ protected function injectNotEmptyValidator()
283283
}
284284
$chain = $this->getValidatorChain();
285285

286-
// Check if NotEmpty validator is already in chain
286+
// Check if NotEmpty validator is already first in chain
287287
$validators = $chain->getValidators();
288-
foreach ($validators as $validatorInfo) {
289-
if (isset($validatorInfo['instance'])
290-
&& $validatorInfo['instance'] instanceof NotEmpty
291-
) {
292-
$this->notEmptyValidator = true;
293-
return;
294-
}
288+
if (isset($validators[0]['instance'])
289+
&& $validators[0]['instance'] instanceof NotEmpty
290+
) {
291+
$this->notEmptyValidator = true;
292+
return;
295293
}
296294

297295
$chain->prependByName('NotEmpty', array(), true);

0 commit comments

Comments
 (0)