zendframework / zend-inputfilter

InputFilter component from Zend Framework
BSD 3-Clause "New" or "Revised" License
64 stars 50 forks source link

Deprecate EmptyContextInterface, InputInterface::setAllowEmpty & allowEmpty #26

Closed Maks3w closed 9 years ago

Maks3w commented 9 years ago

Deprecate magic logic for auto attach a NonEmpty validator with breakChainOnFailure = true

Instead append NonEmpty validator when desired.

$input = new Zend\InputFilter\Input();
$input->setContinueIfEmpty(true);
$input->setAllowEmpty(true);
$input->getValidatorChain()->attach(new Zend\Validator\NotEmpty(), /* break chain on failure */ true);

Close https://github.com/zendframework/zend-inputfilter/issues/12

Maks3w commented 9 years ago

Since ZF 2.4 there are lot of bugs and headaches about the Required VS AllowEmpty VS ContinueIfEmpty matrix

This simplify the problem by removing the last two and forcing the user to attach the NotEmpty validator when he/she wants that behavior.

weierophinney commented 9 years ago

Any delegation needs to happen in add new minor version; as such, it needs to be targeted at 2.6.0.

Maks3w commented 9 years ago

I propose to do this on next patch because I found this a thing to be done ASAP. Anyway the most important thing is if we all agree this should be removed

weierophinney commented 9 years ago

Any deprecations MUST happen at a new minor release. After we get the other issues ironed out, we can do a 2.6.0 release with these changes.

Maks3w commented 9 years ago

Rebased on top of develop

Maks3w commented 9 years ago

Anyway I think deprecations should be backport to the lowest version for early adoptions of workarounds.

As soon as the developer avoid deprecated features as soon he/she will upgrade to major versions with less effort.

Maks3w commented 9 years ago

I think we have two classes of deprecatations.

Maks3w commented 9 years ago

Ready for 2.4.8 LTS