Update minor things.

This commit is contained in:
Pol Dellaiera 2022-01-25 11:56:30 +01:00
parent 2e6d281bfc
commit 7ee554b48d
No known key found for this signature in database
GPG Key ID: D476DFE9C67467CA

View File

@ -45,7 +45,6 @@ use Symfony\Component\Validator\Context\ExecutionContextInterface;
use Symfony\Component\Validator\GroupSequenceProviderInterface;
use UnexpectedValueException;
use function count;
use function in_array;
use const SORT_REGULAR;
@ -545,17 +544,17 @@ class AccompanyingPeriod implements
public function getAvailablePersonLocation(): Collection
{
return $this->getOpenParticipations()
->filter(static function (AccompanyingPeriodParticipation $p) {
return $p->getPerson()->hasCurrentHouseholdAddress();
})
->map(static function (AccompanyingPeriodParticipation $p) {
return $p->getPerson();
});
->filter(
static fn (AccompanyingPeriodParticipation $p): bool => $p->getPerson()->hasCurrentHouseholdAddress()
)
->map(
static fn (AccompanyingPeriodParticipation $p): ?Person => $p->getPerson()
);
}
public function getCenter(): ?Center
{
if (count($this->getPersons()) === 0) {
if ($this->getPersons()->count() === 0) {
return null;
}
@ -596,9 +595,11 @@ class AccompanyingPeriod implements
*/
public function getComments(): Collection
{
return $this->comments->filter(function (Comment $c) {
return $c !== $this->pinnedComment;
});
return $this
->comments
->filter(
static fn (Comment $c): bool => $c !== $this->pinnedComment
);
}
public function getCreatedAt(): ?DateTime
@ -739,9 +740,7 @@ class AccompanyingPeriod implements
return $this
->getParticipations()
->filter(
static function (AccompanyingPeriodParticipation $participation) use ($person): bool {
return $participation->getPerson() === $person;
}
static fn (AccompanyingPeriodParticipation $participation): bool => $participation->getPerson() === $person
);
}
@ -763,9 +762,7 @@ class AccompanyingPeriod implements
return $this
->participations
->map(
static function (AccompanyingPeriodParticipation $participation): Person {
return $participation->getPerson();
}
static fn (AccompanyingPeriodParticipation $participation): ?Person => $participation->getPerson()
);
}