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

Commit

Permalink
Tune NonEmpty validator
Browse files Browse the repository at this point in the history
  • Loading branch information
Maks3w committed Sep 2, 2015
1 parent 1cacb3e commit 002f817
Showing 1 changed file with 10 additions and 2 deletions.
12 changes: 10 additions & 2 deletions src/Input.php
Original file line number Diff line number Diff line change
Expand Up @@ -466,13 +466,21 @@ protected function injectNotEmptyValidator()
}

$this->notEmptyValidator = true;
$options = [
'type' => [
NotEmpty::NULL |
NotEmpty::STRING |
NotEmpty::EMPTY_ARRAY |
NotEmpty::OBJECT
],
];

if (class_exists(AbstractPluginManager::class)) {
$chain->prependByName('NotEmpty', [], true);
$chain->prependByName('NotEmpty', $options, true);

return;
}

$chain->prependValidator(new NotEmpty(), true);
$chain->prependValidator(new NotEmpty($options), true);
}
}

0 comments on commit 002f817

Please sign in to comment.