22 KiB
22 KiB
CHANGELOG
7.1
- Deprecate not passing a value for the
requireTld
option to theUrl
constraint (the default value will becometrue
in 8.0) - Add the calculated strength to violations in
PasswordStrengthValidator
- Add support for
Stringable
values when using theCidr
,CssColor
,ExpressionSyntax
andPasswordStrength
constraints - Add
MacAddress
constraint - Add
*_NO_PUBLIC
,*_ONLY_PRIVATE
and*_ONLY_RESERVED
versions toIp
constraint - Possibility to use all
Ip
constraint versions forCidr
constraint - Add
list
andassociative_array
types toType
constraint - Add the
Charset
constraint - Add the
requireTld
option to theUrl
constraint - Deprecate
Bic::INVALID_BANK_CODE_ERROR
7.0
- Add methods
getConstraint()
,getCause()
and__toString()
toConstraintViolationInterface
- Add method
__toString()
toConstraintViolationListInterface
- Add method
disableTranslation()
toConstraintViolationBuilderInterface
- Remove static property
$errorNames
from all constraints, use constERROR_NAMES
instead - Remove static property
$versions
from theIp
constraint, use theVERSIONS
constant instead - Remove
VALIDATION_MODE_LOOSE
fromEmail
constraint, useVALIDATION_MODE_HTML5
instead - Remove constraint
ExpressionLanguageSyntax
, useExpressionSyntax
instead - Remove Doctrine annotations support in favor of native attributes
- Remove the annotation reader parameter from the constructor signature of
AnnotationLoader
- Remove
ValidatorBuilder::setDoctrineAnnotationReader()
- Remove
ValidatorBuilder::addDefaultDoctrineAnnotationReader()
- Remove
ValidatorBuilder::enableAnnotationMapping()
, useValidatorBuilder::enableAttributeMapping()
instead - Remove
ValidatorBuilder::disableAnnotationMapping()
, useValidatorBuilder::disableAttributeMapping()
instead - Remove
AnnotationLoader
, useAttributeLoader
instead
6.4
- Add
is_valid
function to theExpression
constraint, its behavior is the same asValidatorInterface::validate
- Allow single integer for the
versions
option of theUuid
constraint - Allow single constraint to be passed to the
constraints
option of theWhen
constraint - Deprecate Doctrine annotations support in favor of native attributes
- Deprecate
ValidatorBuilder::setDoctrineAnnotationReader()
- Deprecate
ValidatorBuilder::addDefaultDoctrineAnnotationReader()
- Add
number
,finite-number
andfinite-float
types toType
constraint - Add the
withSeconds
option to theTime
constraint that allows to pass time without seconds - Deprecate
ValidatorBuilder::enableAnnotationMapping()
, useValidatorBuilder::enableAttributeMapping()
instead - Deprecate
ValidatorBuilder::disableAnnotationMapping()
, useValidatorBuilder::disableAttributeMapping()
instead - Deprecate
AnnotationLoader
, useAttributeLoader
instead - Add
GroupProviderInterface
to implement validation group providers outside the underlying class
6.3
- Add method
getConstraint()
toConstraintViolationInterface
- Add
Uuid::TIME_BASED_VERSIONS
to match that a UUID being validated embeds a timestamp - Add the
pattern
parameter in violations of theRegex
constraint - Add a
NoSuspiciousCharacters
constraint to validate a string is not a spoofing attempt - Add a
PasswordStrength
constraint to check the strength of a password - Add the
countUnit
option to theLength
constraint to allow counting the string length either by code points (like before, now the default settingLength::COUNT_CODEPOINTS
), bytes (Length::COUNT_BYTES
) or graphemes (Length::COUNT_GRAPHEMES
) - Add the
filenameMaxLength
option to theFile
constraint - Add the
exclude
option to theCascade
constraint - Add the
value_length
parameter toLength
constraint - Allow to disable the translation domain for
ConstraintViolationInterface
messages
6.2
- Add option
Email::VALIDATION_MODE_HTML5_ALLOW_NO_TLD
with "html5-allow-no-tld" e-mail validation mode, to match with the W3C official specification - Add method
getCause()
toConstraintViolationInterface
- Add the
When
constraint and validator - Deprecate the "loose" e-mail validation mode, use "html5" instead
- Add the
negate
option to theExpression
constraint, to inverse the logic of the violation's creation - Add the
extensions
option to theFile
constraint as an alternative tomimeTypes
which checks the mime type of the file, its extension, and the consistency between them - Add padding for enhanced privacy to the
NotCompromisedPasswordValidator
6.1
- Add the
fields
option to theUnique
constraint, to define which collection keys should be checked for uniqueness - Deprecate
Constraint::$errorNames
, useConstraint::ERROR_NAMES
instead - Deprecate constraint
ExpressionLanguageSyntax
, useExpressionSyntax
instead - Add method
__toString()
toConstraintViolationInterface
&ConstraintViolationListInterface
- Allow creating constraints with required arguments
- Add the
match
option to theChoice
constraint
6.0
- Remove the
allowEmptyString
option from theLength
constraint - Remove the
NumberConstraintTrait
trait ValidatorBuilder::enableAnnotationMapping()
does not accept a Doctrine annotation reader anymoreValidatorBuilder::enableAnnotationMapping()
won't automatically setup a Doctrine annotation reader anymore
5.4
- Add a
Cidr
constraint to validate CIDR notations - Add a
CssColor
constraint to validate CSS colors - Add support for
ConstraintViolationList::createFromMessage()
- Add error's uid to
Count
andLength
constraints with "exactly" option enabled
5.3
- Add the
normalizer
option to theUnique
constraint - Add
Validation::createIsValidCallable()
that returns true/false instead of throwing exceptions
5.2.0
-
added a
Cascade
constraint to ease validating nested typed object properties -
deprecated the
allowEmptyString
option of theLength
constraintBefore:
use Symfony\Component\Validator\Constraints as Assert; /** * @Assert\Length(min=5, allowEmptyString=true) */
After:
use Symfony\Component\Validator\Constraints as Assert; /** * @Assert\AtLeastOneOf({ * @Assert\Blank(), * @Assert\Length(min=5) * }) */
-
added the
Isin
constraint and validator -
added the
ULID
constraint and validator -
added support for UUIDv6 in
Uuid
constraint -
enabled the validator to load constraints from PHP attributes
-
deprecated the
NumberConstraintTrait
trait -
deprecated setting or creating a Doctrine annotation reader via
ValidatorBuilder::enableAnnotationMapping()
, passtrue
as first parameter and additionally callsetDoctrineAnnotationReader()
oraddDefaultDoctrineAnnotationReader()
to set up the annotation reader
5.1.0
- Add
AtLeastOneOf
constraint that is considered to be valid if at least one of the nested constraints is valid - added the
Hostname
constraint and validator - added the
alpha3
option to theCountry
andLanguage
constraints - allow to define a reusable set of constraints by extending the
Compound
constraint - added
Sequentially
constraint, to sequentially validate a set of constraints (any violation raised will prevent further validation of the nested constraints) - added the
divisibleBy
option to theCount
constraint - added the
ExpressionLanguageSyntax
constraint
5.0.0
- an
ExpressionLanguage
instance or null must be passed as the first argument ofExpressionValidator::__construct()
- removed the
checkDNS
anddnsMessage
options of theUrl
constraint - removed the
checkMX
,checkHost
andstrict
options of theEmail
constraint - removed support for validating instances of
\DateTimeInterface
inDateTimeValidator
,DateValidator
andTimeValidator
- removed support for using the
Bic
,Country
,Currency
,Language
andLocale
constraints withoutsymfony/intl
- removed support for using the
Email
constraint withoutegulias/email-validator
- removed support for using the
Expression
constraint withoutsymfony/expression-language
- changed default value of
canonicalize
option ofLocale
constraint totrue
- removed
ValidatorBuilderInterface
- passing a null message when instantiating a
ConstraintViolation
is not allowed - changed the default value of
Length::$allowEmptyString
tofalse
and made it optional - removed
Symfony\Component\Validator\Mapping\Cache\CacheInterface
in favor of PSR-6. - removed
ValidatorBuilder::setMetadataCache
, useValidatorBuilder::setMappingCache
instead.
4.4.0
- [BC BREAK] using null as
$classValidatorRegexp
value inPropertyInfoLoader::__construct
will not enable auto-mapping for all classes anymore, use'{.*}'
instead. - added
EnableAutoMapping
andDisableAutoMapping
constraints to enable or disable auto mapping for class or a property - using anything else than a
string
as the code of aConstraintViolation
is deprecated, astring
type-hint will be added to the constructor of theConstraintViolation
class and to theConstraintViolationBuilder::setCode()
method in 5.0 - deprecated passing an
ExpressionLanguage
instance as the second argument ofExpressionValidator::__construct()
. Pass it as the first argument instead. - added the
compared_value_path
parameter in violations when using any comparison constraint with thepropertyPath
option. - added support for checking an array of types in
TypeValidator
- added a new
allowEmptyString
option to theLength
constraint to allow rejecting empty strings whenmin
is set, by setting it tofalse
. - Added new
minPropertyPath
andmaxPropertyPath
options toRange
constraint in order to get the value to compare from an array or object - added the
min_limit_path
andmax_limit_path
parameters in violations when usingRange
constraint with respectively theminPropertyPath
andmaxPropertyPath
options - added a new
notInRangeMessage
option to theRange
constraint that will be used in the violation builder when bothmin
andmax
are not null - added ability to use stringable objects as violation messages
- Overriding the methods
ConstraintValidatorTestCase::setUp()
andConstraintValidatorTestCase::tearDown()
without thevoid
return-type is deprecated. - deprecated
Symfony\Component\Validator\Mapping\Cache\CacheInterface
in favor of PSR-6. - deprecated
ValidatorBuilder::setMetadataCache
, useValidatorBuilder::setMappingCache
instead. - Marked the
ValidatorDataCollector
class as@final
.
4.3.0
- added
Timezone
constraint - added
NotCompromisedPassword
constraint - added options
iban
andibanPropertyPath
to Bic constraint - added UATP cards support to
CardSchemeValidator
- added option
allowNull
to NotBlank constraint - added
Json
constraint - added
Unique
constraint - added a new
normalizer
option to the string constraints and to theNotBlank
constraint - added
Positive
constraint - added
PositiveOrZero
constraint - added
Negative
constraint - added
NegativeOrZero
constraint
4.2.0
- added a new
UnexpectedValueException
that can be thrown by constraint validators, these exceptions are caught by the validator and are converted into constraint violations - added
DivisibleBy
constraint - decoupled from
symfony/translation
by usingSymfony\Contracts\Translation\TranslatorInterface
- deprecated
ValidatorBuilderInterface
- made
ValidatorBuilder::setTranslator()
final - marked
format
the default option inDateTime
constraint - deprecated validating instances of
\DateTimeInterface
inDateTimeValidator
,DateValidator
andTimeValidator
. - deprecated using the
Bic
,Country
,Currency
,Language
andLocale
constraints withoutsymfony/intl
- deprecated using the
Email
constraint withoutegulias/email-validator
- deprecated using the
Expression
constraint withoutsymfony/expression-language
4.1.0
- Deprecated the
checkDNS
anddnsMessage
options of theUrl
constraint. - added a
values
option to theExpression
constraint - Deprecated use of
Locale
constraint without settingtrue
at "canonicalize" option, which will be the default value in 5.0
4.0.0
- Setting the
strict
option of theChoice
constraint to anything buttrue
is not supported anymore. - removed the
DateTimeValidator::PATTERN
constant - removed the
AbstractConstraintValidatorTest
class - removed support for setting the
checkDNS
option of theUrl
constraint totrue
3.4.0
- added support for validation groups to the
Valid
constraint - not setting the
strict
option of theChoice
constraint totrue
is deprecated and will throw an exception in Symfony 4.0 - setting the
checkDNS
option of theUrl
constraint totrue
is deprecated in favor of theUrl::CHECK_DNS_TYPE_*
constants values and will throw an exception in Symfony 4.0 - added min/max amount of pixels check to
Image
constraint viaminPixels
andmaxPixels
- added a new "propertyPath" option to comparison constraints in order to get the value to compare from an array or object
3.3.0
- added
AddValidatorInitializersPass
- added
AddConstraintValidatorsPass
- added
ContainerConstraintValidatorFactory
3.2.0
- deprecated
Tests\Constraints\AbstractConstraintValidatorTest
in favor ofTest\ConstraintValidatorTestCase
- added support for PHP constants in YAML configuration files
3.1.0
- deprecated
DateTimeValidator::PATTERN
constant - added a
format
option to theDateTime
constraint
2.8.0
- added the BIC (SWIFT-Code) validator
2.7.0
- deprecated
DefaultTranslator
in favor ofSymfony\Component\Translation\IdentityTranslator
- deprecated PHP7-incompatible constraints (Null, True, False) and related validators (NullValidator, TrueValidator, FalseValidator) in favor of their
Is
-prefixed equivalent
2.6.0
- [BC BREAK]
FileValidator
disallow empty files - [BC BREAK]
UserPasswordValidator
source message change - [BC BREAK] added internal
ExecutionContextInterface::setConstraint()
- added
ConstraintViolation::getConstraint()
- [BC BREAK] The
ExpressionValidator
will now evaluate the Expression even when the property value is null or an empty string - deprecated
ClassMetadata::hasMemberMetadatas()
- deprecated
ClassMetadata::getMemberMetadatas()
- deprecated
ClassMetadata::addMemberMetadata()
- [BC BREAK] added
Mapping\MetadataInterface::getConstraints()
- added generic "payload" option to all constraints for attaching domain-specific data
- [BC BREAK] added
ConstraintViolationBuilderInterface::setCause()
2.5.0
- deprecated
ApcCache
in favor ofDoctrineCache
- added
DoctrineCache
to adapt any Doctrine cache GroupSequence
now implementsArrayAccess
,Countable
andTraversable
- [BC BREAK] changed
ClassMetadata::getGroupSequence()
to return aGroupSequence
instance instead of an array Callback
can now be put onto properties (useful when you pass a closure to the constraint)- deprecated
ClassBasedInterface
- deprecated
MetadataInterface
- deprecated
PropertyMetadataInterface
- deprecated
PropertyMetadataContainerInterface
- deprecated
Mapping\ElementMetadata
- added
Mapping\MetadataInterface
- added
Mapping\ClassMetadataInterface
- added
Mapping\PropertyMetadataInterface
- added
Mapping\GenericMetadata
- added
Mapping\CascadingStrategy
- added
Mapping\TraversalStrategy
- deprecated
Mapping\ClassMetadata::accept()
- deprecated
Mapping\MemberMetadata::accept()
- removed array type hint of
Mapping\ClassMetadata::setGroupSequence()
- deprecated
MetadataFactoryInterface
- deprecated
Mapping\BlackholeMetadataFactory
- deprecated
Mapping\ClassMetadataFactory
- added
Mapping\Factory\MetadataFactoryInterface
- added
Mapping\Factory\BlackHoleMetadataFactory
- added
Mapping\Factory\LazyLoadingMetadataFactory
- deprecated
ExecutionContextInterface
- deprecated
ExecutionContext
- deprecated
GlobalExecutionContextInterface
- added
Context\ExecutionContextInterface
- added
Context\ExecutionContext
- added
Context\ExecutionContextFactoryInterface
- added
Context\ExecutionContextFactory
- deprecated
ValidatorInterface
- deprecated
Validator
- deprecated
ValidationVisitorInterface
- deprecated
ValidationVisitor
- added
Validator\ValidatorInterface
- added
Validator\RecursiveValidator
- added
Validator\ContextualValidatorInterface
- added
Validator\RecursiveContextualValidator
- added
Violation\ConstraintViolationBuilderInterface
- added
Violation\ConstraintViolationBuilder
- added
ConstraintViolation::getParameters()
- added
ConstraintViolation::getPlural()
- added
Constraints\Traverse
- deprecated
$deep
property inConstraints\Valid
- added
ValidatorBuilderInterface::setApiVersion()
- added
Validation::API_VERSION_2_4
- added
Validation::API_VERSION_2_5
- added
Exception\OutOfBoundsException
- added
Exception\UnsupportedMetadataException
- made
Exception\ValidatorException
extendException\RuntimeException
- added
Util\PropertyPath
- made the PropertyAccess component an optional dependency
- deprecated
ValidatorBuilder::setPropertyAccessor()
- deprecated
validate
andvalidateValue
onValidator\Context\ExecutionContext
usegetValidator()
together withinContext()
instead
2.4.0
- added a constraint the uses the expression language
- added
minRatio
,maxRatio
,allowSquare
,allowLandscape
, andallowPortrait
to Image validator
2.3.29
- fixed compatibility with PHP7 and up by introducing new constraints (IsNull, IsTrue, IsFalse) and related validators (IsNullValidator, IsTrueValidator, IsFalseValidator)
2.3.0
- added the ISBN, ISSN, and IBAN validators
- copied the constraints
Optional
andRequired
to theSymfony\Component\Validator\Constraints\
namespace and deprecated the original classes. - added comparison validators (EqualTo, NotEqualTo, LessThan, LessThanOrEqualTo, GreaterThan, GreaterThanOrEqualTo, IdenticalTo, NotIdenticalTo)
2.2.0
- added a CardScheme validator
- added a Luhn validator
- moved @api-tags from
Validator
toValidatorInterface
- moved @api-tags from
ConstraintViolation
to the newConstraintViolationInterface
- moved @api-tags from
ConstraintViolationList
to the newConstraintViolationListInterface
- moved @api-tags from
ExecutionContext
to the newExecutionContextInterface
- [BC BREAK]
ConstraintValidatorInterface::initialize
is now type hinted againstExecutionContextInterface
instead ofExecutionContext
- [BC BREAK] changed the visibility of the properties in
Validator
from protected to private - deprecated
ClassMetadataFactoryInterface
in favor of the newMetadataFactoryInterface
- deprecated
ClassMetadataFactory::getClassMetadata
in favor ofgetMetadataFor
- created
MetadataInterface
,PropertyMetadataInterface
,ClassBasedInterface
andPropertyMetadataContainerInterface
- deprecated
GraphWalker
in favor of the newValidationVisitorInterface
- deprecated
ExecutionContext::addViolationAtPath
- deprecated
ExecutionContext::addViolationAtSubPath
in favor ofExecutionContextInterface::addViolationAt
- deprecated
ExecutionContext::getCurrentClass
in favor ofExecutionContextInterface::getClassName
- deprecated
ExecutionContext::getCurrentProperty
in favor ofExecutionContextInterface::getPropertyName
- deprecated
ExecutionContext::getCurrentValue
in favor ofExecutionContextInterface::getValue
- deprecated
ExecutionContext::getGraphWalker
in favor ofExecutionContextInterface::validate
andExecutionContextInterface::validateValue
- improved
ValidatorInterface::validateValue
to accept arrays of constraints - changed
ValidatorInterface::getMetadataFactory
to return aMetadataFactoryInterface
instead of aClassMetadataFactoryInterface
- removed
ClassMetadataFactoryInterface
type hint fromValidatorBuilderInterface::setMetadataFactory
. As of Symfony 2.3, this method will be typed againstMetadataFactoryInterface
instead. - [BC BREAK] the switches
traverse
anddeep
in theValid
constraint and inGraphWalker::walkReference
are ignored for arrays now. Arrays are always traversed recursively. - added dependency to Translation component
- violation messages are now translated with a TranslatorInterface implementation
- [BC BREAK] inserted argument
$message
in the constructor ofConstraintViolation
- [BC BREAK] inserted arguments
$translator
and$translationDomain
in the constructor ofExecutionContext
- [BC BREAK] inserted arguments
$translator
and$translationDomain
in the constructor ofGraphWalker
- [BC BREAK] inserted arguments
$translator
and$translationDomain
in the constructor ofValidationVisitor
- [BC BREAK] inserted arguments
$translator
and$translationDomain
in the constructor ofValidator
- [BC BREAK] added
setTranslator()
andsetTranslationDomain()
toValidatorBuilderInterface
- improved the Validator to support pluralized messages by default
- [BC BREAK] changed the source of all pluralized messages in the translation files to the pluralized version
- added ExceptionInterface, BadMethodCallException and InvalidArgumentException
2.1.0
- added support for
ctype_*
assertions inTypeValidator
- improved the ImageValidator with min width, max width, min height, and max height constraints
- added support for MIME with wildcard in FileValidator
- changed Collection validator to add "missing" and "extra" errors to individual fields
- changed default value for
extraFieldsMessage
andmissingFieldsMessage
in Collection constraint - made ExecutionContext immutable
- deprecated Constraint methods
setMessage
,getMessageTemplate
andgetMessageParameters
- added support for dynamic group sequences with the GroupSequenceProvider pattern
- [BC BREAK] ConstraintValidatorInterface method
isValid
has been renamed tovalidate
, its return value was dropped. ConstraintValidator still containsisValid
for BC - [BC BREAK] collections in fields annotated with
Valid
are not traversed recursively anymore by default.Valid
contains a new propertydeep
which enables the BC behavior. - added Count constraint
- added Length constraint
- added Range constraint
- deprecated the Min and Max constraints
- deprecated the MinLength and MaxLength constraints
- added Validation and ValidatorBuilderInterface
- deprecated ValidatorContext, ValidatorContextInterface and ValidatorFactory