DX: rector apply rules 'symfony up to 4.4

This commit is contained in:
2023-05-05 18:21:09 +02:00
parent f04ef9c931
commit efaa01f4f6
45 changed files with 75 additions and 74 deletions

View File

@@ -24,7 +24,7 @@ use Symfony\Contracts\Translation\TranslatorInterface;
class PersonAddressMoveEventSubscriber implements EventSubscriberInterface
{
public function __construct(private readonly EngineInterface $engine, private readonly NotificationPersisterInterface $notificationPersister, private readonly Security $security, private readonly TranslatorInterface $translator)
public function __construct(private readonly \Twig\Environment $engine, private readonly NotificationPersisterInterface $notificationPersister, private readonly Security $security, private readonly TranslatorInterface $translator)
{
}

View File

@@ -24,7 +24,7 @@ use Symfony\Contracts\Translation\TranslatorInterface;
class UserRefEventSubscriber implements EventSubscriberInterface
{
public function __construct(private readonly Security $security, private readonly TranslatorInterface $translator, private readonly EngineInterface $engine, private readonly NotificationPersisterInterface $notificationPersister)
public function __construct(private readonly Security $security, private readonly TranslatorInterface $translator, private readonly \Twig\Environment $engine, private readonly NotificationPersisterInterface $notificationPersister)
{
}

View File

@@ -63,7 +63,7 @@ final class ChillPersonMoveCommand extends Command
->addOption('delete-entity', null, InputOption::VALUE_REQUIRED | InputOption::VALUE_IS_ARRAY, 'entity to delete', []);
}
protected function execute(InputInterface $input, OutputInterface $output)
protected function execute(InputInterface $input, OutputInterface $output): int
{
$repository = $this->em->getRepository(Person::class);
$from = $repository->find($input->getOption('from'));
@@ -100,6 +100,7 @@ final class ChillPersonMoveCommand extends Command
$this->chillLogger->notice('Move a person from command line succeeded', $ctxt);
}
return 0;
}
protected function interact(InputInterface $input, OutputInterface $output)

View File

