diff --git a/reference/constraints/Date.rst b/reference/constraints/Date.rst index 50d19102028..2d77b57e8f4 100644 --- a/reference/constraints/Date.rst +++ b/reference/constraints/Date.rst @@ -1,9 +1,8 @@ Date ==== -Validates that a value is a valid date, meaning either a ``DateTime`` object -or a string (or an object that can be cast into a string) that follows a -valid YYYY-MM-DD format. +Validates that a value is a valid date, meaning a string (or an object that can be cast into a string) +that follows a valid YYYY-MM-DD format. +----------------+--------------------------------------------------------------------+ | Applies to | :ref:`property or method ` | @@ -32,6 +31,7 @@ Basic Usage { /** * @Assert\Date() + * @var string A "Y-m-d" formatted value */ protected $birthday; } @@ -69,6 +69,11 @@ Basic Usage class Author { + /** + * @var string A "Y-m-d" formatted value + */ + protected $birthday; + public static function loadValidatorMetadata(ClassMetadata $metadata) { $metadata->addPropertyConstraint('birthday', new Assert\Date()); diff --git a/reference/constraints/DateTime.rst b/reference/constraints/DateTime.rst index f9473915ae4..00ecc3ae181 100644 --- a/reference/constraints/DateTime.rst +++ b/reference/constraints/DateTime.rst @@ -1,9 +1,8 @@ DateTime ======== -Validates that a value is a valid "datetime", meaning either a ``DateTime`` -object or a string (or an object that can be cast into a string) that follows -a specific format. +Validates that a value is a valid "datetime", meaning a string (or an object that can be cast into a string) +that follows a specific format. +----------------+------------------------------------------------------------------------+ | Applies to | :ref:`property or method ` | @@ -33,6 +32,7 @@ Basic Usage { /** * @Assert\DateTime() + * @var string A "Y-m-d H:i:s" formatted value */ protected $createdAt; } @@ -70,6 +70,11 @@ Basic Usage class Author { + /** + * @var string A "Y-m-d H:i:s" formatted value + */ + protected $createdAt; + public static function loadValidatorMetadata(ClassMetadata $metadata) { $metadata->addPropertyConstraint('createdAt', new Assert\DateTime()); diff --git a/reference/constraints/Time.rst b/reference/constraints/Time.rst index 9f0ca58b5f2..5907348a8bf 100644 --- a/reference/constraints/Time.rst +++ b/reference/constraints/Time.rst @@ -1,8 +1,7 @@ Time ==== -Validates that a value is a valid time, meaning an object implementing -``DateTimeInterface`` or a string (or an object that can be cast into a string) +Validates that a value is a valid time, meaning a string (or an object that can be cast into a string) that follows a valid ``HH:MM:SS`` format. +----------------+------------------------------------------------------------------------+ @@ -35,6 +34,7 @@ of the day when the event starts: { /** * @Assert\Time() + * @var string A "H:i:s" formatted value */ protected $startsAt; } @@ -72,6 +72,11 @@ of the day when the event starts: class Event { + /** + * @var string A "H:i:s" formatted value + */ + protected $startsAt; + public static function loadValidatorMetadata(ClassMetadata $metadata) { $metadata->addPropertyConstraint('startsAt', new Assert\Time());