From a6e0b16032e2399456b975cec5f05eceb2218ef0 Mon Sep 17 00:00:00 2001 From: Pol Dellaiera Date: Fri, 14 May 2021 10:27:07 +0200 Subject: [PATCH] Fix `::getOpenParticipationContainsPerson` 1. The filter predicate must return a boolean 2. The $person variable is not needed --- .../ChillPersonBundle/Entity/AccompanyingPeriod.php | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/src/Bundle/ChillPersonBundle/Entity/AccompanyingPeriod.php b/src/Bundle/ChillPersonBundle/Entity/AccompanyingPeriod.php index 1d5f00c1f..f2161c78a 100644 --- a/src/Bundle/ChillPersonBundle/Entity/AccompanyingPeriod.php +++ b/src/Bundle/ChillPersonBundle/Entity/AccompanyingPeriod.php @@ -364,12 +364,13 @@ class AccompanyingPeriod */ public function getOpenParticipationContainsPerson(Person $person): ?AccompanyingPeriodParticipation { - $collection = $this->getParticipationsContainsPerson($person)->filter( - function(AccompanyingPeriodParticipation $participation) use ($person) { - if (NULL === $participation->getEndDate()) { - return $participation; + $collection = $this + ->getParticipationsContainsPerson($person) + ->filter( + static function(AccompanyingPeriodParticipation $participation): bool { + return null === $participation->getEndDate(); } - }); + ); return $collection->count() > 0 ? $collection->first() : NULL; }