DX: fix cs

This commit is contained in:
2023-04-15 00:43:55 +02:00
parent 80647147ee
commit 746ed4f5e5
188 changed files with 309 additions and 308 deletions

View File

@@ -342,7 +342,7 @@ final class AccompanyingCourseApiControllerTest extends WebTestCase
// check that the person id is contained
$participationsPersonsIds = array_map(
static fn($participation) => $participation->person->id,
static fn ($participation) => $participation->person->id,
$data->participations
);

View File

@@ -161,7 +161,7 @@ final class HouseholdApiControllerTest extends WebTestCase
$this->assertArrayHasKey('count', $data);
$this->assertArrayHasKey('results', $data);
$householdIds = array_map(static fn($r) => $r['id'], $data['results']);
$householdIds = array_map(static fn ($r) => $r['id'], $data['results']);
$this->assertContains($expectedHouseholdId, $householdIds);
}

View File

@@ -294,23 +294,23 @@ final class PersonControllerUpdateTest extends WebTestCase
public function validTextFieldsProvider()
{
return [
['firstName', 'random Value', static fn(Person $person) => $person->getFirstName()],
['lastName', 'random Value', static fn(Person $person) => $person->getLastName()],
['firstName', 'random Value', static fn (Person $person) => $person->getFirstName()],
['lastName', 'random Value', static fn (Person $person) => $person->getLastName()],
// reminder: this value is capitalized
['placeOfBirth', 'A PLACE', static fn(Person $person) => $person->getPlaceOfBirth()],
['birthdate', '1980-12-15', static fn(Person $person) => $person->getBirthdate()->format('Y-m-d')],
['placeOfBirth', 'A PLACE', static fn (Person $person) => $person->getPlaceOfBirth()],
['birthdate', '1980-12-15', static fn (Person $person) => $person->getBirthdate()->format('Y-m-d')],
// TODO test on phonenumber update
// ['phonenumber', '+32123456789', static function (Person $person) { return $person->getPhonenumber(); }],
['memo', 'jfkdlmq jkfldmsq jkmfdsq', static fn(Person $person) => $person->getMemo()],
['countryOfBirth', 'BE', static fn(Person $person) => $person->getCountryOfBirth()->getCountryCode()],
['nationality', 'FR', static fn(Person $person) => $person->getNationality()->getCountryCode()],
['placeOfBirth', '', static fn(Person $person) => $person->getPlaceOfBirth()],
['birthdate', '', static fn(Person $person) => $person->getBirthdate()],
['memo', 'jfkdlmq jkfldmsq jkmfdsq', static fn (Person $person) => $person->getMemo()],
['countryOfBirth', 'BE', static fn (Person $person) => $person->getCountryOfBirth()->getCountryCode()],
['nationality', 'FR', static fn (Person $person) => $person->getNationality()->getCountryCode()],
['placeOfBirth', '', static fn (Person $person) => $person->getPlaceOfBirth()],
['birthdate', '', static fn (Person $person) => $person->getBirthdate()],
//['phonenumber', '', static function (Person $person) { return $person->getPhonenumber(); }],
['memo', '', static fn(Person $person) => $person->getMemo()],
['countryOfBirth', null, static fn(Person $person) => $person->getCountryOfBirth()],
['nationality', null, static fn(Person $person) => $person->getNationality()],
['gender', Person::FEMALE_GENDER, static fn(Person $person) => $person->getGender()],
['memo', '', static fn (Person $person) => $person->getMemo()],
['countryOfBirth', null, static fn (Person $person) => $person->getCountryOfBirth()],
['nationality', null, static fn (Person $person) => $person->getNationality()],
['gender', Person::FEMALE_GENDER, static fn (Person $person) => $person->getGender()],
];
}

View File

@@ -197,12 +197,12 @@ final class PersonControllerUpdateWithHiddenFieldsTest extends WebTestCase
public function validTextFieldsProvider()
{
return [
['firstName', 'random Value', static fn(Person $person) => $person->getFirstName()],
['lastName', 'random Value', static fn(Person $person) => $person->getLastName()],
['birthdate', '15-12-1980', static fn(Person $person) => $person->getBirthdate()->format('d-m-Y')],
['memo', 'jfkdlmq jkfldmsq jkmfdsq', static fn(Person $person) => $person->getMemo()],
['birthdate', '', static fn(Person $person) => $person->getBirthdate()],
['gender', Person::FEMALE_GENDER, static fn(Person $person) => $person->getGender()],
['firstName', 'random Value', static fn (Person $person) => $person->getFirstName()],
['lastName', 'random Value', static fn (Person $person) => $person->getLastName()],
['birthdate', '15-12-1980', static fn (Person $person) => $person->getBirthdate()->format('d-m-Y')],
['memo', 'jfkdlmq jkfldmsq jkmfdsq', static fn (Person $person) => $person->getMemo()],
['birthdate', '', static fn (Person $person) => $person->getBirthdate()],
['gender', Person::FEMALE_GENDER, static fn (Person $person) => $person->getGender()],
];
}

View File

