mirror of
https://gitlab.com/Chill-Projet/chill-bundles.git
synced 2025-10-03 11:59:49 +00:00
Rector php82 changes
This commit is contained in:
10
rector.php
10
rector.php
@@ -51,7 +51,7 @@ return static function (RectorConfig $rectorConfig): void {
|
|||||||
|
|
||||||
// define sets of rules
|
// define sets of rules
|
||||||
$rectorConfig->sets([
|
$rectorConfig->sets([
|
||||||
// LevelSetList::UP_TO_PHP_82,
|
LevelSetList::UP_TO_PHP_82,
|
||||||
// SymfonySetList::SYMFONY_60,
|
// SymfonySetList::SYMFONY_60,
|
||||||
// SymfonySetList::SYMFONY_61,
|
// SymfonySetList::SYMFONY_61,
|
||||||
// SymfonySetList::SYMFONY_62,
|
// SymfonySetList::SYMFONY_62,
|
||||||
@@ -59,10 +59,10 @@ return static function (RectorConfig $rectorConfig): void {
|
|||||||
// SymfonySetList::SYMFONY_64,
|
// SymfonySetList::SYMFONY_64,
|
||||||
// SymfonySetList::SYMFONY_70,
|
// SymfonySetList::SYMFONY_70,
|
||||||
// SymfonySetList::SYMFONY_71,
|
// SymfonySetList::SYMFONY_71,
|
||||||
Rector\Doctrine\Set\DoctrineSetList::DOCTRINE_ORM_29,
|
// Rector\Doctrine\Set\DoctrineSetList::DOCTRINE_ORM_29,
|
||||||
Rector\Doctrine\Set\DoctrineSetList::DOCTRINE_DBAL_30,
|
// Rector\Doctrine\Set\DoctrineSetList::DOCTRINE_DBAL_30,
|
||||||
Rector\Doctrine\Set\DoctrineSetList::DOCTRINE_CODE_QUALITY,
|
// Rector\Doctrine\Set\DoctrineSetList::DOCTRINE_CODE_QUALITY,
|
||||||
Rector\Doctrine\Set\DoctrineSetList::ANNOTATIONS_TO_ATTRIBUTES,
|
// Rector\Doctrine\Set\DoctrineSetList::ANNOTATIONS_TO_ATTRIBUTES,
|
||||||
]);
|
]);
|
||||||
|
|
||||||
$rectorConfig->ruleWithConfiguration(AnnotationToAttributeRector::class, [
|
$rectorConfig->ruleWithConfiguration(AnnotationToAttributeRector::class, [
|
||||||
|
@@ -462,7 +462,7 @@ class ActivityType
|
|||||||
$property = $field.'Visible';
|
$property = $field.'Visible';
|
||||||
|
|
||||||
// Get the real class name (not the proxy)
|
// Get the real class name (not the proxy)
|
||||||
$class = get_class($this);
|
$class = static::class;
|
||||||
if (str_contains($class, '__CG__')) {
|
if (str_contains($class, '__CG__')) {
|
||||||
$class = get_parent_class($this);
|
$class = get_parent_class($this);
|
||||||
}
|
}
|
||||||
|
@@ -25,7 +25,7 @@ class EventBudgetKindType extends AbstractType
|
|||||||
{
|
{
|
||||||
public function __construct(private readonly TranslatorInterface $translator) {}
|
public function __construct(private readonly TranslatorInterface $translator) {}
|
||||||
|
|
||||||
public function buildForm(FormBuilderInterface $builder, array $options)
|
public function buildForm(FormBuilderInterface $builder, array $options): void
|
||||||
{
|
{
|
||||||
$builder
|
$builder
|
||||||
->add('name', TranslatableStringFormType::class, [
|
->add('name', TranslatableStringFormType::class, [
|
||||||
@@ -45,7 +45,7 @@ class EventBudgetKindType extends AbstractType
|
|||||||
]);
|
]);
|
||||||
}
|
}
|
||||||
|
|
||||||
public function configureOptions(OptionsResolver $resolver)
|
public function configureOptions(OptionsResolver $resolver): void
|
||||||
{
|
{
|
||||||
$resolver
|
$resolver
|
||||||
->setDefault('class', EventBudgetKind::class);
|
->setDefault('class', EventBudgetKind::class);
|
||||||
|
@@ -22,7 +22,7 @@ class PickEventThemeType extends AbstractType
|
|||||||
{
|
{
|
||||||
public function __construct(private readonly EventThemeRender $eventThemeRender, private readonly EventThemeRepository $eventThemeRepository) {}
|
public function __construct(private readonly EventThemeRender $eventThemeRender, private readonly EventThemeRepository $eventThemeRepository) {}
|
||||||
|
|
||||||
public function configureOptions(OptionsResolver $resolver)
|
public function configureOptions(OptionsResolver $resolver): void
|
||||||
{
|
{
|
||||||
$resolver
|
$resolver
|
||||||
->setDefaults([
|
->setDefaults([
|
||||||
|
@@ -52,7 +52,7 @@ class SetPasswordCommand extends Command
|
|||||||
$user->setPassword(
|
$user->setPassword(
|
||||||
$encoderFactory->getEncoder($user)->encodePassword($password, $user->getSalt())
|
$encoderFactory->getEncoder($user)->encodePassword($password, $user->getSalt())
|
||||||
);
|
);
|
||||||
$this->entityManager->flush($user);
|
$this->entityManager->flush();
|
||||||
}
|
}
|
||||||
|
|
||||||
public function configure(): void
|
public function configure(): void
|
||||||
|
@@ -22,7 +22,7 @@ use Symfony\Component\DependencyInjection\ParameterBag\ParameterBagInterface;
|
|||||||
*/
|
*/
|
||||||
class LoadCountries extends Fixture implements OrderedFixtureInterface
|
class LoadCountries extends Fixture implements OrderedFixtureInterface
|
||||||
{
|
{
|
||||||
private array $availableLanguages;
|
private readonly array $availableLanguages;
|
||||||
|
|
||||||
public function __construct(private readonly ParameterBagInterface $parameterBag)
|
public function __construct(private readonly ParameterBagInterface $parameterBag)
|
||||||
{
|
{
|
||||||
|
@@ -30,7 +30,7 @@ class LoadLanguages extends Fixture implements OrderedFixtureInterface
|
|||||||
// This array contains regional code to not exclude
|
// This array contains regional code to not exclude
|
||||||
private array $regionalVersionToInclude = ['ro_MD'];
|
private array $regionalVersionToInclude = ['ro_MD'];
|
||||||
|
|
||||||
private array $availableLanguages;
|
private readonly array $availableLanguages;
|
||||||
|
|
||||||
public function __construct(private readonly ParameterBagInterface $parameterBag)
|
public function __construct(private readonly ParameterBagInterface $parameterBag)
|
||||||
{
|
{
|
||||||
|
@@ -54,11 +54,8 @@ class LoadUsers extends Fixture implements OrderedFixtureInterface
|
|||||||
],
|
],
|
||||||
];
|
];
|
||||||
|
|
||||||
private UserPasswordHasherInterface $passwordHasher;
|
public function __construct(private readonly UserPasswordHasherInterface $passwordHasher)
|
||||||
|
|
||||||
public function __construct(UserPasswordHasherInterface $passwordHasher)
|
|
||||||
{
|
{
|
||||||
$this->passwordHasher = $passwordHasher;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public function getOrder(): int
|
public function getOrder(): int
|
||||||
|
@@ -22,11 +22,8 @@ use Symfony\Bundle\SecurityBundle\Security;
|
|||||||
|
|
||||||
class TrackCreateUpdateSubscriber implements EventSubscriber
|
class TrackCreateUpdateSubscriber implements EventSubscriber
|
||||||
{
|
{
|
||||||
private Security $security;
|
public function __construct(private readonly Security $security)
|
||||||
|
|
||||||
public function __construct(Security $security)
|
|
||||||
{
|
{
|
||||||
$this->security = $security;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public function getSubscribedEvents(): array
|
public function getSubscribedEvents(): array
|
||||||
|
@@ -68,7 +68,7 @@ class UserTest extends TestCase
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
public function testIsAbsent()
|
public function testIsAbsent(): void
|
||||||
{
|
{
|
||||||
$user = new User();
|
$user = new User();
|
||||||
|
|
||||||
|
@@ -57,7 +57,7 @@ final class UserNormalizerTest extends TestCase
|
|||||||
return ['context' => $context['docgen:expects'] ?? null];
|
return ['context' => $context['docgen:expects'] ?? null];
|
||||||
}
|
}
|
||||||
|
|
||||||
public function supportsNormalization($data, ?string $format = null): bool
|
public function supportsNormalization($data, ?string $format = null, array $context = []): bool
|
||||||
{
|
{
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
@@ -113,11 +113,11 @@ class PersonMove
|
|||||||
|
|
||||||
$conditions = [];
|
$conditions = [];
|
||||||
|
|
||||||
if (array_key_exists('joinTable', $mapping)) {
|
if (property_exists($mapping, 'joinTable')) {
|
||||||
foreach ($mapping['joinTable']['joinColumns'] as $columns) {
|
foreach ($mapping['joinTable']['joinColumns'] as $columns) {
|
||||||
$conditions[] = sprintf('%s = %d', $columns['referencedColumnName'], $from->getId());
|
$conditions[] = sprintf('%s = %d', $columns['referencedColumnName'], $from->getId());
|
||||||
}
|
}
|
||||||
} elseif (array_key_exists('joinColumns', $mapping)) {
|
} elseif (property_exists($mapping, 'joinColumns')) {
|
||||||
foreach ($mapping['joinColumns'] as $columns) {
|
foreach ($mapping['joinColumns'] as $columns) {
|
||||||
$conditions[] = sprintf('%s = %d', $columns['name'], $from->getId());
|
$conditions[] = sprintf('%s = %d', $columns['name'], $from->getId());
|
||||||
}
|
}
|
||||||
|
@@ -79,7 +79,7 @@ class AccompanyingPeriodWorkDuplicateController extends AbstractController
|
|||||||
* @ParamConverter("acpw2", options={"id": "acpw2_id"})
|
* @ParamConverter("acpw2", options={"id": "acpw2_id"})
|
||||||
*/
|
*/
|
||||||
#[Route(path: '/{_locale}/person/{acpw1_id}/acpw-duplicate/{acpw2_id}/confirm', name: 'chill_person_acpw_duplicate_confirm')]
|
#[Route(path: '/{_locale}/person/{acpw1_id}/acpw-duplicate/{acpw2_id}/confirm', name: 'chill_person_acpw_duplicate_confirm')]
|
||||||
public function confirmAction(AccompanyingPeriodWork $acpw1, AccompanyingPeriodWork $acpw2, Request $request)
|
public function confirmAction(AccompanyingPeriodWork $acpw1, AccompanyingPeriodWork $acpw2, Request $request): \Symfony\Component\HttpFoundation\RedirectResponse|\Symfony\Component\HttpFoundation\Response
|
||||||
{
|
{
|
||||||
$accompanyingPeriod = $acpw1->getAccompanyingPeriod();
|
$accompanyingPeriod = $acpw1->getAccompanyingPeriod();
|
||||||
|
|
||||||
|
@@ -44,7 +44,7 @@ final readonly class PersonEditController
|
|||||||
* @ParamConverter("person", options={"id": "person_id"})
|
* @ParamConverter("person", options={"id": "person_id"})
|
||||||
*/
|
*/
|
||||||
#[Route(path: '/{_locale}/person/{person_id}/general/edit', name: 'chill_person_general_edit')]
|
#[Route(path: '/{_locale}/person/{person_id}/general/edit', name: 'chill_person_general_edit')]
|
||||||
public function editAction(Person $person, Request $request, Session $session)
|
public function editAction(Person $person, Request $request, Session $session): \Symfony\Component\HttpFoundation\RedirectResponse|\Symfony\Component\HttpFoundation\Response
|
||||||
{
|
{
|
||||||
if (!$this->security->isGranted(PersonVoter::UPDATE, $person)) {
|
if (!$this->security->isGranted(PersonVoter::UPDATE, $person)) {
|
||||||
throw new AccessDeniedHttpException('You are not allowed to edit this person.');
|
throw new AccessDeniedHttpException('You are not allowed to edit this person.');
|
||||||
|
@@ -50,7 +50,7 @@ final readonly class HouseholdRepository implements ObjectRepository
|
|||||||
$this->em = $entityManager;
|
$this->em = $entityManager;
|
||||||
}
|
}
|
||||||
|
|
||||||
public function countByAccompanyingPeriodParticipation(Person $person)
|
public function countByAccompanyingPeriodParticipation(Person $person): mixed
|
||||||
{
|
{
|
||||||
return $this->buildQueryByAccompanyingPeriodParticipation($person, true);
|
return $this->buildQueryByAccompanyingPeriodParticipation($person, true);
|
||||||
}
|
}
|
||||||
@@ -70,7 +70,7 @@ final readonly class HouseholdRepository implements ObjectRepository
|
|||||||
return $this->repository->findBy($criteria, $orderBy, $limit, $offset);
|
return $this->repository->findBy($criteria, $orderBy, $limit, $offset);
|
||||||
}
|
}
|
||||||
|
|
||||||
public function findByAccompanyingPeriodParticipation(Person $person, int $limit, int $offset)
|
public function findByAccompanyingPeriodParticipation(Person $person, int $limit, int $offset): mixed
|
||||||
{
|
{
|
||||||
return $this->buildQueryByAccompanyingPeriodParticipation($person, false, $limit, $offset);
|
return $this->buildQueryByAccompanyingPeriodParticipation($person, false, $limit, $offset);
|
||||||
}
|
}
|
||||||
|
@@ -44,7 +44,7 @@ final class AccompanyingPeriodSocialIssueConsistencyEntityListenerTest extends T
|
|||||||
$entity = $this->generateClass($period, $socialIssues);
|
$entity = $this->generateClass($period, $socialIssues);
|
||||||
$consistency = new AccompanyingPeriodSocialIssueConsistencyEntityListener();
|
$consistency = new AccompanyingPeriodSocialIssueConsistencyEntityListener();
|
||||||
|
|
||||||
$consistency->prePersist($entity, $this->generateLifecycleArgs($period, Step::PrePersist));
|
$consistency->prePersist($entity);
|
||||||
|
|
||||||
$this->assertCount(2, $period->getSocialIssues());
|
$this->assertCount(2, $period->getSocialIssues());
|
||||||
$this->assertContains($grandGrandChild, $period->getSocialIssues());
|
$this->assertContains($grandGrandChild, $period->getSocialIssues());
|
||||||
@@ -69,7 +69,7 @@ final class AccompanyingPeriodSocialIssueConsistencyEntityListenerTest extends T
|
|||||||
$period->addSocialIssue($issue);
|
$period->addSocialIssue($issue);
|
||||||
}
|
}
|
||||||
|
|
||||||
$consistency->prePersistAccompanyingPeriod($period, $this->generateLifecycleArgs($period, Step::PrePersist));
|
$consistency->prePersistAccompanyingPeriod($period);
|
||||||
|
|
||||||
$this->assertCount(1, $period->getSocialIssues());
|
$this->assertCount(1, $period->getSocialIssues());
|
||||||
$this->assertSame($grandGrandChild, $period->getSocialIssues()->first());
|
$this->assertSame($grandGrandChild, $period->getSocialIssues()->first());
|
||||||
@@ -87,7 +87,7 @@ final class AccompanyingPeriodSocialIssueConsistencyEntityListenerTest extends T
|
|||||||
$entity = $this->generateClass($period, $socialIssues);
|
$entity = $this->generateClass($period, $socialIssues);
|
||||||
$consistency = new AccompanyingPeriodSocialIssueConsistencyEntityListener();
|
$consistency = new AccompanyingPeriodSocialIssueConsistencyEntityListener();
|
||||||
|
|
||||||
$consistency->preUpdate($entity, $this->generateLifecycleArgs($period, Step::PreUpdate));
|
$consistency->preUpdate($entity);
|
||||||
|
|
||||||
$this->assertCount(2, $period->getSocialIssues());
|
$this->assertCount(2, $period->getSocialIssues());
|
||||||
$this->assertContains($grandGrandChild, $period->getSocialIssues());
|
$this->assertContains($grandGrandChild, $period->getSocialIssues());
|
||||||
@@ -112,7 +112,7 @@ final class AccompanyingPeriodSocialIssueConsistencyEntityListenerTest extends T
|
|||||||
$period->addSocialIssue($issue);
|
$period->addSocialIssue($issue);
|
||||||
}
|
}
|
||||||
|
|
||||||
$consistency->prePersistAccompanyingPeriod($period, $this->generateLifecycleArgs($period, Step::PrePersist));
|
$consistency->prePersistAccompanyingPeriod($period);
|
||||||
|
|
||||||
$this->assertCount(1, $period->getSocialIssues());
|
$this->assertCount(1, $period->getSocialIssues());
|
||||||
$this->assertSame($grandGrandChild, $period->getSocialIssues()->first());
|
$this->assertSame($grandGrandChild, $period->getSocialIssues()->first());
|
||||||
|
@@ -31,7 +31,7 @@ class ThirdpartyDuplicateController extends AbstractController
|
|||||||
* @ParamConverter("thirdparty", options={"id": "thirdparty_id"})
|
* @ParamConverter("thirdparty", options={"id": "thirdparty_id"})
|
||||||
*/
|
*/
|
||||||
#[Route(path: '/{_locale}/3party/{thirdparty_id}/find-manually', name: 'chill_thirdparty_find_duplicate')]
|
#[Route(path: '/{_locale}/3party/{thirdparty_id}/find-manually', name: 'chill_thirdparty_find_duplicate')]
|
||||||
public function findManuallyDuplicateAction(ThirdParty $thirdparty, Request $request)
|
public function findManuallyDuplicateAction(ThirdParty $thirdparty, Request $request): \Symfony\Component\HttpFoundation\RedirectResponse|\Symfony\Component\HttpFoundation\Response
|
||||||
{
|
{
|
||||||
$suggested = [];
|
$suggested = [];
|
||||||
|
|
||||||
@@ -74,7 +74,7 @@ class ThirdpartyDuplicateController extends AbstractController
|
|||||||
* @ParamConverter("thirdparty2", options={"id": "thirdparty2_id"})
|
* @ParamConverter("thirdparty2", options={"id": "thirdparty2_id"})
|
||||||
*/
|
*/
|
||||||
#[Route(path: '/{_locale}/3party/{thirdparty1_id}/duplicate/{thirdparty2_id}/confirm', name: 'chill_thirdparty_duplicate_confirm')]
|
#[Route(path: '/{_locale}/3party/{thirdparty1_id}/duplicate/{thirdparty2_id}/confirm', name: 'chill_thirdparty_duplicate_confirm')]
|
||||||
public function confirmAction(ThirdParty $thirdparty1, ThirdParty $thirdparty2, Request $request)
|
public function confirmAction(ThirdParty $thirdparty1, ThirdParty $thirdparty2, Request $request): \Symfony\Component\HttpFoundation\RedirectResponse|\Symfony\Component\HttpFoundation\Response
|
||||||
{
|
{
|
||||||
try {
|
try {
|
||||||
$this->validateThirdpartyMerge($thirdparty1, $thirdparty2);
|
$this->validateThirdpartyMerge($thirdparty1, $thirdparty2);
|
||||||
|
@@ -19,7 +19,7 @@ use Symfony\Component\OptionsResolver\OptionsResolver;
|
|||||||
|
|
||||||
class ThirdpartyFindDuplicateType extends AbstractType
|
class ThirdpartyFindDuplicateType extends AbstractType
|
||||||
{
|
{
|
||||||
public function buildForm(FormBuilderInterface $builder, array $options)
|
public function buildForm(FormBuilderInterface $builder, array $options): void
|
||||||
{
|
{
|
||||||
$builder
|
$builder
|
||||||
->add('thirdparty', PickThirdpartyDynamicType::class, [
|
->add('thirdparty', PickThirdpartyDynamicType::class, [
|
||||||
@@ -32,7 +32,7 @@ class ThirdpartyFindDuplicateType extends AbstractType
|
|||||||
]);
|
]);
|
||||||
}
|
}
|
||||||
|
|
||||||
public function configureOptions(OptionsResolver $resolver)
|
public function configureOptions(OptionsResolver $resolver): void
|
||||||
{
|
{
|
||||||
$resolver->setDefaults([
|
$resolver->setDefaults([
|
||||||
'suggested' => [],
|
'suggested' => [],
|
||||||
|
Reference in New Issue
Block a user