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