@@ -152,7 +152,7 @@ final class AccompanyingPeriodTest extends \PHPUnit\Framework\TestCase
$locations = $period->getLocationHistories()->toArray();
usort($locations, static fn(AccompanyingPeriod\AccompanyingPeriodLocationHistory $a, AccompanyingPeriod\AccompanyingPeriodLocationHistory $b) => $a->getStartDate() <=> $b->getStartDate());
usort($locations, static fn (AccompanyingPeriod\AccompanyingPeriodLocationHistory $a, AccompanyingPeriod\AccompanyingPeriodLocationHistory $b) => $a->getStartDate() <=> $b->getStartDate());
$iterator = new ArrayIterator($locations);
$iterator->rewind();

View File

@@ -101,13 +101,13 @@ final class MembersEditorTest extends TestCase
$editor = $factory->createEditor($household2 = new Household());
$editor->addMovement(new DateTimeImmutable('yesterday'), $person, $positionNotSharing);
$sharings = $household->getCurrentMembers()->filter(static fn(HouseholdMember $m) => $m->getShareHousehold());
$notSharing = $household2->getCurrentMembers()->filter(static fn(HouseholdMember $m) => !$m->getShareHousehold());
$sharings = $household->getCurrentMembers()->filter(static fn (HouseholdMember $m) => $m->getShareHousehold());
$notSharing = $household2->getCurrentMembers()->filter(static fn (HouseholdMember $m) => !$m->getShareHousehold());
$this->assertCount(1, $notSharing);
$this->assertCount(1, $sharings);
$getPerson = static fn(HouseholdMember $m) => $m->getPerson();
$getPerson = static fn (HouseholdMember $m) => $m->getPerson();
$this->assertContains($person, $notSharing->map($getPerson));
}
@@ -137,13 +137,13 @@ final class MembersEditorTest extends TestCase
$editor = $factory->createEditor($household);
$editor->addMovement(new DateTimeImmutable('yesterday'), $person, $positionNotSharing);
$sharings = $household->getCurrentMembers()->filter(static fn(HouseholdMember $m) => $m->getShareHousehold());
$notSharing = $household->getCurrentMembers()->filter(static fn(HouseholdMember $m) => !$m->getShareHousehold());
$sharings = $household->getCurrentMembers()->filter(static fn (HouseholdMember $m) => $m->getShareHousehold());
$notSharing = $household->getCurrentMembers()->filter(static fn (HouseholdMember $m) => !$m->getShareHousehold());
$this->assertCount(1, $notSharing);
$this->assertCount(0, $sharings);
$getPerson = static fn(HouseholdMember $m) => $m->getPerson();
$getPerson = static fn (HouseholdMember $m) => $m->getPerson();
$this->assertContains($person, $notSharing->map($getPerson));
}

View File

@@ -318,7 +318,7 @@ final class PersonDocGenNormalizerTest extends KernelTestCase
$normalizerManager = $this->prophesize(NormalizerInterface::class);
$normalizerManager->supportsNormalization(Argument::any(), 'docgen', Argument::any())->willReturn(true);
$normalizerManager->normalize(Argument::type(Person::class), 'docgen', Argument::any())
->will(static fn($args) => $normalizer->normalize($args[0], $args[1], $args[2]));
->will(static fn ($args) => $normalizer->normalize($args[0], $args[1], $args[2]));
$normalizerManager->normalize(Argument::any(), 'docgen', Argument::any())->will(
static function ($args) {
if (is_iterable($args[0])) {

View File

@@ -118,7 +118,7 @@ final class RelationshipDocGenNormalizerTest extends TestCase
{
$translatableStringHelper = $this->prophesize(TranslatableStringHelperInterface::class);
$translatableStringHelper->localize(Argument::type('array'))->will(
static fn($args) => $args[0][array_keys($args[0])[0]]
static fn ($args) => $args[0][array_keys($args[0])[0]]
);
$normalizer = new RelationshipDocGenNormalizer(
@@ -128,7 +128,7 @@ final class RelationshipDocGenNormalizerTest extends TestCase
$normalizerManager = $this->prophesize(NormalizerInterface::class);
$normalizerManager->supportsNormalization(Argument::any(), 'docgen', Argument::any())->willReturn(true);
$normalizerManager->normalize(Argument::type(Relationship::class), 'docgen', Argument::any())
->will(static fn($args) => $normalizer->normalize($args[0], $args[1], $args[2]));
->will(static fn ($args) => $normalizer->normalize($args[0], $args[1], $args[2]));
$normalizerManager->normalize(Argument::any(), 'docgen', Argument::any())->will(
static function ($args) {
if (null === $args[0]) {

View File

@@ -263,7 +263,7 @@ final class PersonContextTest extends TestCase
if (null === $translatableStringHelper) {
$translatableStringHelper = $this->prophesize(TranslatableStringHelperInterface::class);
// return only the 'fr' key
$translatableStringHelper->localize(Argument::type('array'))->will(static fn($args) => $args[0]['fr']);
$translatableStringHelper->localize(Argument::type('array'))->will(static fn ($args) => $args[0]['fr']);
$translatableStringHelper = $translatableStringHelper->reveal();
}

View File

@@ -70,7 +70,7 @@ final class PersonContextWithThirdPartyTest extends KernelTestCase
{
$normalizer = $this->prophesize(NormalizerInterface::class);
$normalizer->normalize(Argument::type(ThirdParty::class), 'docgen', Argument::type('array'))
->will(static fn($args): array => ['class' => '3party', 'hash' => spl_object_hash($args[0])]);
->will(static fn ($args): array => ['class' => '3party', 'hash' => spl_object_hash($args[0])]);
$personContext = $this->prophesize(PersonContextInterface::class);