mirror of
https://gitlab.com/Chill-Projet/chill-bundles.git
synced 2025-08-20 22:53:49 +00:00
DX: fix cs
This commit is contained in:
@@ -514,7 +514,7 @@ class Calendar implements TrackCreationInterface, TrackUpdateInterface, HasCente
|
||||
*/
|
||||
public function getUsers(): ReadableCollection
|
||||
{
|
||||
return $this->getInvites()->map(static fn(Invite $i) => $i->getUser());
|
||||
return $this->getInvites()->map(static fn (Invite $i) => $i->getUser());
|
||||
}
|
||||
|
||||
public function hasCalendarRange(): bool
|
||||
@@ -599,7 +599,7 @@ class Calendar implements TrackCreationInterface, TrackUpdateInterface, HasCente
|
||||
}
|
||||
|
||||
$invite = $this->invites
|
||||
->filter(static fn(Invite $invite) => $invite->getUser() === $user)
|
||||
->filter(static fn (Invite $invite) => $invite->getUser() === $user)
|
||||
->first();
|
||||
$this->removeInvite($invite);
|
||||
|
||||
|
@@ -61,7 +61,7 @@ class CountCalendars implements ExportInterface, GroupedExportInterface
|
||||
$labels = array_combine($values, $values);
|
||||
$labels['_header'] = $this->getTitle();
|
||||
|
||||
return static fn($value) => $labels[$value];
|
||||
return static fn ($value) => $labels[$value];
|
||||
}
|
||||
|
||||
public function getQueryKeys($data): array
|
||||
@@ -89,7 +89,7 @@ class CountCalendars implements ExportInterface, GroupedExportInterface
|
||||
*/
|
||||
public function initiateQuery(array $requiredModifiers, array $acl, array $data = []): QueryBuilder
|
||||
{
|
||||
$centers = array_map(static fn($el) => $el['center'], $acl);
|
||||
$centers = array_map(static fn ($el) => $el['center'], $acl);
|
||||
|
||||
$qb = $this->calendarRepository->createQueryBuilder('cal');
|
||||
|
||||
|
@@ -61,7 +61,7 @@ class StatCalendarAvgDuration implements ExportInterface, GroupedExportInterface
|
||||
$labels = array_combine($values, $values);
|
||||
$labels['_header'] = $this->getTitle();
|
||||
|
||||
return static fn($value) => $labels[$value];
|
||||
return static fn ($value) => $labels[$value];
|
||||
}
|
||||
|
||||
public function getQueryKeys($data): array
|
||||
|
@@ -61,7 +61,7 @@ class StatCalendarSumDuration implements ExportInterface, GroupedExportInterface
|
||||
$labels = array_combine($values, $values);
|
||||
$labels['_header'] = $this->getTitle();
|
||||
|
||||
return static fn($value) => $labels[$value];
|
||||
return static fn ($value) => $labels[$value];
|
||||
}
|
||||
|
||||
public function getQueryKeys($data): array
|
||||
|
@@ -58,7 +58,7 @@ class AgentFilter implements FilterInterface
|
||||
{
|
||||
$builder->add('accepted_agents', EntityType::class, [
|
||||
'class' => User::class,
|
||||
'choice_label' => fn(User $u) => $this->userRender->renderString($u, []),
|
||||
'choice_label' => fn (User $u) => $this->userRender->renderString($u, []),
|
||||
'multiple' => true,
|
||||
'expanded' => true,
|
||||
]);
|
||||
|
@@ -69,7 +69,7 @@ class JobFilter implements FilterInterface
|
||||
{
|
||||
$builder->add('job', EntityType::class, [
|
||||
'class' => UserJob::class,
|
||||
'choice_label' => fn(UserJob $j) => $this->translatableStringHelper->localize(
|
||||
'choice_label' => fn (UserJob $j) => $this->translatableStringHelper->localize(
|
||||
$j->getLabel()
|
||||
),
|
||||
'multiple' => true,
|
||||
|
@@ -69,7 +69,7 @@ class ScopeFilter implements FilterInterface
|
||||
{
|
||||
$builder->add('scope', EntityType::class, [
|
||||
'class' => Scope::class,
|
||||
'choice_label' => fn(Scope $s) => $this->translatableStringHelper->localize(
|
||||
'choice_label' => fn (Scope $s) => $this->translatableStringHelper->localize(
|
||||
$s->getName()
|
||||
),
|
||||
'multiple' => true,
|
||||
|
@@ -89,10 +89,10 @@ class CalendarToRemoteHandler implements MessageHandlerInterface
|
||||
|
||||
$newInvites = array_filter(
|
||||
array_map(
|
||||
fn($id) => $this->inviteRepository->find($id),
|
||||
fn ($id) => $this->inviteRepository->find($id),
|
||||
$calendarMessage->getNewInvitesIds(),
|
||||
),
|
||||
static fn(?Invite $invite) => null !== $invite
|
||||
static fn (?Invite $invite) => null !== $invite
|
||||
);
|
||||
|
||||
$this->calendarConnector->syncCalendar(
|
||||
|
@@ -58,7 +58,7 @@ class CalendarMessage
|
||||
$this->previousMainUserId = null !== $calendar->previousMainUser ?
|
||||
$calendar->previousMainUser->getId() : null;
|
||||
$this->newInvitesIds = array_map(static fn (Invite $i) => $i->getId(), $calendar->newInvites);
|
||||
$this->oldInvites = array_map(static fn(Invite $i) => [
|
||||
$this->oldInvites = array_map(static fn (Invite $i) => [
|
||||
'inviteId' => $i->getId(),
|
||||
'userId' => $i->getUser()->getId(),
|
||||
'userEmail' => $i->getUser()->getEmail(),
|
||||
|
@@ -121,7 +121,7 @@ class RemoteEventConverter
|
||||
'subject' => '[Chill] ' .
|
||||
implode(
|
||||
', ',
|
||||
$calendar->getPersons()->map(fn(Person $p) => $this->personRender->renderString($p, []))->toArray()
|
||||
$calendar->getPersons()->map(fn (Person $p) => $this->personRender->renderString($p, []))->toArray()
|
||||
),
|
||||
'start' => [
|
||||
'dateTime' => $calendar->getStartDate()->setTimezone($this->remoteDateTimeZone)
|
||||
@@ -159,7 +159,7 @@ class RemoteEventConverter
|
||||
{
|
||||
return [
|
||||
'attendees' => $calendar->getInvites()->map(
|
||||
fn(Invite $i) => $this->buildInviteToAttendee($i)
|
||||
fn (Invite $i) => $this->buildInviteToAttendee($i)
|
||||
)->toArray(),
|
||||
];
|
||||
}
|
||||
|
@@ -190,17 +190,17 @@ class MSGraphRemoteCalendarConnector implements RemoteCalendarConnectorInterface
|
||||
]
|
||||
)->toArray();
|
||||
|
||||
$ids = array_map(static fn($item) => $item['id'], $bareEvents['value']);
|
||||
$ids = array_map(static fn ($item) => $item['id'], $bareEvents['value']);
|
||||
$existingIdsInRange = $this->calendarRangeRepository->findRemoteIdsPresent($ids);
|
||||
$existingIdsInCalendar = $this->calendarRepository->findRemoteIdsPresent($ids);
|
||||
|
||||
return array_values(
|
||||
array_map(
|
||||
fn($item) => $this->remoteEventConverter->convertToRemote($item),
|
||||
fn ($item) => $this->remoteEventConverter->convertToRemote($item),
|
||||
// filter all event to keep only the one not in range
|
||||
array_filter(
|
||||
$bareEvents['value'],
|
||||
static fn($item) => ((!$existingIdsInRange[$item['id']]) ?? true) && ((!$existingIdsInCalendar[$item['id']]) ?? true)
|
||||
static fn ($item) => ((!$existingIdsInRange[$item['id']]) ?? true) && ((!$existingIdsInCalendar[$item['id']]) ?? true)
|
||||
)
|
||||
)
|
||||
);
|
||||
@@ -595,7 +595,7 @@ class MSGraphRemoteCalendarConnector implements RemoteCalendarConnectorInterface
|
||||
}
|
||||
|
||||
$this->cacheScheduleTimeForUser[$userId] = array_map(
|
||||
fn($item) => $this->remoteEventConverter->convertAvailabilityToRemoteEvent($item),
|
||||
fn ($item) => $this->remoteEventConverter->convertAvailabilityToRemoteEvent($item),
|
||||
$response['value'][0]['scheduleItems']
|
||||
);
|
||||
|
||||
|
@@ -114,8 +114,8 @@ final class CalendarTypeTest extends TypeTestCase
|
||||
$this->assertEquals(8, $calendar->getCalendarRange()->getId());
|
||||
$this->assertEquals(9, $calendar->getLocation()->getId());
|
||||
$this->assertEquals(true, $calendar->getSendSMS());
|
||||
$this->assertContains(2, $calendar->getUsers()->map(static fn(User $u) => $u->getId()));
|
||||
$this->assertContains(3, $calendar->getUsers()->map(static fn(User $u) => $u->getId()));
|
||||
$this->assertContains(2, $calendar->getUsers()->map(static fn (User $u) => $u->getId()));
|
||||
$this->assertContains(3, $calendar->getUsers()->map(static fn (User $u) => $u->getId()));
|
||||
}
|
||||
|
||||
protected function getExtensions()
|
||||
@@ -144,16 +144,16 @@ final class CalendarTypeTest extends TypeTestCase
|
||||
) {
|
||||
$transformer = $this->prophesize($classTransformer);
|
||||
$transformer->transform(Argument::type('array'))
|
||||
->will(static fn($args) => implode(
|
||||
->will(static fn ($args) => implode(
|
||||
',',
|
||||
array_map(static fn($p) => $p->getId(), $args[0])
|
||||
array_map(static fn ($p) => $p->getId(), $args[0])
|
||||
));
|
||||
$transformer->transform(Argument::exact(null))
|
||||
->willReturn([]);
|
||||
$transformer->transform(Argument::type(Collection::class))
|
||||
->will(static fn($args) => implode(
|
||||
->will(static fn ($args) => implode(
|
||||
',',
|
||||
array_map(static fn($p) => $p->getId(), $args[0]->toArray())
|
||||
array_map(static fn ($p) => $p->getId(), $args[0]->toArray())
|
||||
));
|
||||
$transformer->reverseTransform(Argument::type('string'))
|
||||
->will(static function ($args) use ($objClass) {
|
||||
@@ -183,7 +183,7 @@ final class CalendarTypeTest extends TypeTestCase
|
||||
) {
|
||||
$transformer = $this->prophesize($classTransformer);
|
||||
$transformer->transform(Argument::type('object'))
|
||||
->will(static fn($args) => (string) $args[0]->getId());
|
||||
->will(static fn ($args) => (string) $args[0]->getId());
|
||||
$transformer->transform(Argument::exact(null))
|
||||
->willReturn('');
|
||||
$transformer->reverseTransform(Argument::type('string'))
|
||||
|
@@ -63,7 +63,7 @@ final class AddressConverterTest extends TestCase
|
||||
{
|
||||
$engine = $this->prophesize(EngineInterface::class);
|
||||
$translatableStringHelper = $this->prophesize(TranslatableStringHelperInterface::class);
|
||||
$translatableStringHelper->localize(Argument::type('array'))->will(static fn($args): string => ($args[0] ?? ['fr' => 'not provided'])['fr'] ?? 'not provided');
|
||||
$translatableStringHelper->localize(Argument::type('array'))->will(static fn ($args): string => ($args[0] ?? ['fr' => 'not provided'])['fr'] ?? 'not provided');
|
||||
|
||||
$addressRender = new AddressRender($engine->reveal(), $translatableStringHelper->reveal());
|
||||
|
||||
|
@@ -72,13 +72,13 @@ final class CalendarForShortMessageProviderTest extends TestCase
|
||||
Argument::type(DateTimeImmutable::class),
|
||||
Argument::type('int'),
|
||||
Argument::exact(0)
|
||||
)->will(static fn($args) => array_fill(0, $args[2], new Calendar()))->shouldBeCalledTimes(1);
|
||||
)->will(static fn ($args) => array_fill(0, $args[2], new Calendar()))->shouldBeCalledTimes(1);
|
||||
$calendarRepository->findByNotificationAvailable(
|
||||
Argument::type(DateTimeImmutable::class),
|
||||
Argument::type(DateTimeImmutable::class),
|
||||
Argument::type('int'),
|
||||
Argument::not(0)
|
||||
)->will(static fn($args) => array_fill(0, $args[2] - 1, new Calendar()))->shouldBeCalledTimes(1);
|
||||
)->will(static fn ($args) => array_fill(0, $args[2] - 1, new Calendar()))->shouldBeCalledTimes(1);
|
||||
|
||||
$em = $this->prophesize(EntityManagerInterface::class);
|
||||
$em->clear()->shouldBeCalled();
|
||||
@@ -104,13 +104,13 @@ final class CalendarForShortMessageProviderTest extends TestCase
|
||||
Argument::type(DateTimeImmutable::class),
|
||||
Argument::type('int'),
|
||||
Argument::exact(0)
|
||||
)->will(static fn($args) => array_fill(0, 1, new Calendar()))->shouldBeCalledTimes(1);
|
||||
)->will(static fn ($args) => array_fill(0, 1, new Calendar()))->shouldBeCalledTimes(1);
|
||||
$calendarRepository->findByNotificationAvailable(
|
||||
Argument::type(DateTimeImmutable::class),
|
||||
Argument::type(DateTimeImmutable::class),
|
||||
Argument::type('int'),
|
||||
Argument::not(0)
|
||||
)->will(static fn($args) => [])->shouldBeCalledTimes(1);
|
||||
)->will(static fn ($args) => [])->shouldBeCalledTimes(1);
|
||||
|
||||
$em = $this->prophesize(EntityManagerInterface::class);
|
||||
$em->clear()->shouldBeCalled();
|
||||
|
Reference in New Issue
Block a user