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

Deprecate EmptyContextInterface, InputInterface::setAllowEmpty & allowEmpty #26

Conversation

Maks3w
Copy link
Member

@Maks3w Maks3w commented Aug 20, 2015

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 #12

@Maks3w Maks3w force-pushed the feature/deprectate-AddNotEmptyValidator-logic branch from 25011f8 to 4f7a0a2 Compare August 20, 2015 11:33
@Maks3w
Copy link
Member Author

Maks3w commented Aug 20, 2015

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.

interface EmptyContextInterface
{
/**
* @deprecated 2.5.5 Add Zend\Validator\NotEmpty validator to the ValidatorChain.
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

May we should describe setContinueIfEmpty(true) should be do too.

@Maks3w Maks3w added this to the 2.4.8 milestone Aug 21, 2015
@@ -9,15 +9,22 @@

namespace Zend\InputFilter;

/**
* @deprecated 2.5.5 Add Zend\Validator\NotEmpty validator to the ValidatorChain.
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do we should deprecate this starting from 2.4.8?

@weierophinney
Copy link
Member

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

@Maks3w
Copy link
Member Author

Maks3w commented Aug 22, 2015

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
Copy link
Member

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.

@weierophinney weierophinney modified the milestones: 2.6.0, 2.4.8 Aug 26, 2015
@Maks3w Maks3w force-pushed the feature/deprectate-AddNotEmptyValidator-logic branch from 4f7a0a2 to 4b40e52 Compare August 27, 2015 11:13
@Maks3w
Copy link
Member Author

Maks3w commented Aug 27, 2015

Rebased on top of develop

@Maks3w
Copy link
Member Author

Maks3w commented Aug 28, 2015

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
Copy link
Member Author

Maks3w commented Sep 1, 2015

I think we have two classes of deprecatations.

  • New features which make obsolete old one. This should be deprecated in a new minor because includes a new feature.
  • Removal of code without new feature. This could be deprecated at any moment because there is no new code related to it.

@@ -2,6 +2,32 @@

All notable changes to this project will be documented in this file, in reverse chronological order by release.

## 2.6.0 - TBD
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm confused at this point. In IRC, you're indicating this should be merged against the LTS release as well; to my mind, that's saying it should be part of the 2.4 and 2.5 series, and not require a new version. If this is truly backwards compatible, I'm inclined to do so, as it gives the cleanest path forwards for existing users to upgrade.

However, here, you're indicating the next new minor version, 2.6.0. I'm not sure if this is due to the feedback I provided previously, or if this was what you originally intended. However, it's contrary to being submitted against the master branch, which targets 2.5.

So, confusion all around on my part.

Can you clarify, please?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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

@Maks3w Maks3w force-pushed the feature/deprectate-AddNotEmptyValidator-logic branch from 4b40e52 to 62c4d0c Compare September 1, 2015 19:09
@Maks3w
Copy link
Member Author

Maks3w commented Sep 1, 2015

Ready for 2.4.8 LTS

@Maks3w Maks3w modified the milestones: 2.4.8, 2.6.0 Sep 1, 2015
Deprecate magic logic for auto attach a NonEmpty validator with breakChainOnFailure = true

Instead append NonEmpty validator when desired.

```php
$input = new Zend\InputFilter\Input();
$input->setContinueIfEmpty(true);
$input->setAllowEmpty(true);
$input->getValidatorChain()->attach(new Zend\Validator\NotEmpty(), /* break chain on failure */ true);
```
@Maks3w Maks3w force-pushed the feature/deprectate-AddNotEmptyValidator-logic branch from 62c4d0c to fe57157 Compare September 1, 2015 19:12
@weierophinney weierophinney merged commit fe57157 into zendframework:master Sep 1, 2015
weierophinney added a commit that referenced this pull request Sep 1, 2015
…dator-logic

Deprecate EmptyContextInterface, InputInterface::setAllowEmpty & allowEmpty
weierophinney added a commit that referenced this pull request Sep 1, 2015
weierophinney added a commit that referenced this pull request Sep 1, 2015
@Maks3w Maks3w deleted the feature/deprectate-AddNotEmptyValidator-logic branch September 1, 2015 21:37
weierophinney added a commit to weierophinney/zend-inputfilter that referenced this pull request Sep 9, 2015
Includes these changes:

- [14: NotEmpty validator doesn't override the required attribute](zendframework#14)
- [16: BC in validators context value](zendframework#16)
- [24: Fix loop validation input context is mutable](zendframework#24)
- [25: Fix missing optional fields should not be validated](zendframework#25)
- [26: Deprecate magic logic for auto attaching a NonEmpty validator with breakChainOnFailure = true](zendframework#26)
- [31: Update the InputFilterInterface::add docblock to match existing, shipped implementations](zendframework#31)
- [32: Promote HHVM](zendframework#32)
- [36: Fix docblocks declared as regular comment block](zendframework#36)
- [40: Remove test about Input setters permutation](zendframework#40)
- [41: Refactor tests for group 7448 as a data set matrix](zendframework#41)
- [42: Consolidate InputFilterPluginManager tests](zendframework#42)
- [43: Consolidate Factory tests + Fixes](zendframework#43)
- [44: Consolidate of InputInterface::merge and Fix unsafe merge](zendframework#44)
- [45: When merge Inputs don't merge values if source does not have one.](zendframework#45)
- [46: Expand test matrix with nonempty value scenarios](zendframework#46)
- [47: Feature/minor test improvements](zendframework#47)
- [48: Empty values + Allow Empty + Not continue if empty is always true](zendframework#48)
- [49: Add tests for exceptions and improve some messages](zendframework#49)
- [50: Optional fields without value should be valid ](zendframework#50)
- [51: Optional input without value are valid](zendframework#51)
- [52: Fix merge two inputs without value, result 'has value' flag should be false](zendframework#52)
- [56: Hotfix/minor changes](zendframework#56)
- [57: Consolidate tests for InputFilterInterface](zendframework#57)
- [61: Provide NotEmpty::IS&zendframework#95;EMPTY validation message for required input](zendframework#61)
- [63: Ensure custom error messages are used for required missing inputs](zendframework#63)
- [64: Feature/test cleanup](zendframework#64)
weierophinney added a commit to weierophinney/zend-inputfilter that referenced this pull request Sep 9, 2015
Includes these changes:

- [14: NotEmpty validator doesn't override the required attribute](zendframework#14)
- [16: BC in validators context value](zendframework#16)
- [24: Fix loop validation input context is mutable](zendframework#24)
- [25: Fix missing optional fields should not be validated](zendframework#25)
- [26: Deprecate magic logic for auto attaching a NonEmpty validator with breakChainOnFailure = true](zendframework#26)
- [31: Update the InputFilterInterface::add docblock to match existing, shipped implementations](zendframework#31)
- [36: Fix docblocks declared as regular comment block](zendframework#36)
- [40: Remove test about Input setters permutation](zendframework#40)
- [41: Refactor tests for group 7448 as a data set matrix](zendframework#41)
- [42: Consolidate InputFilterPluginManager tests](zendframework#42)
- [43: Consolidate Factory tests + Fixes](zendframework#43)
- [44: Consolidate of InputInterface::merge and Fix unsafe merge](zendframework#44)
- [45: When merge Inputs don't merge values if source does not have one.](zendframework#45)
- [46: Expand test matrix with nonempty value scenarios](zendframework#46)
- [47: Feature/minor test improvements](zendframework#47)
- [48: Empty values + Allow Empty + Not continue if empty is always true](zendframework#48)
- [49: Add tests for exceptions and improve some messages](zendframework#49)
- [50: Optional fields without value should be valid ](zendframework#50)
- [51: Optional input without value are valid](zendframework#51)
- [52: Fix merge two inputs without value, result 'has value' flag should be false](zendframework#52)
- [56: Hotfix/minor changes](zendframework#56)
- [57: Consolidate tests for InputFilterInterface](zendframework#57)
- [61: Provide NotEmpty::IS&zendframework#95;EMPTY validation message for required input](zendframework#61)
- [63: Ensure custom error messages are used for required missing inputs](zendframework#63)
- [64: Feature/test cleanup](zendframework#64)
weierophinney added a commit to weierophinney/zend-inputfilter that referenced this pull request Sep 9, 2015
Includes these changes:

- [14: NotEmpty validator doesn't override the required attribute](zendframework#14)
- [16: BC in validators context value](zendframework#16)
- [24: Fix loop validation input context is mutable](zendframework#24)
- [25: Fix missing optional fields should not be validated](zendframework#25)
- [26: Deprecate magic logic for auto attaching a NonEmpty validator with breakChainOnFailure = true](zendframework#26)
- [31: Update the InputFilterInterface::add docblock to match existing, shipped implementations](zendframework#31)
- [36: Fix docblocks declared as regular comment block](zendframework#36)
- [40: Remove test about Input setters permutation](zendframework#40)
- [41: Refactor tests for group 7448 as a data set matrix](zendframework#41)
- [42: Consolidate InputFilterPluginManager tests](zendframework#42)
- [43: Consolidate Factory tests + Fixes](zendframework#43)
- [44: Consolidate of InputInterface::merge and Fix unsafe merge](zendframework#44)
- [45: When merge Inputs don't merge values if source does not have one.](zendframework#45)
- [46: Expand test matrix with nonempty value scenarios](zendframework#46)
- [47: Feature/minor test improvements](zendframework#47)
- [48: Empty values + Allow Empty + Not continue if empty is always true](zendframework#48)
- [49: Add tests for exceptions and improve some messages](zendframework#49)
- [50: Optional fields without value should be valid ](zendframework#50)
- [51: Optional input without value are valid](zendframework#51)
- [52: Fix merge two inputs without value, result 'has value' flag should be false](zendframework#52)
- [56: Hotfix/minor changes](zendframework#56)
- [57: Consolidate tests for InputFilterInterface](zendframework#57)
- [61: Provide NotEmpty::IS&zendframework#95;EMPTY validation message for required input](zendframework#61)
- [63: Ensure custom error messages are used for required missing inputs](zendframework#63)
- [64: Feature/test cleanup](zendframework#64)
weierophinney added a commit to zendframework/zendframework that referenced this pull request Dec 20, 2016
Includes these changes:

- [14: NotEmpty validator doesn't override the required attribute](zendframework/zend-inputfilter#14)
- [16: BC in validators context value](zendframework/zend-inputfilter#16)
- [24: Fix loop validation input context is mutable](zendframework/zend-inputfilter#24)
- [25: Fix missing optional fields should not be validated](zendframework/zend-inputfilter#25)
- [26: Deprecate magic logic for auto attaching a NonEmpty validator with breakChainOnFailure = true](zendframework/zend-inputfilter#26)
- [31: Update the InputFilterInterface::add docblock to match existing, shipped implementations](zendframework/zend-inputfilter#31)
- [36: Fix docblocks declared as regular comment block](zendframework/zend-inputfilter#36)
- [40: Remove test about Input setters permutation](zendframework/zend-inputfilter#40)
- [41: Refactor tests for group 7448 as a data set matrix](zendframework/zend-inputfilter#41)
- [42: Consolidate InputFilterPluginManager tests](zendframework/zend-inputfilter#42)
- [43: Consolidate Factory tests + Fixes](zendframework/zend-inputfilter#43)
- [44: Consolidate of InputInterface::merge and Fix unsafe merge](zendframework/zend-inputfilter#44)
- [45: When merge Inputs don't merge values if source does not have one.](zendframework/zend-inputfilter#45)
- [46: Expand test matrix with nonempty value scenarios](zendframework/zend-inputfilter#46)
- [47: Feature/minor test improvements](zendframework/zend-inputfilter#47)
- [48: Empty values + Allow Empty + Not continue if empty is always true](zendframework/zend-inputfilter#48)
- [49: Add tests for exceptions and improve some messages](zendframework/zend-inputfilter#49)
- [50: Optional fields without value should be valid ](zendframework/zend-inputfilter#50)
- [51: Optional input without value are valid](zendframework/zend-inputfilter#51)
- [52: Fix merge two inputs without value, result 'has value' flag should be false](zendframework/zend-inputfilter#52)
- [56: Hotfix/minor changes](zendframework/zend-inputfilter#56)
- [57: Consolidate tests for InputFilterInterface](zendframework/zend-inputfilter#57)
- [61: Provide NotEmpty::IS_EMPTY validation message for required input](zendframework/zend-inputfilter#61)
- [63: Ensure custom error messages are used for required missing inputs](zendframework/zend-inputfilter#63)
- [64: Feature/test cleanup](zendframework/zend-inputfilter#64)
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants