Julien Fastré 5be85a4fc6
Refactored code to use PHP8 attributes instead of annotations
In this change, Doctrine and validation annotations have been replaced with PHP8 Attributes. The Rector tool has been configured with a list of annotations to convert to attributes. As a consequence, the PHPStan's rules have been updated to reflect these changes. The PHP8's nullable operator (?) has been added where required, and comments in field declaration have been replaced with #[Attribute] syntax.
2024-04-08 12:11:29 +02:00

33 lines
958 B
PHP

<?php
declare(strict_types=1);
/*
* Chill is a software for social workers
*
* For the full copyright and license information, please view
* the LICENSE file that was distributed with this source code.
*/
namespace Chill\PersonBundle\Validator\Constraints\Person;
use Symfony\Component\Validator\Constraint;
/**
* Create a constraint on birth date: the birthdate after today are not allowed.
*
* It is possible to add a delay before today, expressed as described in
* interval_spec : http://php.net/manual/en/dateinterval.construct.php
* (this interval_spec itself is based on ISO8601 :
* https://en.wikipedia.org/wiki/ISO_8601#Durations)
*/
#[\Attribute(\Attribute::TARGET_PROPERTY)]
class Birthdate extends Constraint
{
final public const BIRTHDATE_INVALID_CODE = '3f42fd96-0b2d-11ec-8cf3-0f3b1b1ca1c4';
public $message = 'The birthdate must be before %date%';
public $belowMessage = 'The birthdate must be after %date%';
}