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

Commit e2c1ef3

Browse files
committed
Merge pull request #26 from Maks3w/feature/deprectate-AddNotEmptyValidator-logic
Deprecate EmptyContextInterface, InputInterface::setAllowEmpty & allowEmpty
2 parents 67c68c8 + fe57157 commit e2c1ef3

File tree

5 files changed

+55
-0
lines changed

5 files changed

+55
-0
lines changed

CHANGELOG.md

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -121,6 +121,32 @@ All notable changes to this project will be documented in this file, in reverse
121121
(previously, it would consider the data set valid, and auto-initialize the
122122
missing input to `null`).
123123

124+
## 2.4.8 - TBD
125+
126+
### Added
127+
128+
- Nothing.
129+
130+
### Deprecated
131+
132+
- [#26](https://github.com/zendframework/zend-inputfilter/pull/26) Deprecate magic logic for auto attach a NonEmpty
133+
validator with breakChainOnFailure = true. Instead append NonEmpty validator when desired.
134+
135+
```php
136+
$input = new Zend\InputFilter\Input();
137+
$input->setContinueIfEmpty(true);
138+
$input->setAllowEmpty(true);
139+
$input->getValidatorChain()->attach(new Zend\Validator\NotEmpty(), /* break chain on failure */ true);
140+
```
141+
142+
### Removed
143+
144+
- Nothing.
145+
146+
### Fixed
147+
148+
- Nothing.
149+
124150
## 2.4.7 - 2015-08-11
125151

126152
### Added

src/EmptyContextInterface.php

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,15 +9,22 @@
99

1010
namespace Zend\InputFilter;
1111

12+
/**
13+
* @deprecated 2.4.8 Add Zend\Validator\NotEmpty validator to the ValidatorChain.
14+
*/
1215
interface EmptyContextInterface
1316
{
1417
/**
18+
* @deprecated 2.4.8 Add Zend\Validator\NotEmpty validator to the ValidatorChain and set this to `true`.
19+
*
1520
* @param bool $continueIfEmpty
1621
* @return self
1722
*/
1823
public function setContinueIfEmpty($continueIfEmpty);
1924

2025
/**
26+
* @deprecated 2.4.8 Add Zend\Validator\NotEmpty validator to the ValidatorChain. Should always return `true`.
27+
*
2128
* @return bool
2229
*/
2330
public function continueIfEmpty();

src/FileInput.php

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -187,6 +187,8 @@ protected function injectUploadValidator()
187187
}
188188

189189
/**
190+
* @deprecated 2.4.8 See note on parent class. Removal does not affect this class.
191+
*
190192
* No-op, NotEmpty validator does not apply for FileInputs.
191193
* See also: BaseInputFilter::isValid()
192194
*

src/Input.php

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,11 +19,15 @@ class Input implements
1919
EmptyContextInterface
2020
{
2121
/**
22+
* @deprecated 2.4.8 Add Zend\Validator\NotEmpty validator to the ValidatorChain.
23+
*
2224
* @var bool
2325
*/
2426
protected $allowEmpty = false;
2527

2628
/**
29+
* @deprecated 2.4.8 Add Zend\Validator\NotEmpty validator to the ValidatorChain.
30+
*
2731
* @var bool
2832
*/
2933
protected $continueIfEmpty = false;
@@ -49,6 +53,8 @@ class Input implements
4953
protected $name;
5054

5155
/**
56+
* @deprecated 2.4.8 Add Zend\Validator\NotEmpty validator to the ValidatorChain.
57+
*
5258
* @var bool
5359
*/
5460
protected $notEmptyValidator = false;
@@ -91,6 +97,8 @@ public function __construct($name = null)
9197
}
9298

9399
/**
100+
* @deprecated 2.4.8 Add Zend\Validator\NotEmpty validator to the ValidatorChain and set this to `true`.
101+
*
94102
* @param bool $allowEmpty
95103
* @return Input
96104
*/
@@ -111,6 +119,8 @@ public function setBreakOnFailure($breakOnFailure)
111119
}
112120

113121
/**
122+
* @deprecated 2.4.8 Add Zend\Validator\NotEmpty validator to the ValidatorChain and set this to `true`.
123+
*
114124
* @param bool $continueIfEmpty
115125
* @return Input
116126
*/
@@ -216,6 +226,8 @@ public function setFallbackValue($value)
216226
}
217227

218228
/**
229+
* @deprecated 2.4.8 Add Zend\Validator\NotEmpty validator to the ValidatorChain.
230+
*
219231
* @return bool
220232
*/
221233
public function allowEmpty()
@@ -232,6 +244,8 @@ public function breakOnFailure()
232244
}
233245

234246
/**
247+
* @deprecated 2.4.8 Add Zend\Validator\NotEmpty validator to the ValidatorChain. Should always return `true`.
248+
*
235249
* @return bool
236250
*/
237251
public function continueIfEmpty()
@@ -429,6 +443,8 @@ public function getMessages()
429443
}
430444

431445
/**
446+
* @deprecated 2.4.8 Add Zend\Validator\NotEmpty validator to the ValidatorChain.
447+
*
432448
* @return void
433449
*/
434450
protected function injectNotEmptyValidator()

src/InputInterface.php

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,8 @@
1515
interface InputInterface
1616
{
1717
/**
18+
* @deprecated 2.4.8 Add Zend\Validator\NotEmpty validator to the ValidatorChain and set this to `true`.
19+
*
1820
* @param bool $allowEmpty
1921
* @return self
2022
*/
@@ -69,6 +71,8 @@ public function setValue($value);
6971
public function merge(InputInterface $input);
7072

7173
/**
74+
* @deprecated 2.4.8 Add Zend\Validator\NotEmpty validator to the ValidatorChain.
75+
*
7276
* @return bool
7377
*/
7478
public function allowEmpty();

0 commit comments

Comments
 (0)