@@ -41,7 +41,7 @@ final class ImportSocialWorkMetadata extends Command
->addOption('language', 'l', InputOption::VALUE_OPTIONAL, 'The default language');
}
protected function execute(InputInterface $input, OutputInterface $output)
protected function execute(InputInterface $input, OutputInterface $output): int
{
$filepath = $input->getOption('filepath');

View File

@@ -32,7 +32,7 @@ use Symfony\Component\Templating\EngineInterface;
class AccompanyingPeriodRegulationListController
{
public function __construct(private readonly AccompanyingPeriodACLAwareRepositoryInterface $accompanyingPeriodACLAwareRepository, private readonly EngineInterface $engine, private readonly FormFactoryInterface $formFactory, private readonly PaginatorFactory $paginatorFactory, private readonly Security $security, private readonly TranslatableStringHelperInterface $translatableStringHelper)
public function __construct(private readonly AccompanyingPeriodACLAwareRepositoryInterface $accompanyingPeriodACLAwareRepository, private readonly \Twig\Environment $engine, private readonly FormFactoryInterface $formFactory, private readonly PaginatorFactory $paginatorFactory, private readonly Security $security, private readonly TranslatableStringHelperInterface $translatableStringHelper)
{
}

View File

@@ -36,7 +36,7 @@ use Symfony\Contracts\Translation\TranslatorInterface;
class HouseholdCompositionController extends AbstractController
{
public function __construct(private readonly Security $security, private readonly HouseholdCompositionRepository $householdCompositionRepository, private readonly HouseholdRepository $householdRepository, private readonly PaginatorFactory $paginatorFactory, private readonly FormFactoryInterface $formFactory, private readonly EntityManagerInterface $entityManager, private readonly TranslatorInterface $translator, private readonly EngineInterface $engine, private readonly UrlGeneratorInterface $urlGenerator)
public function __construct(private readonly Security $security, private readonly HouseholdCompositionRepository $householdCompositionRepository, private readonly HouseholdRepository $householdRepository, private readonly PaginatorFactory $paginatorFactory, private readonly FormFactoryInterface $formFactory, private readonly EntityManagerInterface $entityManager, private readonly TranslatorInterface $translator, private readonly \Twig\Environment $engine, private readonly UrlGeneratorInterface $urlGenerator)
{
}

View File

@@ -40,7 +40,7 @@ use function is_int;
class ReassignAccompanyingPeriodController extends AbstractController
{
public function __construct(private readonly AccompanyingPeriodACLAwareRepositoryInterface $accompanyingPeriodACLAwareRepository, private readonly UserRepository $userRepository, private readonly AccompanyingPeriodRepository $courseRepository, private readonly EngineInterface $engine, private readonly FormFactoryInterface $formFactory, private readonly PaginatorFactory $paginatorFactory, private readonly Security $security, private readonly UserRender $userRender, private readonly EntityManagerInterface $em)
public function __construct(private readonly AccompanyingPeriodACLAwareRepositoryInterface $accompanyingPeriodACLAwareRepository, private readonly UserRepository $userRepository, private readonly AccompanyingPeriodRepository $courseRepository, private readonly \Twig\Environment $engine, private readonly FormFactoryInterface $formFactory, private readonly PaginatorFactory $paginatorFactory, private readonly Security $security, private readonly UserRender $userRender, private readonly EntityManagerInterface $em)
{
}

View File

@@ -42,7 +42,7 @@ class LoadRelationships extends Fixture implements DependentFixtureInterface
public function load(ObjectManager $manager): void
{
return;
/** @var array<int, array<int, 1>> $existing */
$existing = [];
for ($i = 0; 20 > $i; ++$i) {
@@ -60,15 +60,16 @@ class LoadRelationships extends Fixture implements DependentFixtureInterface
->setUpdatedAt($date);
// remove the potential duplicates
$set = $relationship->getFromPerson()->getId() < $relationship->getToPerson()->getId() ?
[$relationship->getFromPerson()->getId(), $relationship->getToPerson()->getId()] :
[$relationship->getToPerson()->getId(), $relationship->getFromPerson()->getId()];
$set = [
min($relationship->getFromPerson()->getId(), $relationship->getToPerson()->getId()),
max($relationship->getFromPerson()->getId(), $relationship->getToPerson()->getId()),
];
if (array_key_exists($set[0], $existing) && array_key_exists($set[1], $existing[$set[0]])) {
continue;
}
$existing[$set[0]][$set[1]] = 1;
$existing[$set[0]][$existing[$set[1]]] = 1;
$manager->persist($relationship);
}

View File

@@ -45,7 +45,7 @@ class PersonSearch extends AbstractSearch implements HasAdvancedSearchFormInterf
'birthdate-after', 'gender', 'nationality', 'phonenumber', 'city',
];
public function __construct(private readonly EngineInterface $templating, private readonly ExtractDateFromPattern $extractDateFromPattern, private readonly ExtractPhonenumberFromPattern $extractPhonenumberFromPattern, private readonly PaginatorFactory $paginatorFactory, private readonly PersonACLAwareRepositoryInterface $personACLAwareRepository)
public function __construct(private readonly \Twig\Environment $templating, private readonly ExtractDateFromPattern $extractDateFromPattern, private readonly ExtractPhonenumberFromPattern $extractPhonenumberFromPattern, private readonly PaginatorFactory $paginatorFactory, private readonly PersonACLAwareRepositoryInterface $personACLAwareRepository)
{
}

View File

@@ -28,7 +28,7 @@ class PersonRender implements PersonRenderInterface
{
use BoxUtilsChillEntityRenderTrait;
public function __construct(private readonly ConfigPersonAltNamesHelper $configAltNamesHelper, private readonly EngineInterface $engine, private readonly TranslatorInterface $translator)
public function __construct(private readonly ConfigPersonAltNamesHelper $configAltNamesHelper, private readonly \Twig\Environment $engine, private readonly TranslatorInterface $translator)
{
}

View File

@@ -47,7 +47,7 @@ class SocialActionRender implements ChillEntityRenderInterface
*/
final public const SHOW_AND_CHILDREN = 'show_and_children';
public function __construct(private readonly TranslatableStringHelper $translatableStringHelper, private readonly EngineInterface $engine, private readonly TranslatorInterface $translator)
public function __construct(private readonly TranslatableStringHelper $translatableStringHelper, private readonly \Twig\Environment $engine, private readonly TranslatorInterface $translator)
{
}

View File

@@ -40,7 +40,7 @@ final readonly class SocialIssueRender implements ChillEntityRenderInterface
*/
public const SHOW_AND_CHILDREN = 'show_and_children';
public function __construct(private TranslatableStringHelper $translatableStringHelper, private EngineInterface $engine, private TranslatorInterface $translator)
public function __construct(private TranslatableStringHelper $translatableStringHelper, private \Twig\Environment $engine, private TranslatorInterface $translator)
{
}

View File

@@ -247,7 +247,7 @@ final class PersonMoveEventSubscriberTest extends KernelTestCase
}
private function buildSubscriber(
?EngineInterface $engine = null,
?\Twig\Environment $engine = null,
?NotificationPersisterInterface $notificationPersister = null,
?Security $security = null,
?TranslatorInterface $translator = null
@@ -264,7 +264,7 @@ final class PersonMoveEventSubscriberTest extends KernelTestCase
}
if (null === $engine) {
$double = $this->prophesize(EngineInterface::class);
$double = $this->prophesize(\Twig\Environment::class);
$engine = $double->reveal();
}