mirror of
https://gitlab.com/Chill-Projet/chill-bundles.git
synced 2025-08-20 22:53:49 +00:00
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.
This commit is contained in:
@@ -13,9 +13,7 @@ namespace Chill\PersonBundle\Validator\Constraints\AccompanyingPeriod;
|
||||
|
||||
use Symfony\Component\Validator\Constraint;
|
||||
|
||||
/**
|
||||
* @Annotation
|
||||
*/
|
||||
#[\Attribute(\Attribute::TARGET_CLASS)]
|
||||
class AccompanyingPeriodValidity extends Constraint
|
||||
{
|
||||
public $messageSocialIssueCannotBeDeleted = 'The social %name% issue cannot be deleted because it is associated with an activity or an action';
|
||||
|
@@ -13,9 +13,7 @@ namespace Chill\PersonBundle\Validator\Constraints\AccompanyingPeriod;
|
||||
|
||||
use Symfony\Component\Validator\Constraint;
|
||||
|
||||
/**
|
||||
* @Annotation
|
||||
*/
|
||||
#[\Attribute(\Attribute::TARGET_CLASS)]
|
||||
class ConfidentialCourseMustHaveReferrer extends Constraint
|
||||
{
|
||||
public string $message = 'A confidential parcours must have a referrer';
|
||||
|
@@ -13,9 +13,7 @@ namespace Chill\PersonBundle\Validator\Constraints\AccompanyingPeriod;
|
||||
|
||||
use Symfony\Component\Validator\Constraint;
|
||||
|
||||
/**
|
||||
* @Annotation
|
||||
*/
|
||||
#[\Attribute(\Attribute::TARGET_CLASS)]
|
||||
class LocationValidity extends Constraint
|
||||
{
|
||||
public $messagePeriodMustRemainsLocated = 'The period must remain located';
|
||||
|
@@ -13,9 +13,7 @@ namespace Chill\PersonBundle\Validator\Constraints\AccompanyingPeriod;
|
||||
|
||||
use Symfony\Component\Validator\Constraint;
|
||||
|
||||
/**
|
||||
* @Annotation
|
||||
*/
|
||||
#[\Attribute(\Attribute::TARGET_PROPERTY)]
|
||||
class ParticipationOverlap extends Constraint
|
||||
{
|
||||
public $message = '{{ name }} is already associated to this accompanying course.';
|
||||
|
@@ -13,9 +13,7 @@ namespace Chill\PersonBundle\Validator\Constraints\AccompanyingPeriod;
|
||||
|
||||
use Symfony\Component\Validator\Constraint;
|
||||
|
||||
/**
|
||||
* @Annotation
|
||||
*/
|
||||
#[\Attribute(\Attribute::TARGET_PROPERTY)]
|
||||
class ResourceDuplicateCheck extends Constraint
|
||||
{
|
||||
public $message = '{{ name }} is already associated to this accompanying course.';
|
||||
|
@@ -13,9 +13,7 @@ namespace Chill\PersonBundle\Validator\Constraints\Household;
|
||||
|
||||
use Symfony\Component\Validator\Constraint;
|
||||
|
||||
/**
|
||||
* @Annotation
|
||||
*/
|
||||
#[\Attribute(\Attribute::TARGET_CLASS)]
|
||||
class HouseholdMembershipSequential extends Constraint
|
||||
{
|
||||
public $message = 'household_membership.Person with membership covering';
|
||||
|
@@ -13,9 +13,7 @@ namespace Chill\PersonBundle\Validator\Constraints\Household;
|
||||
|
||||
use Symfony\Component\Validator\Constraint;
|
||||
|
||||
/**
|
||||
* @Annotation
|
||||
*/
|
||||
#[\Attribute(\Attribute::TARGET_CLASS)]
|
||||
class MaxHolder extends Constraint
|
||||
{
|
||||
public $message = 'household.max_holder_overflowed';
|
||||
|
@@ -20,9 +20,8 @@ use Symfony\Component\Validator\Constraint;
|
||||
* 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)
|
||||
*
|
||||
* @Annotation
|
||||
*/
|
||||
#[\Attribute(\Attribute::TARGET_PROPERTY)]
|
||||
class Birthdate extends Constraint
|
||||
{
|
||||
final public const BIRTHDATE_INVALID_CODE = '3f42fd96-0b2d-11ec-8cf3-0f3b1b1ca1c4';
|
||||
|
@@ -11,9 +11,7 @@ declare(strict_types=1);
|
||||
|
||||
namespace Chill\PersonBundle\Validator\Constraints\Person;
|
||||
|
||||
/**
|
||||
* @Annotation
|
||||
*/
|
||||
#[\Attribute(\Attribute::TARGET_CLASS)]
|
||||
class PersonHasCenter extends \Symfony\Component\Validator\Constraint
|
||||
{
|
||||
public string $message = 'A center is required';
|
||||
|
@@ -13,9 +13,7 @@ namespace Chill\PersonBundle\Validator\Constraints\Relationship;
|
||||
|
||||
use Symfony\Component\Validator\Constraint;
|
||||
|
||||
/**
|
||||
* @Annotation
|
||||
*/
|
||||
#[\Attribute(\Attribute::TARGET_CLASS)]
|
||||
class RelationshipNoDuplicate extends Constraint
|
||||
{
|
||||
public $message = 'relationship.duplicate';
|
||||
|
Reference in New Issue
Block a user