mirror of
https://gitlab.com/Chill-Projet/chill-bundles.git
synced 2025-08-02 14:07:43 +00:00
Apply rector rules up to symfony 5.4
This commit is contained in:
parent
f3ac864233
commit
8251587288
24
rector.php
24
rector.php
@ -40,18 +40,18 @@ return static function (RectorConfig $rectorConfig): void {
|
||||
//define sets of rules
|
||||
$rectorConfig->sets([
|
||||
LevelSetList::UP_TO_PHP_83,
|
||||
\Rector\Symfony\Set\SymfonySetList::SYMFONY_40,
|
||||
\Rector\Symfony\Set\SymfonySetList::SYMFONY_41,
|
||||
\Rector\Symfony\Set\SymfonySetList::SYMFONY_42,
|
||||
\Rector\Symfony\Set\SymfonySetList::SYMFONY_43,
|
||||
\Rector\Symfony\Set\SymfonySetList::SYMFONY_44,
|
||||
// \Rector\Symfony\Set\SymfonySetList::SYMFONY_50,
|
||||
// \Rector\Symfony\Set\SymfonySetList::SYMFONY_51,
|
||||
// \Rector\Symfony\Set\SymfonySetList::SYMFONY_52,
|
||||
// \Rector\Symfony\Set\SymfonySetList::SYMFONY_53,
|
||||
// \Rector\Symfony\Set\SymfonySetList::SYMFONY_54,
|
||||
\Rector\Doctrine\Set\DoctrineSetList::DOCTRINE_CODE_QUALITY,
|
||||
\Rector\PHPUnit\Set\PHPUnitSetList::PHPUNIT_90,
|
||||
// \Rector\Symfony\Set\SymfonySetList::SYMFONY_40,
|
||||
// \Rector\Symfony\Set\SymfonySetList::SYMFONY_41,
|
||||
// \Rector\Symfony\Set\SymfonySetList::SYMFONY_42,
|
||||
// \Rector\Symfony\Set\SymfonySetList::SYMFONY_43,
|
||||
// \Rector\Symfony\Set\SymfonySetList::SYMFONY_44,
|
||||
\Rector\Symfony\Set\SymfonySetList::SYMFONY_50,
|
||||
\Rector\Symfony\Set\SymfonySetList::SYMFONY_51,
|
||||
\Rector\Symfony\Set\SymfonySetList::SYMFONY_52,
|
||||
\Rector\Symfony\Set\SymfonySetList::SYMFONY_53,
|
||||
\Rector\Symfony\Set\SymfonySetList::SYMFONY_54,
|
||||
// \Rector\Doctrine\Set\DoctrineSetList::DOCTRINE_CODE_QUALITY,
|
||||
// \Rector\PHPUnit\Set\PHPUnitSetList::PHPUNIT_90,
|
||||
]);
|
||||
|
||||
$rectorConfig->ruleWithConfiguration(\Rector\Php80\Rector\Class_\AnnotationToAttributeRector::class, [
|
||||
|
@ -49,10 +49,8 @@ class CSPerson
|
||||
#[ORM\Column(name: 'situationLogementPrecision', type: \Doctrine\DBAL\Types\Types::TEXT, nullable: true)]
|
||||
private ?string $situationLogementPrecision = null;
|
||||
|
||||
/**
|
||||
* @Assert\GreaterThanOrEqual(0)
|
||||
*/
|
||||
#[ORM\Column(name: 'enfantACharge', type: \Doctrine\DBAL\Types\Types::INTEGER, nullable: true)]
|
||||
#[Assert\GreaterThanOrEqual(0)]
|
||||
private ?int $enfantACharge = null;
|
||||
|
||||
public const NIVEAU_MAITRISE_LANGUE = [
|
||||
@ -241,82 +239,56 @@ class CSPerson
|
||||
#[ORM\ManyToOne(targetEntity: StoredObject::class, cascade: ['persist'])]
|
||||
private ?StoredObject $documentCV = null;
|
||||
|
||||
/**
|
||||
* @Assert\Valid()
|
||||
*/
|
||||
#[ORM\ManyToOne(targetEntity: StoredObject::class, cascade: ['persist'])]
|
||||
#[Assert\Valid]
|
||||
private ?StoredObject $documentAgrementIAE = null;
|
||||
|
||||
/**
|
||||
* @Assert\Valid()
|
||||
*/
|
||||
#[ORM\ManyToOne(targetEntity: StoredObject::class, cascade: ['persist'])]
|
||||
#[Assert\Valid]
|
||||
private ?StoredObject $documentRQTH = null;
|
||||
|
||||
/**
|
||||
* @Assert\Valid()
|
||||
*/
|
||||
#[ORM\ManyToOne(targetEntity: StoredObject::class, cascade: ['persist'])]
|
||||
#[Assert\Valid]
|
||||
private ?StoredObject $documentAttestationNEET = null;
|
||||
|
||||
/**
|
||||
* @Assert\Valid()
|
||||
*/
|
||||
#[ORM\ManyToOne(targetEntity: StoredObject::class, cascade: ['persist'])]
|
||||
#[Assert\Valid]
|
||||
private ?StoredObject $documentCI = null;
|
||||
|
||||
/**
|
||||
* @Assert\Valid()
|
||||
*/
|
||||
#[ORM\ManyToOne(targetEntity: StoredObject::class, cascade: ['persist'])]
|
||||
#[Assert\Valid]
|
||||
private ?StoredObject $documentTitreSejour = null;
|
||||
|
||||
/**
|
||||
* @Assert\Valid()
|
||||
*/
|
||||
#[ORM\ManyToOne(targetEntity: StoredObject::class, cascade: ['persist'])]
|
||||
#[Assert\Valid]
|
||||
private ?StoredObject $documentAttestationFiscale = null;
|
||||
|
||||
/**
|
||||
* @Assert\Valid()
|
||||
*/
|
||||
#[ORM\ManyToOne(targetEntity: StoredObject::class, cascade: ['persist'])]
|
||||
#[Assert\Valid]
|
||||
private ?StoredObject $documentPermis = null;
|
||||
|
||||
/**
|
||||
* @Assert\Valid()
|
||||
*/
|
||||
#[ORM\ManyToOne(targetEntity: StoredObject::class, cascade: ['persist'])]
|
||||
#[Assert\Valid]
|
||||
private ?StoredObject $documentAttestationCAAF = null;
|
||||
|
||||
/**
|
||||
* @Assert\Valid()
|
||||
*/
|
||||
#[ORM\ManyToOne(targetEntity: StoredObject::class, cascade: ['persist'])]
|
||||
#[Assert\Valid]
|
||||
private ?StoredObject $documentContraTravail = null;
|
||||
|
||||
/**
|
||||
* @Assert\Valid()
|
||||
*/
|
||||
#[ORM\ManyToOne(targetEntity: StoredObject::class, cascade: ['persist'])]
|
||||
#[Assert\Valid]
|
||||
private ?StoredObject $documentAttestationFormation = null;
|
||||
|
||||
/**
|
||||
* @Assert\Valid()
|
||||
*/
|
||||
#[ORM\ManyToOne(targetEntity: StoredObject::class, cascade: ['persist'])]
|
||||
#[Assert\Valid]
|
||||
private ?StoredObject $documentQuittanceLoyer = null;
|
||||
|
||||
/**
|
||||
* @Assert\Valid()
|
||||
*/
|
||||
#[ORM\ManyToOne(targetEntity: StoredObject::class, cascade: ['persist'])]
|
||||
#[Assert\Valid]
|
||||
private ?StoredObject $documentFactureElectricite = null;
|
||||
|
||||
/**
|
||||
* @Assert\Valid()
|
||||
*/
|
||||
#[ORM\ManyToOne(targetEntity: StoredObject::class, cascade: ['persist'])]
|
||||
#[Assert\Valid]
|
||||
private ?StoredObject $documentAttestationSecuriteSociale = null;
|
||||
|
||||
#[ORM\ManyToOne(targetEntity: ThirdParty::class)]
|
||||
@ -405,9 +377,8 @@ class CSPerson
|
||||
|
||||
/**
|
||||
* Valide niveauMaitriseLangue.
|
||||
*
|
||||
* @Assert\Callback()
|
||||
*/
|
||||
#[Assert\Callback]
|
||||
public function validateNiveauMatriseLangue(ExecutionContextInterface $context)
|
||||
{
|
||||
if (null === $this->getNiveauMaitriseLangue()) {
|
||||
|
@ -30,10 +30,8 @@ class CV implements \Stringable
|
||||
#[ORM\GeneratedValue(strategy: 'AUTO')]
|
||||
private ?int $id = null;
|
||||
|
||||
/**
|
||||
* @Assert\NotNull()
|
||||
*/
|
||||
#[ORM\Column(name: 'reportDate', type: \Doctrine\DBAL\Types\Types::DATE_MUTABLE)]
|
||||
#[Assert\NotNull]
|
||||
private ?\DateTimeInterface $reportDate = null;
|
||||
|
||||
public const FORMATION_LEVEL = [
|
||||
@ -47,10 +45,8 @@ class CV implements \Stringable
|
||||
'BAC+8',
|
||||
];
|
||||
|
||||
/**
|
||||
* @Assert\NotBlank()
|
||||
*/
|
||||
#[ORM\Column(name: 'formationLevel', type: \Doctrine\DBAL\Types\Types::STRING, length: 255, nullable: true)]
|
||||
#[Assert\NotBlank]
|
||||
private ?string $formationLevel = null;
|
||||
|
||||
public const FORMATION_TYPE = [
|
||||
@ -71,20 +67,18 @@ class CV implements \Stringable
|
||||
private ?string $notes = null;
|
||||
|
||||
/**
|
||||
* @Assert\Valid(traverse=true)
|
||||
*
|
||||
* @var \Doctrine\Common\Collections\Collection<int, \Chill\JobBundle\Entity\CV\Formation>
|
||||
*/
|
||||
#[ORM\OneToMany(targetEntity: CV\Formation::class, mappedBy: 'CV', cascade: ['persist', 'remove', 'detach'], orphanRemoval: true)]
|
||||
#[Assert\Valid(traverse: true)]
|
||||
// #[ORM\OrderBy(['startDate' => Order::Descending, 'endDate' => 'DESC'])]
|
||||
private Collection $formations;
|
||||
|
||||
/**
|
||||
* @Assert\Valid(traverse=true)
|
||||
*
|
||||
* @var \Doctrine\Common\Collections\Collection<int, \Chill\JobBundle\Entity\CV\Experience>
|
||||
*/
|
||||
#[ORM\OneToMany(targetEntity: CV\Experience::class, mappedBy: 'CV', cascade: ['persist', 'remove', 'detach'], orphanRemoval: true)]
|
||||
#[Assert\Valid(traverse: true)]
|
||||
// #[ORM\OrderBy(['startDate' => Order::Descending, 'endDate' => 'DESC'])]
|
||||
private Collection $experiences;
|
||||
|
||||
|
@ -36,10 +36,8 @@ class Experience
|
||||
#[ORM\Column(name: 'startDate', type: \Doctrine\DBAL\Types\Types::DATE_MUTABLE, nullable: true)]
|
||||
private ?\DateTimeInterface $startDate = null;
|
||||
|
||||
/**
|
||||
* @Assert\GreaterThan(propertyPath="startDate", message="La date de fin doit être postérieure à la date de début")
|
||||
*/
|
||||
#[ORM\Column(name: 'endDate', type: \Doctrine\DBAL\Types\Types::DATE_MUTABLE, nullable: true)]
|
||||
#[Assert\GreaterThan(propertyPath: 'startDate', message: 'La date de fin doit être postérieure à la date de début')]
|
||||
private ?\DateTimeInterface $endDate = null;
|
||||
|
||||
public const CONTRAT_TYPE = [
|
||||
|
@ -27,21 +27,17 @@ class Formation
|
||||
#[ORM\GeneratedValue(strategy: 'AUTO')]
|
||||
private ?int $id = null;
|
||||
|
||||
/**
|
||||
* @Assert\Length(min=3)
|
||||
*
|
||||
* @Assert\NotNull()
|
||||
*/
|
||||
|
||||
#[ORM\Column(name: 'title', type: \Doctrine\DBAL\Types\Types::TEXT)]
|
||||
#[Assert\Length(min: 3)]
|
||||
#[Assert\NotNull]
|
||||
private ?string $title = null;
|
||||
|
||||
#[ORM\Column(name: 'startDate', type: \Doctrine\DBAL\Types\Types::DATE_MUTABLE, nullable: true)]
|
||||
private ?\DateTimeInterface $startDate = null;
|
||||
|
||||
/**
|
||||
* @Assert\GreaterThan(propertyPath="startDate", message="La date de fin doit être postérieure à la date de début")
|
||||
*/
|
||||
#[ORM\Column(name: 'endDate', type: \Doctrine\DBAL\Types\Types::DATE_MUTABLE, nullable: true)]
|
||||
#[Assert\GreaterThan(propertyPath: 'startDate', message: 'La date de fin doit être postérieure à la date de début')]
|
||||
private ?\DateTimeInterface $endDate = null;
|
||||
|
||||
public const DIPLOMA_OBTAINED = [
|
||||
|
@ -29,14 +29,10 @@ class Frein implements HasPerson, \Stringable
|
||||
#[ORM\GeneratedValue(strategy: 'AUTO')]
|
||||
private ?int $id = null;
|
||||
|
||||
/**
|
||||
* @Assert\NotNull()
|
||||
*
|
||||
* @Assert\GreaterThan("5 years ago",
|
||||
* message="La date du rapport ne peut pas être plus de cinq ans dans le passé"
|
||||
* )
|
||||
*/
|
||||
|
||||
#[ORM\Column(name: 'reportDate', type: \Doctrine\DBAL\Types\Types::DATE_MUTABLE)]
|
||||
#[Assert\NotNull]
|
||||
#[Assert\GreaterThan('5 years ago', message: 'La date du rapport ne peut pas être plus de cinq ans dans le passé')]
|
||||
private ?\DateTimeInterface $reportDate = null;
|
||||
|
||||
public const FREINS_PERSO = [
|
||||
@ -76,10 +72,8 @@ class Frein implements HasPerson, \Stringable
|
||||
#[ORM\Column(name: 'notesEmploi', type: \Doctrine\DBAL\Types\Types::TEXT)]
|
||||
private ?string $notesEmploi = '';
|
||||
|
||||
/**
|
||||
* @Assert\NotNull()
|
||||
*/
|
||||
#[ORM\ManyToOne(targetEntity: Person::class)]
|
||||
#[Assert\NotNull]
|
||||
private Person $person;
|
||||
|
||||
public function __construct()
|
||||
@ -166,9 +160,7 @@ class Frein implements HasPerson, \Stringable
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* @Assert\Callback()
|
||||
*/
|
||||
#[Assert\Callback]
|
||||
public function validateFreinsCount(ExecutionContextInterface $context, $payload): void
|
||||
{
|
||||
$nb = count($this->getFreinsEmploi()) + count($this->getFreinsPerso());
|
||||
|
@ -39,54 +39,42 @@ class Immersion implements \Stringable
|
||||
#[ORM\GeneratedValue(strategy: 'AUTO')]
|
||||
private ?int $id = null;
|
||||
|
||||
/**
|
||||
* @Assert\NotNull()
|
||||
*/
|
||||
#[ORM\ManyToOne(targetEntity: Person::class)]
|
||||
#[Assert\NotNull]
|
||||
private ?Person $person = null;
|
||||
|
||||
/**
|
||||
* @Assert\NotNull()
|
||||
*
|
||||
* @Assert\Length(min=2)
|
||||
*/
|
||||
|
||||
#[ORM\ManyToOne(targetEntity: ThirdParty::class)]
|
||||
#[Assert\NotNull]
|
||||
#[Assert\Length(min: 2)]
|
||||
private ?ThirdParty $entreprise = null;
|
||||
|
||||
#[ORM\ManyToOne(targetEntity: User::class)]
|
||||
private ?User $referent = null;
|
||||
|
||||
/**
|
||||
* @Assert\NotNull()
|
||||
*
|
||||
* @Assert\Length(min=2)
|
||||
*/
|
||||
|
||||
#[ORM\Column(name: 'domaineActivite', type: \Doctrine\DBAL\Types\Types::TEXT, nullable: true)]
|
||||
#[Assert\NotNull]
|
||||
#[Assert\Length(min: 2)]
|
||||
private ?string $domaineActivite = null;
|
||||
|
||||
/**
|
||||
* @Assert\NotNull()
|
||||
*
|
||||
* @Assert\Length(min=2)
|
||||
*/
|
||||
|
||||
#[ORM\Column(name: 'tuteurName', type: \Doctrine\DBAL\Types\Types::TEXT, nullable: true)]
|
||||
#[Assert\NotNull]
|
||||
#[Assert\Length(min: 2)]
|
||||
private ?string $tuteurName = null;
|
||||
|
||||
/**
|
||||
* @Assert\NotNull()
|
||||
*
|
||||
* @Assert\Length(min=2)
|
||||
*/
|
||||
|
||||
#[ORM\Column(name: 'tuteurFonction', type: \Doctrine\DBAL\Types\Types::TEXT, nullable: true)]
|
||||
#[Assert\NotNull]
|
||||
#[Assert\Length(min: 2)]
|
||||
private ?string $tuteurFonction = null;
|
||||
|
||||
/**
|
||||
* @Assert\NotNull()
|
||||
*
|
||||
* @Assert\NotBlank()
|
||||
*/
|
||||
|
||||
#[ORM\Column(name: 'tuteurPhoneNumber', type: 'phone_number', nullable: true)]
|
||||
#[PhonenumberConstraint(type: 'any')]
|
||||
#[Assert\NotNull]
|
||||
#[Assert\NotBlank]
|
||||
private ?PhoneNumber $tuteurPhoneNumber = null;
|
||||
|
||||
#[ORM\Column(name: 'structureAccName', type: \Doctrine\DBAL\Types\Types::TEXT, nullable: true)]
|
||||
@ -105,42 +93,33 @@ class Immersion implements \Stringable
|
||||
#[ORM\Column(name: 'posteDescriptif', type: \Doctrine\DBAL\Types\Types::TEXT, nullable: true)]
|
||||
private ?string $posteDescriptif = null;
|
||||
|
||||
/**
|
||||
* @Assert\NotNull()
|
||||
*
|
||||
* @Assert\Length(min=2)
|
||||
*/
|
||||
|
||||
#[ORM\Column(name: 'posteTitle', type: \Doctrine\DBAL\Types\Types::TEXT, nullable: true)]
|
||||
#[Assert\NotNull]
|
||||
#[Assert\Length(min: 2)]
|
||||
private ?string $posteTitle = null;
|
||||
|
||||
/**
|
||||
* @Assert\NotNull()
|
||||
*
|
||||
* @Assert\Length(min=2)
|
||||
*/
|
||||
|
||||
#[ORM\Column(name: 'posteLieu', type: \Doctrine\DBAL\Types\Types::TEXT, nullable: true)]
|
||||
#[Assert\NotNull]
|
||||
#[Assert\Length(min: 2)]
|
||||
private ?string $posteLieu = null;
|
||||
|
||||
/**
|
||||
* @Assert\NotNull()
|
||||
*/
|
||||
#[ORM\Column(name: 'debutDate', type: \Doctrine\DBAL\Types\Types::DATE_MUTABLE, nullable: true)]
|
||||
#[Assert\NotNull]
|
||||
private ?\DateTime $debutDate = null;
|
||||
|
||||
/**
|
||||
* @var string|null
|
||||
*
|
||||
* @Assert\NotNull()
|
||||
*/
|
||||
#[ORM\Column(name: 'duration', type: \Doctrine\DBAL\Types\Types::DATEINTERVAL, nullable: true)]
|
||||
#[Assert\NotNull]
|
||||
private $duration;
|
||||
|
||||
/**
|
||||
* @Assert\NotNull()
|
||||
*
|
||||
* @Assert\Length(min=2)
|
||||
*/
|
||||
|
||||
#[ORM\Column(name: 'horaire', type: \Doctrine\DBAL\Types\Types::TEXT, nullable: true)]
|
||||
#[Assert\NotNull]
|
||||
#[Assert\Length(min: 2)]
|
||||
private ?string $horaire = null;
|
||||
|
||||
public const OBJECTIFS = [
|
||||
|
@ -32,16 +32,12 @@ class ProjetProfessionnel implements \Stringable
|
||||
#[ORM\GeneratedValue(strategy: 'AUTO')]
|
||||
private ?int $id = null;
|
||||
|
||||
/**
|
||||
* @Assert\NotNull()
|
||||
*/
|
||||
#[ORM\ManyToOne(targetEntity: Person::class)]
|
||||
#[Assert\NotNull]
|
||||
private ?Person $person = null;
|
||||
|
||||
/**
|
||||
* @Assert\NotNull()
|
||||
*/
|
||||
#[ORM\Column(name: 'reportDate', type: Types::DATE_MUTABLE)]
|
||||
#[Assert\NotNull]
|
||||
private ?\DateTimeInterface $reportDate = null;
|
||||
|
||||
/**
|
||||
@ -62,10 +58,9 @@ class ProjetProfessionnel implements \Stringable
|
||||
|
||||
/**
|
||||
* @var array|null
|
||||
*
|
||||
* @Assert\Count(min=1, minMessage="Indiquez au moins un type de contrat")
|
||||
*/
|
||||
#[ORM\Column(name: 'typeContrat', type: Types::JSON, nullable: true)]
|
||||
#[Assert\Count(min: 1, minMessage: 'Indiquez au moins un type de contrat')]
|
||||
private $typeContrat;
|
||||
|
||||
#[ORM\Column(name: 'typeContratNotes', type: Types::TEXT, nullable: true)]
|
||||
@ -78,10 +73,9 @@ class ProjetProfessionnel implements \Stringable
|
||||
|
||||
/**
|
||||
* @var array|null
|
||||
*
|
||||
* @Assert\Count(min=1, minMessage="Indiquez un volume horaire souhaité")
|
||||
*/
|
||||
#[ORM\Column(name: 'volumeHoraire', type: Types::JSON, nullable: true)]
|
||||
#[Assert\Count(min: 1, minMessage: 'Indiquez un volume horaire souhaité')]
|
||||
private $volumeHoraire;
|
||||
|
||||
#[ORM\Column(name: 'volumeHoraireNotes', type: Types::TEXT, nullable: true)]
|
||||
|
@ -65,18 +65,18 @@ class PersonVoter extends AbstractChillVoter implements ProvideRoleHierarchyInte
|
||||
}
|
||||
|
||||
#[\Override]
|
||||
protected function supports($attribute, $subject)
|
||||
protected function supports($attribute, $subject): bool
|
||||
{
|
||||
return $this->voter->supports($attribute, $subject);
|
||||
}
|
||||
|
||||
#[\Override]
|
||||
protected function voteOnAttribute($attribute, $subject, TokenInterface $token)
|
||||
protected function voteOnAttribute($attribute, $subject, TokenInterface $token): bool
|
||||
{
|
||||
return $this->voter->voteOnAttribute($attribute, $subject, $token);
|
||||
}
|
||||
|
||||
private function getAttributes()
|
||||
private function getAttributes(): array
|
||||
{
|
||||
return [self::CREATE, self::UPDATE, self::SEE, self::STATS, self::LISTS, self::DUPLICATE];
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user