Releases: Respect/Validation
1.1.15
1.0.20
First release of 1.1 series
The Respect development team announces the immediate availability of
Respect\Validation 1.1.0.
This version is going to be supported until 2018-08-24.
This release adds 6 new rules, some improvements and some bug fixes.
Another version of this file is available with the source on the
CHANGELOG.md file.
New rules
Fibonacci
IdentityCard
Image
LanguageCode
Pesel
PhpLabel
Improvements
- Allow the define brands for credit card validation
- Define names for the child of Not rule
- Ensure namespace separator on appended prefixes
- Length gets length of integers
- Set template for the only rule in the chain
- Throw an exception when age is not an integer
- Use "{less/greater} than or equal to" phrasing
First major release
The Respect development team announces the immediate availability of
Respect\Validation 1.0.0.
This version is going to be supported until 2017-02-24.
This release adds 26 new rules, add some features (specially on exceptions),
removes existing features, and fixes some bugs.
Another version of this file is available with the source on the
CHANGELOG.md file.
We would like to thanks to the PHPSP community for all the support on the
first TestFest Respect\Validation, that brings us 51 commits, 135 created
integration tests, 12 improved unit tests, 2 bugs found, 4 new rules and 1
improved rule: you guys are awesome!
New rules
BoolVal
;Bsn
;CallableType
;Countable
;CurrencyCode
;Extension
;Factor
;Finite
;FloatType
;Identical
;Imei
;Infinite
;IntType
;Iterable
;KeyNested
;KeySet
;KeyValue
;Mimetype
;NotBlank
;NotOptional
;Optional
;ResourceType
;ScalarVal
;Size
;SubdivisionCode
(252 countries);VideoUrl
.
New features
The main new features are related to the exceptions:
- Nested messages are now displayed on a Markdown list format;
- Does not display parent message if the rule has only one child;
- Creates method
getMessages()
for nested exceptions
(NestedValidationException
); - Converts
Array
to string; - Converts
Exception
to string; - Converts
Traversable
to string; - Converts resources to string;
- Improves
Object
conversion to string; - Improves conversion of all values by using JSON.
But also there are a few improvements for some rules:
- Adds
alpha-3
andnumeric
formats forCountryCode
rule - Adds
{{countryCode}}
to the message ofPostalCode
exception rule - Adds generic top-level domains
Bug fixes
- Nested exceptions with missing keys did not display the proper message
AbstractRelated
(Attribute
,Call
andKey
rules) defines names for
children rulesTrue
andFalse
rules (nowTrueVal
andFalseVal
) had an awkward
behavior, now they usefilter_var()
withFILTER_VALIDATE_BOOLEAN
to
validate their inputs
PHP support
- Drops support for PHP 5.3
- Adds support for PHP 7
Backwards Compatibility Breaks
The main change of this version it that, despite what happens since version
0.6, now all rules are mandatory, so they do not accept an empty string
(''
) as valid value, and because of this you don't need to add NotEmpty
to every chain you want as mandatory. That change was only made after many
opened bugs reporting problems on this feature and since this feature cannot
work property with the code-base we have without an ugly hard-coded workaround.
Plus, there were lots of people complaining about what should be optional or
not, and many of them consider null
as an optional value too.
However, you're still able work with optional values (that now are an empty
string ''
and null
) by using the Optional
rule:
v::optional(v::intType())->validate(''); // true
v::optional(v::intType())->validate(null); // true
Also, there is the NotOptional
rule that may be very useful for you when
dealing with non-optional values.
Some rule needed to be renamed to be compatible with PHP 7:
Bool
toBoolType
False
toFalseVal
Float
toFloatVal
Int
toIntVal
String
toStringType
True
toTrueVal
Then, to keep consistency, other rules got renamed as well:
Arr
toArrayVal
NullValue
toNullType
Object
toObjectType
The old Arr
rule, now ArrayVal
, got splitted into 4 rules:
ArrayVal
: validates if the input is an array or if the input can be used as
an array;ArrayType
: validates whether the type of the input is array;Countable
: validates if the input is countable, in other words, if you're
able to use count() function on it;Iterable
: validates if the input is iterable, in other words, if you're
able to iterate over it with foreach language
construct.
The Equals
rule got splitted into 2 rules:
Equals
: validates if the input is equal to some value, with not longer
supports the second argument on its constructor for identical checking;Identical
: Validates if the input is identical to some value.
Rules that validate intervals are now inclusive, by default:
Between
Max
Min
Some exception classes had the Abstract
prefix, but they were not really
abstract, then they got renamed:
AbstractGroupedException
toGroupedValidationException
AbstractNestedException
toNestedValidationException
Some exception interfaces were not really necessary, then they got removed:
NestedValidationExceptionInterface
:
Ontry/catch
blocks you can simply useNestedValidationException
insteadValidationExceptionInterface
:
Ontry/catch
blocks you can simply useValidationException
instead
All deprecated rules were removed:
Consonants
in favor ofConsonant
;Digits
: in favor ofDigit
Hexa
in favor ofXdigits
;Vowels
: in favor ofVowel
Also, all shortcuts were removed:
addOr()
shortcutnot()
shortcut
First release of 0.9 series
Fix wrong behavior on AbstractRelated class
Fix wrong behavior on AbstractRelated class
AbstractRelated is accepts '' as valid by default
AbstractRelated is accepts '' as valid by default
First release of 0.8 series
New rules
bank()
(#188 by @malkusch - only german support)bankAccount()
(#188 by @malkusch - only german support)bic()
(#188 by @malkusch - only german support)false()
(#263 by @henriquemoody)filterVar()
(#267 by @henriquemoody)true()
(#263 by @henriquemoody)type()
(#280 by @henriquemoody)url()
(#269 by @henriquemoody)
Updated rules
max()
(#292 by @henriquemoody): better support for date and time comparisonmin()
(#292 by @henriquemoody): better support for date and time comparisonwhen()
(#247 by @henriquemoody): allow to use rule without else's constraint
Other changes
- #176: Allow to define custom rule's namespaces/prefixes (by @henriquemoody)
- #261: Remove dead code on AbstractRule (by @henriquemoody)
- #265: Performance optimization in NumberPrime.php (by @camilotx)
- #272: Now using Respect\Validation exceptions only (by @AndyWendt)
- #279: Update contributing guidelines (by @henriquemoody)
- #288: Optimize PrimeNumber rule (by @l-x)
- #289: Make Roman rule internally use Regex rule (by @l-x)
- #290: Remove allow failures on HHVM builds (by @henriquemoody)