rector rules: apply rule with level 0

This commit is contained in:
2025-11-03 18:16:07 +01:00
parent 2ca88d786c
commit 6999919d9f
55 changed files with 98 additions and 65 deletions

View File

@@ -34,6 +34,9 @@ use Symfony\Contracts\Translation\TranslatorInterface;
class ListActivity implements ListInterface, GroupedExportInterface class ListActivity implements ListInterface, GroupedExportInterface
{ {
/**
* @var string[]
*/
protected array $fields = [ protected array $fields = [
'id', 'id',
'date', 'date',
@@ -67,7 +70,7 @@ class ListActivity implements ListInterface, GroupedExportInterface
'expanded' => true, 'expanded' => true,
'choices' => array_combine($this->fields, $this->fields), 'choices' => array_combine($this->fields, $this->fields),
'label' => 'Fields to include in export', 'label' => 'Fields to include in export',
'constraints' => [new Callback(callback: static function ($selected, ExecutionContextInterface $context) { 'constraints' => [new Callback(callback: static function ($selected, ExecutionContextInterface $context): void {
if (0 === \count($selected)) { if (0 === \count($selected)) {
$context->buildViolation('You must select at least one element') $context->buildViolation('You must select at least one element')
->atPath('fields') ->atPath('fields')

View File

@@ -357,7 +357,7 @@ class ActivityType extends AbstractType
$durationTimeTransformer, $durationTimeTransformer,
$durationTimeOptions, $durationTimeOptions,
$fieldName $fieldName
) { ): void {
// set the timezone to GMT, and fix the difference between current and GMT // set the timezone to GMT, and fix the difference between current and GMT
// the datetimetransformer will then handle timezone as GMT // the datetimetransformer will then handle timezone as GMT
$timezoneUTC = new \DateTimeZone('GMT'); $timezoneUTC = new \DateTimeZone('GMT');

View File

@@ -87,7 +87,7 @@ final class AsideActivityFormType extends AbstractType
$durationTimeTransformer, $durationTimeTransformer,
$durationTimeOptions, $durationTimeOptions,
$fieldName $fieldName
) { ): void {
// set the timezone to GMT, and fix the difference between current and GMT // set the timezone to GMT, and fix the difference between current and GMT
// the datetimetransformer will then handle timezone as GMT // the datetimetransformer will then handle timezone as GMT
$timezoneUTC = new \DateTimeZone('GMT'); $timezoneUTC = new \DateTimeZone('GMT');

View File

@@ -83,7 +83,7 @@ final class CalendarContextTest extends TestCase
// we will try once with askThirdParty = true, once with askPerson = true, and once with both // we will try once with askThirdParty = true, once with askPerson = true, and once with both
// so, we expect the call to be twice for each method // so, we expect the call to be twice for each method
$formBuilder->add('thirdParty', EntityType::class, Argument::type('array')) $formBuilder->add('thirdParty', EntityType::class, Argument::type('array'))
->should(static function ($calls, $object, $method) use ($tp1, $tp2) { ->should(static function ($calls, $object, $method) use ($tp1, $tp2): void {
if (2 !== \count($calls)) { if (2 !== \count($calls)) {
throw new FailedPredictionException(sprintf('the $builder->add should be called exactly 2, %d receivved', \count($calls))); throw new FailedPredictionException(sprintf('the $builder->add should be called exactly 2, %d receivved', \count($calls)));
} }
@@ -103,7 +103,7 @@ final class CalendarContextTest extends TestCase
} }
}); });
$formBuilder->add('mainPerson', EntityType::class, Argument::type('array')) $formBuilder->add('mainPerson', EntityType::class, Argument::type('array'))
->should(static function ($calls, $object, $method) use ($p1) { ->should(static function ($calls, $object, $method) use ($p1): void {
if (2 !== \count($calls)) { if (2 !== \count($calls)) {
throw new FailedPredictionException(sprintf('the $builder->add should be called exactly 2, %d receivved', \count($calls))); throw new FailedPredictionException(sprintf('the $builder->add should be called exactly 2, %d receivved', \count($calls)));
} }
@@ -176,7 +176,7 @@ final class CalendarContextTest extends TestCase
$em = $this->prophesize(EntityManagerInterface::class); $em = $this->prophesize(EntityManagerInterface::class);
$em->persist(Argument::type(CalendarDoc::class))->should( $em->persist(Argument::type(CalendarDoc::class))->should(
static function ($calls, $object, $method) use ($storedObject) { static function ($calls, $object, $method) use ($storedObject): void {
if (1 !== \count($calls)) { if (1 !== \count($calls)) {
throw new FailedPredictionException('the persist method should be called once'); throw new FailedPredictionException('the persist method should be called once');
} }

View File

@@ -190,7 +190,7 @@ class CreateFieldsOnGroupCommand
array_walk( array_walk(
$customFieldsGroups, $customFieldsGroups,
static function (CustomFieldsGroup $customFieldGroup, $key) use ($languages, &$rows, $customizableEntities) { static function (CustomFieldsGroup $customFieldGroup, $key) use ($languages, &$rows, $customizableEntities): void {
// set id and entity // set id and entity
$row = [ $row = [
$customFieldGroup->getId(), $customFieldGroup->getId(),

View File

@@ -66,7 +66,7 @@ class CustomFieldDate extends AbstractCustomField
public function buildOptionsForm(FormBuilderInterface $builder): FormBuilderInterface public function buildOptionsForm(FormBuilderInterface $builder): FormBuilderInterface
{ {
$validatorFunction = static function ($value, ExecutionContextInterface $context) { $validatorFunction = static function ($value, ExecutionContextInterface $context): void {
try { try {
$date = new \DateTime((string) $value); $date = new \DateTime((string) $value);
} catch (\Exception) { } catch (\Exception) {
@@ -168,7 +168,7 @@ class CustomFieldDate extends AbstractCustomField
// add constraints if required // add constraints if required
if (null !== $options[self::MIN]) { if (null !== $options[self::MIN]) {
$fieldOptions['constraints'][] = new Callback( $fieldOptions['constraints'][] = new Callback(
static function ($timestamp, ExecutionContextInterface $context) use ($options) { static function ($timestamp, ExecutionContextInterface $context) use ($options): void {
if (null === $timestamp) { if (null === $timestamp) {
return; return;
} }
@@ -189,7 +189,7 @@ class CustomFieldDate extends AbstractCustomField
if (null !== $options[self::MAX]) { if (null !== $options[self::MAX]) {
$fieldOptions['constraints'][] = new Callback( $fieldOptions['constraints'][] = new Callback(
static function ($timestamp, ExecutionContextInterface $context) use ($options) { static function ($timestamp, ExecutionContextInterface $context) use ($options): void {
if (null === $timestamp) { if (null === $timestamp) {
return; return;
} }

View File

@@ -65,7 +65,7 @@ class CustomFieldType extends AbstractType
'label' => 'Required field', 'label' => 'Required field',
]) ])
->add('type', HiddenType::class, ['data' => $options['type']]) ->add('type', HiddenType::class, ['data' => $options['type']])
->addEventListener(FormEvents::PRE_SET_DATA, static function (FormEvent $event) { ->addEventListener(FormEvents::PRE_SET_DATA, static function (FormEvent $event): void {
$customField = $event->getData(); $customField = $event->getData();
$form = $event->getForm(); $form = $event->getForm();

View File

@@ -49,7 +49,7 @@ class CustomFieldsGroupType extends AbstractType
$builder->addEventListener( $builder->addEventListener(
FormEvents::POST_SET_DATA, FormEvents::POST_SET_DATA,
static function (FormEvent $event) use ($customizableEntities, $builder) { static function (FormEvent $event) use ($customizableEntities, $builder): void {
$form = $event->getForm(); $form = $event->getForm();
$group = $event->getData(); $group = $event->getData();

View File

@@ -31,7 +31,7 @@ class ChoicesListType extends AbstractType
'required' => false, 'required' => false,
]) ])
->add('slug', HiddenType::class) ->add('slug', HiddenType::class)
->addEventListener(FormEvents::SUBMIT, static function (FormEvent $event) { ->addEventListener(FormEvents::SUBMIT, static function (FormEvent $event): void {
$form = $event->getForm(); $form = $event->getForm();
$data = $event->getData(); $data = $event->getData();

View File

@@ -25,7 +25,7 @@ use Twig\TwigFunction;
class CustomFieldRenderingTwig extends AbstractExtension class CustomFieldRenderingTwig extends AbstractExtension
{ {
/** /**
* @var array The default parameters * @var array<string, string> The default parameters
*/ */
private array $defaultParams = [ private array $defaultParams = [
'label_layout' => '@ChillCustomFields/CustomField/render_label.html.twig', 'label_layout' => '@ChillCustomFields/CustomField/render_label.html.twig',

View File

@@ -23,7 +23,7 @@ use Twig\TwigFunction;
final class CustomFieldsGroupRenderingTwig extends AbstractExtension final class CustomFieldsGroupRenderingTwig extends AbstractExtension
{ {
/** /**
* @var array The default parameters * @var array<string, string|bool> The default parameters
*/ */
private array $defaultParams = [ private array $defaultParams = [
'layout' => '@ChillCustomFields/CustomFieldsGroup/render.html.twig', 'layout' => '@ChillCustomFields/CustomFieldsGroup/render.html.twig',

View File

@@ -37,7 +37,7 @@ final class ConfigCustomizablesEntitiesTest extends KernelTestCase
$this->assertIsArray($customizableEntities); $this->assertIsArray($customizableEntities);
$this->assertCount(2, $customizableEntities); $this->assertCount(2, $customizableEntities);
foreach ($customizableEntities as $key => $config) { foreach ($customizableEntities as $config) {
$this->assertIsArray($config); $this->assertIsArray($config);
$this->assertArrayHasKey('name', $config); $this->assertArrayHasKey('name', $config);
$this->assertArrayHasKey('class', $config); $this->assertArrayHasKey('class', $config);

View File

@@ -51,7 +51,7 @@ final readonly class PdfSignedMessageHandler
throw new \RuntimeException('no stored object found'); throw new \RuntimeException('no stored object found');
} }
$this->entityManager->wrapInTransaction(function () use ($storedObject, $message, $signature) { $this->entityManager->wrapInTransaction(function () use ($storedObject, $message, $signature): void {
$this->storedObjectManager->write($storedObject, $message->content); $this->storedObjectManager->write($storedObject, $message->content);
$this->signatureStepStateChanger->markSignatureAsSigned($signature, $message->signatureZoneIndex); $this->signatureStepStateChanger->markSignatureAsSigned($signature, $message->signatureZoneIndex);
}); });

View File

@@ -541,7 +541,7 @@ final class EventController extends AbstractController
$response->setPrivate(); $response->setPrivate();
$response->headers->addCacheControlDirective('no-cache', true); $response->headers->addCacheControlDirective('no-cache', true);
$response->headers->addCacheControlDirective('must-revalidate', true); $response->headers->addCacheControlDirective('must-revalidate', true);
$response->setCallback(static function () use ($writer) { $response->setCallback(static function () use ($writer): void {
$writer->save('php://output'); $writer->save('php://output');
}); });

View File

@@ -40,6 +40,9 @@ use Symfony\Contracts\Translation\TranslatableInterface;
*/ */
class ListEvents implements ListInterface, GroupedExportInterface class ListEvents implements ListInterface, GroupedExportInterface
{ {
/**
* @var string[]
*/
protected array $fields = [ protected array $fields = [
'event_id', 'event_id',
'event_center', 'event_center',
@@ -77,7 +80,7 @@ class ListEvents implements ListInterface, GroupedExportInterface
'expanded' => true, 'expanded' => true,
'choices' => array_combine($this->fields, $this->fields), 'choices' => array_combine($this->fields, $this->fields),
'label' => 'Fields to include in export', 'label' => 'Fields to include in export',
'constraints' => [new Callback(callback: static function ($selected, ExecutionContextInterface $context) { 'constraints' => [new Callback(callback: static function ($selected, ExecutionContextInterface $context): void {
if (0 === \count($selected)) { if (0 === \count($selected)) {
$context->buildViolation('You must select at least one element') $context->buildViolation('You must select at least one element')
->atPath('fields') ->atPath('fields')

View File

@@ -52,7 +52,7 @@ final class PickRoleType extends AbstractType
if (null === $options['group_by']) { if (null === $options['group_by']) {
$builder->addEventListener( $builder->addEventListener(
FormEvents::PRE_SET_DATA, FormEvents::PRE_SET_DATA,
function (FormEvent $event) use ($options) { function (FormEvent $event) use ($options): void {
if (null === $options['event_type']) { if (null === $options['event_type']) {
$form = $event->getForm(); $form = $event->getForm();
$name = $form->getName(); $name = $form->getName();

View File

@@ -52,7 +52,7 @@ final class PickStatusType extends AbstractType
if (null === $options['group_by'] && null === $options['event_type']) { if (null === $options['group_by'] && null === $options['event_type']) {
$builder->addEventListener( $builder->addEventListener(
FormEvents::PRE_SET_DATA, FormEvents::PRE_SET_DATA,
function (FormEvent $event) { function (FormEvent $event): void {
$form = $event->getForm(); $form = $event->getForm();
$name = $form->getName(); $name = $form->getName();
$config = $form->getConfig(); $config = $form->getConfig();

View File

@@ -180,7 +180,7 @@ final class EventSearchTest extends WebTestCase
} }
// iterate on pagination // iterate on pagination
$crawlerAllResults->filter('.pagination a')->each(function ($a, $i) use ($dateFrom) { $crawlerAllResults->filter('.pagination a')->each(function ($a, $i) use ($dateFrom): void {
$page = $this->client->click($a->link()); $page = $this->client->click($a->link());
$dates = $this->iterateOnRowsToFindDate($page->filter('tr')); $dates = $this->iterateOnRowsToFindDate($page->filter('tr'));
@@ -216,7 +216,7 @@ final class EventSearchTest extends WebTestCase
} }
// iterate on pagination // iterate on pagination
$crawlerAllResults->filter('.pagination a')->each(function ($a, $i) use ($dateFrom) { $crawlerAllResults->filter('.pagination a')->each(function ($a, $i) use ($dateFrom): void {
$page = $this->client->click($a->link()); $page = $this->client->click($a->link());
$dates = $this->iterateOnRowsToFindDate($page->filter('tr')); $dates = $this->iterateOnRowsToFindDate($page->filter('tr'));
@@ -256,7 +256,7 @@ final class EventSearchTest extends WebTestCase
} }
// iterate on pagination // iterate on pagination
$crawlerAllResults->filter('.pagination a')->each(function ($a, $i) { $crawlerAllResults->filter('.pagination a')->each(function ($a, $i): void {
$page = $this->client->click($a->link()); $page = $this->client->click($a->link());
$dates = $this->iterateOnRowsToFindDate($page->filter('tr')); $dates = $this->iterateOnRowsToFindDate($page->filter('tr'));

View File

@@ -99,7 +99,7 @@ class ListCV implements ListInterface, ExportElementValidatedInterface
'data' => array_combine($this->getFields(), $this->getFields()), 'data' => array_combine($this->getFields(), $this->getFields()),
'choice_attr' => [], 'choice_attr' => [],
'attr' => ['class' => ''], 'attr' => ['class' => ''],
'constraints' => [new Callback(callback: function ($selected, ExecutionContextInterface $context) { 'constraints' => [new Callback(callback: function ($selected, ExecutionContextInterface $context): void {
if (0 === count($selected)) { if (0 === count($selected)) {
$context $context
->buildViolation('You must select at least one element') ->buildViolation('You must select at least one element')

View File

@@ -112,7 +112,7 @@ class ListFrein implements ListInterface, ExportElementValidatedInterface
'data' => array_combine($this->getFields(), $this->getFields()), 'data' => array_combine($this->getFields(), $this->getFields()),
'choice_attr' => [], 'choice_attr' => [],
'attr' => ['class' => ''], 'attr' => ['class' => ''],
'constraints' => [new Callback(callback: function ($selected, ExecutionContextInterface $context) { 'constraints' => [new Callback(callback: function ($selected, ExecutionContextInterface $context): void {
if (0 === count($selected)) { if (0 === count($selected)) {
$context $context
->buildViolation('You must select at least one element') ->buildViolation('You must select at least one element')

View File

@@ -118,7 +118,7 @@ class ListProjetProfessionnel implements ListInterface, ExportElementValidatedIn
'data' => array_combine($this->getFields(), $this->getFields()), 'data' => array_combine($this->getFields(), $this->getFields()),
'choice_attr' => [], 'choice_attr' => [],
'attr' => ['class' => ''], 'attr' => ['class' => ''],
'constraints' => [new Callback(callback: function ($selected, ExecutionContextInterface $context) { 'constraints' => [new Callback(callback: function ($selected, ExecutionContextInterface $context): void {
if (0 === count($selected)) { if (0 === count($selected)) {
$context $context
->buildViolation('You must select at least one element') ->buildViolation('You must select at least one element')

View File

@@ -29,11 +29,17 @@ class LoadAndUpdateLanguagesCommand
final public const string INCLUDE_REGIONAL_VERSION = 'include_regional'; final public const string INCLUDE_REGIONAL_VERSION = 'include_regional';
// Array of ancien languages (to exclude) // Array of ancien languages (to exclude)
/**
* @var string[]
*/
private array $ancientToExclude = ['ang', 'egy', 'fro', 'goh', 'grc', 'la', 'non', 'peo', 'pro', 'sga', private array $ancientToExclude = ['ang', 'egy', 'fro', 'goh', 'grc', 'la', 'non', 'peo', 'pro', 'sga',
'dum', 'enm', 'frm', 'gmh', 'mga', 'akk', 'phn', 'zxx', 'got', 'und', ]; 'dum', 'enm', 'frm', 'gmh', 'mga', 'akk', 'phn', 'zxx', 'got', 'und', ];
// The regional version of language are language with _ in the code // The regional version of language are language with _ in the code
// This array contains regional code to not exclude // This array contains regional code to not exclude
/**
* @var string[]
*/
private array $regionalVersionToInclude = ['ro_MD']; private array $regionalVersionToInclude = ['ro_MD'];
/** /**

View File

@@ -462,7 +462,7 @@ class ExportController extends AbstractController
$groups = $exportManager->getExportsGrouped(true); $groups = $exportManager->getExportsGrouped(true);
foreach ($groups as $group => $array) { foreach ($groups as $group => $array) {
foreach ($array as $alias => $export) { foreach ($array as $export) {
if ($export === $target) { if ($export === $target) {
return $group; return $group;
} }

View File

@@ -243,7 +243,7 @@ final class PasswordController extends AbstractController
->add('username_or_email', TextType::class, [ ->add('username_or_email', TextType::class, [
'label' => 'Username or email', 'label' => 'Username or email',
'constraints' => [ 'constraints' => [
new Callback(callback: function ($pattern, ExecutionContextInterface $context, $payload) { new Callback(callback: function ($pattern, ExecutionContextInterface $context, $payload): void {
$qb = $this->managerRegistry->getManager() $qb = $this->managerRegistry->getManager()
->createQueryBuilder(); ->createQueryBuilder();
$qb->select('COUNT(u)') $qb->select('COUNT(u)')

View File

@@ -74,7 +74,7 @@ final readonly class UserExportController
$csv->insertAll($users); $csv->insertAll($users);
return new StreamedResponse( return new StreamedResponse(
function () use ($csv) { function () use ($csv): void {
foreach ($csv->chunk(1024) as $chunk) { foreach ($csv->chunk(1024) as $chunk) {
echo $chunk; echo $chunk;
flush(); flush();
@@ -123,7 +123,7 @@ final readonly class UserExportController
$csv->insertAll($userPermissions); $csv->insertAll($userPermissions);
return new StreamedResponse( return new StreamedResponse(
function () use ($csv) { function () use ($csv): void {
foreach ($csv->chunk(1024) as $chunk) { foreach ($csv->chunk(1024) as $chunk) {
echo $chunk; echo $chunk;
flush(); flush();

View File

@@ -20,6 +20,9 @@ use Doctrine\Persistence\ObjectManager;
class LoadGenders extends AbstractFixture implements OrderedFixtureInterface class LoadGenders extends AbstractFixture implements OrderedFixtureInterface
{ {
/**
* @var array<mixed, array<string, array<string, string>|Chill\MainBundle\Entity\GenderEnum::MALE|Chill\MainBundle\Entity\GenderIconEnum::MALE|Chill\MainBundle\Entity\GenderEnum::FEMALE|Chill\MainBundle\Entity\GenderIconEnum::FEMALE|Chill\MainBundle\Entity\GenderEnum::NEUTRAL|Chill\MainBundle\Entity\GenderIconEnum::NEUTRAL>>
*/
private array $genders = [ private array $genders = [
[ [
'label' => ['en' => 'man', 'fr' => 'homme'], 'label' => ['en' => 'man', 'fr' => 'homme'],

View File

@@ -23,11 +23,17 @@ use Symfony\Component\DependencyInjection\ParameterBag\ParameterBagInterface;
class LoadLanguages extends Fixture implements OrderedFixtureInterface class LoadLanguages extends Fixture implements OrderedFixtureInterface
{ {
// Array of ancien languages (to exclude) // Array of ancien languages (to exclude)
/**
* @var string[]
*/
private array $ancientToExclude = ['ang', 'egy', 'fro', 'goh', 'grc', 'la', 'non', 'peo', 'pro', 'sga', private array $ancientToExclude = ['ang', 'egy', 'fro', 'goh', 'grc', 'la', 'non', 'peo', 'pro', 'sga',
'dum', 'enm', 'frm', 'gmh', 'mga', 'akk', 'phn', 'zxx', 'got', 'und', ]; 'dum', 'enm', 'frm', 'gmh', 'mga', 'akk', 'phn', 'zxx', 'got', 'und', ];
// The regional version of language are language with _ in the code // The regional version of language are language with _ in the code
// This array contains regional code to not exclude // This array contains regional code to not exclude
/**
* @var string[]
*/
private array $regionalVersionToInclude = ['ro_MD']; private array $regionalVersionToInclude = ['ro_MD'];
private readonly array $availableLanguages; private readonly array $availableLanguages;

View File

@@ -97,7 +97,7 @@ class PermissionsGroup
); );
$countedIds = array_count_values($roleScopesId); $countedIds = array_count_values($roleScopesId);
foreach ($countedIds as $id => $nb) { foreach ($countedIds as $nb) {
if (1 < $nb) { if (1 < $nb) {
$context->buildViolation('A permission is already present ' $context->buildViolation('A permission is already present '
.'for the same role and scope') .'for the same role and scope')

View File

@@ -152,7 +152,7 @@ class EntityWorkflowSend implements TrackCreationInterface
public function increaseErrorTrials(): void public function increaseErrorTrials(): void
{ {
$this->numberOfErrorTrials = $this->numberOfErrorTrials + 1; $this->numberOfErrorTrials += 1;
} }
public function getDestinee(): string|ThirdParty public function getDestinee(): string|ThirdParty

View File

@@ -51,7 +51,7 @@ final readonly class ExportDescriptionHelper
$output[] = $this->trans($filter->describeAction($denormalized['filters'][$name]['form'], $context)); $output[] = $this->trans($filter->describeAction($denormalized['filters'][$name]['form'], $context));
} }
foreach ($this->exportConfigProcessor->retrieveUsedAggregators($denormalized['aggregators']) as $name => $aggregator) { foreach ($this->exportConfigProcessor->retrieveUsedAggregators($denormalized['aggregators']) as $aggregator) {
$output[] = $this->trans($aggregator->getTitle()); $output[] = $this->trans($aggregator->getTitle());
} }

View File

@@ -222,7 +222,7 @@ final readonly class ExportGenerator
$usedTypes = []; $usedTypes = [];
foreach ($this->exportConfigProcessor->retrieveUsedAggregators($data) as $alias => $aggregator) { foreach ($this->exportConfigProcessor->retrieveUsedAggregators($data) as $aggregator) {
if (!\in_array($aggregator->applyOn(), $usedTypes, true)) { if (!\in_array($aggregator->applyOn(), $usedTypes, true)) {
$usedTypes[] = $aggregator->applyOn(); $usedTypes[] = $aggregator->applyOn();
} }

View File

@@ -119,7 +119,7 @@ trait AppendScopeChoiceTypeTrait
$builder->addEventListener( $builder->addEventListener(
FormEvents::PRE_SET_DATA, FormEvents::PRE_SET_DATA,
static function (FormEvent $event) use ($choices, $name, $dataTransformer, $builder) { static function (FormEvent $event) use ($choices, $name, $dataTransformer, $builder): void {
$form = $event->getForm(); $form = $event->getForm();
$form->add( $form->add(
$builder $builder

View File

@@ -41,7 +41,7 @@ class CommentType extends AbstractType
'label' => $options['label'], 'label' => $options['label'],
]); ]);
$builder->addEventListener(FormEvents::PRE_SUBMIT, function (FormEvent $event) { $builder->addEventListener(FormEvents::PRE_SUBMIT, function (FormEvent $event): void {
$data = $event->getForm()->getData(); $data = $event->getForm()->getData();
$comment = $event->getData() ?? ['comment' => '']; $comment = $event->getData() ?? ['comment' => ''];

View File

@@ -69,7 +69,7 @@ class UserPasswordType extends AbstractType
'label' => 'Your actual password', 'label' => 'Your actual password',
'mapped' => false, 'mapped' => false,
'constraints' => [ 'constraints' => [
new Callback(callback: function ($password, ExecutionContextInterface $context, $payload) use ($options) { new Callback(callback: function ($password, ExecutionContextInterface $context, $payload) use ($options): void {
if (true === $this->passwordEncoder->isPasswordValid($options['user'], $password)) { if (true === $this->passwordEncoder->isPasswordValid($options['user'], $password)) {
return; return;
} }

View File

@@ -23,7 +23,7 @@ class MenuTwig extends AbstractExtension
/** /**
* the default parameters for chillMenu. * the default parameters for chillMenu.
* *
* @var mixed[] * @var array<string, string|mixed[]|null>
*/ */
private array $defaultParams = [ private array $defaultParams = [
'layout' => '@ChillMain/Menu/defaultMenu.html.twig', 'layout' => '@ChillMain/Menu/defaultMenu.html.twig',

View File

@@ -70,7 +70,7 @@ final readonly class AddressToReferenceMatcher
{ {
$this->logger->notice(self::LOG_PREFIX.'Starting addresses matching'); $this->logger->notice(self::LOG_PREFIX.'Starting addresses matching');
$this->connection->transactional(function () { $this->connection->transactional(function (): void {
$markedAsMatching = $this->connection->executeStatement( $markedAsMatching = $this->connection->executeStatement(
strtr(self::SQL_MARK_MATCHING_ADDRESSES_REVIEWED_OR_TO_REVIEW, self::SUBSTITUTES) strtr(self::SQL_MARK_MATCHING_ADDRESSES_REVIEWED_OR_TO_REVIEW, self::SUBSTITUTES)
); );

View File

@@ -171,7 +171,7 @@ final class GeographicalUnitBaseImporter
private function updateGeographicalUnitTable(): void private function updateGeographicalUnitTable(): void
{ {
$this->defaultConnection->transactional( $this->defaultConnection->transactional(
function () { function (): void {
// 0) create new layers // 0) create new layers
$this->defaultConnection->executeStatement( $this->defaultConnection->executeStatement(
" "

View File

@@ -358,7 +358,7 @@ class CountriesInfo
if (null === self::$cacheCountriesCodeByContinent) { if (null === self::$cacheCountriesCodeByContinent) {
$data = self::getArrayCountriesData(); $data = self::getArrayCountriesData();
array_walk($data, static function ($item, $key) { array_walk($data, static function ($item, $key): void {
self::$cacheCountriesCodeByContinent[$item[0]][] = $item[1]; self::$cacheCountriesCodeByContinent[$item[0]][] = $item[1];
}); });
} }

View File

@@ -33,7 +33,7 @@ final readonly class PostSignatureStateChangeHandler
throw new UnrecoverableMessageHandlingException('signature not found'); throw new UnrecoverableMessageHandlingException('signature not found');
} }
$this->entityManager->wrapInTransaction(function () use ($signature) { $this->entityManager->wrapInTransaction(function () use ($signature): void {
$this->signatureStepStateChanger->onPostMark($signature); $this->signatureStepStateChanger->onPostMark($signature);
$this->entityManager->flush(); $this->entityManager->flush();

View File

@@ -48,7 +48,7 @@ class SocialActionCSVExportController extends AbstractController
$csv = $this->socialActionCSVExportService->generateCsv($actions); $csv = $this->socialActionCSVExportService->generateCsv($actions);
return new StreamedResponse( return new StreamedResponse(
function () use ($csv) { function () use ($csv): void {
foreach ($csv->chunk(1024) as $chunk) { foreach ($csv->chunk(1024) as $chunk) {
echo $chunk; echo $chunk;
flush(); flush();

View File

@@ -48,7 +48,7 @@ class SocialIssueCSVExportController extends AbstractController
$csv = $this->socialIssueCSVExportService->generateCsv($socialIssues); $csv = $this->socialIssueCSVExportService->generateCsv($socialIssues);
return new StreamedResponse( return new StreamedResponse(
function () use ($csv) { function () use ($csv): void {
foreach ($csv->chunk(1024) as $chunk) { foreach ($csv->chunk(1024) as $chunk) {
echo $chunk; echo $chunk;
flush(); flush();

View File

@@ -25,6 +25,9 @@ class LoadAccompanyingPeriodOrigin extends AbstractFixture implements OrderedFix
public static $references = []; public static $references = [];
/**
* @var array<string, string>
*/
private array $phoneCall = ['en' => 'phone call', 'fr' => 'appel téléphonique']; private array $phoneCall = ['en' => 'phone call', 'fr' => 'appel téléphonique'];
public function getOrder(): int public function getOrder(): int

View File

@@ -21,6 +21,9 @@ use Doctrine\Persistence\ObjectManager;
*/ */
class LoadMaritalStatus extends AbstractFixture implements OrderedFixtureInterface class LoadMaritalStatus extends AbstractFixture implements OrderedFixtureInterface
{ {
/**
* @var array<mixed, array<string, string|array<string, string>>>
*/
private array $maritalStatuses = [ private array $maritalStatuses = [
['id' => 'single', 'name' => ['en' => 'single', 'fr' => 'célibataire']], ['id' => 'single', 'name' => ['en' => 'single', 'fr' => 'célibataire']],
['id' => 'married', 'name' => ['en' => 'married', 'fr' => 'marié(e)']], ['id' => 'married', 'name' => ['en' => 'married', 'fr' => 'marié(e)']],

View File

@@ -86,6 +86,9 @@ class LoadPeople extends Fixture implements OrderedFixtureInterface
protected NativeLoader $loader; protected NativeLoader $loader;
/**
* @var array<mixed, array<string, string|array<int, array<string, string>>|Chill\MainBundle\Entity\GenderEnum::MALE|Chill\MainBundle\Entity\GenderEnum::FEMALE>>
*/
private array $peoples = [ private array $peoples = [
[ [
'lastName' => 'Depardieu', 'lastName' => 'Depardieu',

View File

@@ -87,7 +87,7 @@ final readonly class ClosingMotiveFilter implements FilterInterface
{ {
$motives = []; $motives = [];
foreach ($data['accepted_closingmotives'] as $k => $v) { foreach ($data['accepted_closingmotives'] as $v) {
$motives[] = $this->translatableStringHelper->localize($v->getName()); $motives[] = $this->translatableStringHelper->localize($v->getName());
} }

View File

@@ -37,7 +37,7 @@ class PersonPhoneType extends AbstractType
'required' => false, 'required' => false,
]); ]);
$builder->addEventListener(FormEvents::POST_SUBMIT, function (FormEvent $event) { $builder->addEventListener(FormEvents::POST_SUBMIT, function (FormEvent $event): void {
if (null === $event->getData()) { if (null === $event->getData()) {
return; return;
} }

View File

@@ -31,7 +31,7 @@ readonly class AccompanyingPeriodWorkMergeService
*/ */
public function merge(AccompanyingPeriodWork $toKeep, AccompanyingPeriodWork $toDelete): AccompanyingPeriodWork public function merge(AccompanyingPeriodWork $toKeep, AccompanyingPeriodWork $toDelete): AccompanyingPeriodWork
{ {
$this->em->wrapInTransaction(function (EntityManagerInterface $entityManager) use ($toKeep, $toDelete) { $this->em->wrapInTransaction(function (EntityManagerInterface $entityManager) use ($toKeep, $toDelete): void {
$this->alterStartDate($toKeep, $toDelete); $this->alterStartDate($toKeep, $toDelete);
$this->alterEndDate($toKeep, $toDelete); $this->alterEndDate($toKeep, $toDelete);
$this->concatenateComments($toKeep, $toDelete); $this->concatenateComments($toKeep, $toDelete);

View File

@@ -85,7 +85,7 @@ class PersonMoveTest extends KernelTestCase
{ {
$move = new PersonMove($this->em, $this->personMoveManager, $this->eventDispatcher); $move = new PersonMove($this->em, $this->personMoveManager, $this->eventDispatcher);
$sqls = $move->getSQL($personA, $personB); $sqls = $move->getSQL($personA, $personB);
$this->em->getConnection()->transactional(function (Connection $conn) use ($sqls) { $this->em->getConnection()->transactional(function (Connection $conn) use ($sqls): void {
foreach ($sqls as $sql) { foreach ($sqls as $sql) {
$conn->executeStatement($sql); $conn->executeStatement($sql);
} }
@@ -244,7 +244,7 @@ class PersonMoveTest extends KernelTestCase
$move = new PersonMove($this->em, $this->personMoveManager, $this->eventDispatcher); $move = new PersonMove($this->em, $this->personMoveManager, $this->eventDispatcher);
$sqls = $move->getSQL($personA, $personB); $sqls = $move->getSQL($personA, $personB);
$this->em->getConnection()->transactional(function (Connection $conn) use ($sqls) { $this->em->getConnection()->transactional(function (Connection $conn) use ($sqls): void {
foreach ($sqls as $sql) { foreach ($sqls as $sql) {
$conn->executeStatement($sql); $conn->executeStatement($sql);
} }

View File

@@ -34,7 +34,7 @@ class AccompanyingPeriodWorkMergeServiceTest extends KernelTestCase
private function buildMergeService(AccompanyingPeriodWork $toRemove): AccompanyingPeriodWorkMergeService private function buildMergeService(AccompanyingPeriodWork $toRemove): AccompanyingPeriodWorkMergeService
{ {
$entityManager = $this->prophesize(EntityManagerInterface::class); $entityManager = $this->prophesize(EntityManagerInterface::class);
$entityManager->wrapInTransaction(Argument::type('callable'))->will(function ($args) use ($entityManager) { $entityManager->wrapInTransaction(Argument::type('callable'))->will(function ($args) use ($entityManager): void {
call_user_func_array($args[0], [$entityManager->reveal()]); call_user_func_array($args[0], [$entityManager->reveal()]);
})->shouldBeCalled(); })->shouldBeCalled();
$entityManager->remove($toRemove)->shouldBeCalled(); $entityManager->remove($toRemove)->shouldBeCalled();

View File

@@ -175,7 +175,7 @@ class AccompanyingPeriodContextTest extends KernelTestCase
'person1' => null, 'person1' => null,
'person2' => null, 'person2' => null,
], ],
function (array $data) use ($thirdParty, $period) { function (array $data) use ($thirdParty, $period): void {
self::assertArrayHasKey('thirdParty', $data); self::assertArrayHasKey('thirdParty', $data);
self::assertEquals($thirdParty->getId(), $data['thirdParty']['id']); self::assertEquals($thirdParty->getId(), $data['thirdParty']['id']);
@@ -206,7 +206,7 @@ class AccompanyingPeriodContextTest extends KernelTestCase
'person1' => null, 'person1' => null,
'person2' => null, 'person2' => null,
], ],
function (array $data) use ($person, $period) { function (array $data) use ($person, $period): void {
self::assertArrayHasKey('mainPerson', $data); self::assertArrayHasKey('mainPerson', $data);
self::assertEquals($person->getId(), $data['mainPerson']['id']); self::assertEquals($person->getId(), $data['mainPerson']['id']);
@@ -240,7 +240,7 @@ class AccompanyingPeriodContextTest extends KernelTestCase
'person1' => $person->getId(), 'person1' => $person->getId(),
'person2' => $person->getId(), 'person2' => $person->getId(),
], ],
function (array $data) use ($person, $thirdParty, $period) { function (array $data) use ($person, $thirdParty, $period): void {
self::assertArrayHasKey('mainPerson', $data); self::assertArrayHasKey('mainPerson', $data);
self::assertEquals($person->getId(), $data['mainPerson']['id']); self::assertEquals($person->getId(), $data['mainPerson']['id']);
@@ -283,7 +283,7 @@ class AccompanyingPeriodContextTest extends KernelTestCase
'person1' => null, 'person1' => null,
'person2' => null, 'person2' => null,
], ],
function (array $data) use ($period) { function (array $data) use ($period): void {
self::assertArrayHasKey('course', $data); self::assertArrayHasKey('course', $data);
self::assertEquals($period->getId(), $data['course']['id']); self::assertEquals($period->getId(), $data['course']['id']);
}, },

View File

@@ -159,7 +159,7 @@ final class PersonContextTest extends KernelTestCase
'title' => 'test', 'title' => 'test',
'scope_id' => null, 'scope_id' => null,
], ],
function ($data) use ($person, $thirdParty) { function ($data) use ($person, $thirdParty): void {
self::assertArrayHasKey('person', $data); self::assertArrayHasKey('person', $data);
self::assertEquals($person->getId(), $data['person']['id']); self::assertEquals($person->getId(), $data['person']['id']);
@@ -183,7 +183,7 @@ final class PersonContextTest extends KernelTestCase
'scope_id' => null, 'scope_id' => null,
'thirdParty' => null, 'thirdParty' => null,
], ],
function ($data) use ($person) { function ($data) use ($person): void {
self::assertArrayHasKey('person', $data); self::assertArrayHasKey('person', $data);
self::assertEquals($person->getId(), $data['person']['id']); self::assertEquals($person->getId(), $data['person']['id']);
}, },
@@ -202,7 +202,7 @@ final class PersonContextTest extends KernelTestCase
$parameter = new ParameterBag(['chill_main' => ['acl' => ['form_show_scopes' => false]]]); $parameter = new ParameterBag(['chill_main' => ['acl' => ['form_show_scopes' => false]]]);
$em = $this->prophesize(EntityManagerInterface::class); $em = $this->prophesize(EntityManagerInterface::class);
$em->persist(Argument::type(PersonDocument::class)) $em->persist(Argument::type(PersonDocument::class))
->should(static function ($calls, $object, $method) { ->should(static function ($calls, $object, $method): void {
if (1 !== \count($calls)) { if (1 !== \count($calls)) {
throw new FailedPredictionException(sprintf('the persist should be called exactly once, %d receivved', \count($calls))); throw new FailedPredictionException(sprintf('the persist should be called exactly once, %d receivved', \count($calls)));
} }
@@ -244,7 +244,7 @@ final class PersonContextTest extends KernelTestCase
$em = $this->prophesize(EntityManagerInterface::class); $em = $this->prophesize(EntityManagerInterface::class);
$em->persist(Argument::type(PersonDocument::class)) $em->persist(Argument::type(PersonDocument::class))
->should(static function ($calls, $object, $method) use ($scope) { ->should(static function ($calls, $object, $method) use ($scope): void {
if (1 !== \count($calls)) { if (1 !== \count($calls)) {
throw new FailedPredictionException(sprintf('the persist should be called exactly once, %d receivved', \count($calls))); throw new FailedPredictionException(sprintf('the persist should be called exactly once, %d receivved', \count($calls)));
} }
@@ -288,7 +288,7 @@ final class PersonContextTest extends KernelTestCase
$em = $this->prophesize(EntityManagerInterface::class); $em = $this->prophesize(EntityManagerInterface::class);
$em->persist(Argument::type(PersonDocument::class)) $em->persist(Argument::type(PersonDocument::class))
->should(static function ($calls, $object, $method) use ($scope) { ->should(static function ($calls, $object, $method) use ($scope): void {
if (1 !== \count($calls)) { if (1 !== \count($calls)) {
throw new FailedPredictionException(sprintf('the persist should be called exactly once, %d received', \count($calls))); throw new FailedPredictionException(sprintf('the persist should be called exactly once, %d received', \count($calls)));
} }

View File

@@ -41,6 +41,9 @@ use Symfony\Contracts\Translation\TranslatorInterface;
class ReportList implements ExportElementValidatedInterface, ListInterface class ReportList implements ExportElementValidatedInterface, ListInterface
{ {
use \Chill\MainBundle\Export\ExportDataNormalizerTrait; use \Chill\MainBundle\Export\ExportDataNormalizerTrait;
/**
* @var string[]
*/
protected array $fields = [ protected array $fields = [
'person_id', 'person_firstName', 'person_lastName', 'person_birthdate', 'person_id', 'person_firstName', 'person_lastName', 'person_birthdate',
'person_placeOfBirth', 'person_gender', 'person_memo', 'person_email', 'person_phonenumber', 'person_placeOfBirth', 'person_gender', 'person_memo', 'person_email', 'person_phonenumber',
@@ -85,7 +88,7 @@ class ReportList implements ExportElementValidatedInterface, ListInterface
default => $label. default => $label.
' ('.$this->translator->trans("Report's question").')', ' ('.$this->translator->trans("Report's question").')',
}, },
'constraints' => [new Callback(callback: static function ($selected, ExecutionContextInterface $context) { 'constraints' => [new Callback(callback: static function ($selected, ExecutionContextInterface $context): void {
if (0 === \count($selected)) { if (0 === \count($selected)) {
$context->buildViolation('You must select at least one element') $context->buildViolation('You must select at least one element')
->atPath('fields') ->atPath('fields')

View File

@@ -44,7 +44,7 @@ class ThirdpartyCSVExportController extends AbstractController
throw new AccessDeniedHttpException('Only ROLE_ADMIN can export this list'); throw new AccessDeniedHttpException('Only ROLE_ADMIN can export this list');
} }
$streamCallback = function () use ($request) { $streamCallback = function () use ($request): void {
$output = fopen('php://output', 'w'); $output = fopen('php://output', 'w');
// Add BOM for UTF-8 // Add BOM for UTF-8
@@ -91,7 +91,7 @@ class ThirdpartyCSVExportController extends AbstractController
}; };
return new StreamedResponse( return new StreamedResponse(
function () use ($streamCallback) { function () use ($streamCallback): void {
$streamCallback(); $streamCallback();
}, },
Response::HTTP_OK, Response::HTTP_OK,

View File

@@ -12,7 +12,7 @@ declare(strict_types=1);
use Chill\WopiBundle\Controller\Editor; use Chill\WopiBundle\Controller\Editor;
use Symfony\Component\Routing\Loader\Configurator\RoutingConfigurator; use Symfony\Component\Routing\Loader\Configurator\RoutingConfigurator;
return static function (RoutingConfigurator $routes) { return static function (RoutingConfigurator $routes): void {
$routes $routes
->add('chill_wopi_file_edit', '/edit/{fileId}') ->add('chill_wopi_file_edit', '/edit/{fileId}')
->controller(Editor::class); ->controller(Editor::class);

View File

@@ -22,7 +22,7 @@ use Chill\WopiBundle\Service\Wopi\ChillDocumentManager;
use Chill\WopiBundle\Service\Wopi\ChillWopi; use Chill\WopiBundle\Service\Wopi\ChillWopi;
use Chill\WopiBundle\Service\Wopi\UserManager; use Chill\WopiBundle\Service\Wopi\UserManager;
return static function (ContainerConfigurator $container) { return static function (ContainerConfigurator $container): void {
$services = $container $services = $container
->services(); ->services();