DX: fix cs

This commit is contained in:
2023-02-06 17:47:54 +01:00
parent 4b2c330d22
commit 70871176fc
29 changed files with 100 additions and 74 deletions

View File

@@ -512,7 +512,9 @@ class Calendar implements TrackCreationInterface, TrackUpdateInterface, HasCente
*/
public function getUsers(): Collection
{
return $this->getInvites()->map(static function (Invite $i) { return $i->getUser(); });
return $this->getInvites()->map(static function (Invite $i) {
return $i->getUser();
});
}
public function hasCalendarRange(): bool
@@ -597,7 +599,9 @@ class Calendar implements TrackCreationInterface, TrackUpdateInterface, HasCente
}
$invite = $this->invites
->filter(static function (Invite $invite) use ($user) { return $invite->getUser() === $user; })
->filter(static function (Invite $invite) use ($user) {
return $invite->getUser() === $user;
})
->first();
$this->removeInvite($invite);

View File

@@ -89,10 +89,14 @@ class CalendarToRemoteHandler implements MessageHandlerInterface
$newInvites = array_filter(
array_map(
function ($id) { return $this->inviteRepository->find($id); },
function ($id) {
return $this->inviteRepository->find($id);
},
$calendarMessage->getNewInvitesIds(),
),
static function (?Invite $invite) { return null !== $invite; }
static function (?Invite $invite) {
return null !== $invite;
}
);
$this->calendarConnector->syncCalendar(

View File

@@ -167,7 +167,9 @@ class MSGraphRemoteCalendarConnector implements RemoteCalendarConnectorInterface
]
)->toArray();
$ids = array_map(static function ($item) { return $item['id']; }, $bareEvents['value']);
$ids = array_map(static function ($item) {
return $item['id'];
}, $bareEvents['value']);
$existingIdsInRange = $this->calendarRangeRepository->findRemoteIdsPresent($ids);
$existingIdsInCalendar = $this->calendarRepository->findRemoteIdsPresent($ids);

View File

@@ -215,7 +215,7 @@ class CalendarACLAwareRepository implements CalendarACLAwareRepositoryInterface
$qb
->where(
$qb->expr()->orX(
// the calendar where the person is the main person:
// the calendar where the person is the main person:
$qb->expr()->eq('c.person', ':person'),
// when the calendar is in a reachable period, and contains person
$qb->expr()->andX(

View File

@@ -96,7 +96,7 @@ final class CalendarTypeTest extends TypeTestCase
];
$calendar = new Calendar();
$calendar->setMainUser(new class() extends User {
$calendar->setMainUser(new class () extends User {
public function getId()
{
return '1';
@@ -114,8 +114,12 @@ 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 function (User $u) { return $u->getId(); }));
$this->assertContains(3, $calendar->getUsers()->map(static function (User $u) { return $u->getId(); }));
$this->assertContains(2, $calendar->getUsers()->map(static function (User $u) {
return $u->getId();
}));
$this->assertContains(3, $calendar->getUsers()->map(static function (User $u) {
return $u->getId();
}));
}
protected function getExtensions()
@@ -147,7 +151,9 @@ final class CalendarTypeTest extends TypeTestCase
->will(static function ($args) {
return implode(
',',
array_map(static function ($p) { return $p->getId(); }, $args[0])
array_map(static function ($p) {
return $p->getId();
}, $args[0])
);
});
$transformer->transform(Argument::exact(null))
@@ -156,7 +162,9 @@ final class CalendarTypeTest extends TypeTestCase
->will(static function ($args) {
return implode(
',',
array_map(static function ($p) { return $p->getId(); }, $args[0]->toArray())
array_map(static function ($p) {
return $p->getId();
}, $args[0]->toArray())
);
});
$transformer->reverseTransform(Argument::type('string'))