mirror of
				https://gitlab.com/Chill-Projet/chill-bundles.git
				synced 2025-11-04 03:08:25 +00:00 
			
		
		
		
	DX: fix phpstan issues
This commit is contained in:
		@@ -3,7 +3,7 @@ parameters:
 | 
			
		||||
    paths:
 | 
			
		||||
        - src/
 | 
			
		||||
    tmpDir: .cache/
 | 
			
		||||
    reportUnmatchedIgnoredErrors: true
 | 
			
		||||
    reportUnmatchedIgnoredErrors: false
 | 
			
		||||
    excludePaths:
 | 
			
		||||
        - .php_cs*
 | 
			
		||||
        - docs/
 | 
			
		||||
 
 | 
			
		||||
@@ -20,13 +20,6 @@ use Symfony\Component\Form\FormBuilderInterface;
 | 
			
		||||
 | 
			
		||||
class LocationFilter implements FilterInterface
 | 
			
		||||
{
 | 
			
		||||
    private TranslatableStringHelper $translatableStringHelper;
 | 
			
		||||
 | 
			
		||||
    public function __construct(TranslatableStringHelper $translatableStringHelper)
 | 
			
		||||
    {
 | 
			
		||||
        $this->translatableStringHelper = $translatableStringHelper;
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    public function addRole(): ?string
 | 
			
		||||
    {
 | 
			
		||||
        return null;
 | 
			
		||||
 
 | 
			
		||||
@@ -160,8 +160,8 @@ final class ListAsideActivity implements ListInterface, GroupedExportInterface
 | 
			
		||||
                        return 'export.aside_activity.main_center';
 | 
			
		||||
                    }
 | 
			
		||||
 | 
			
		||||
                    /** @var Center $c */
 | 
			
		||||
                    if (null === $value || '' === $value || null === $c = $this->centerRepository->find($value)) {
 | 
			
		||||
                        /** @var Center $c */
 | 
			
		||||
                        return '';
 | 
			
		||||
                    }
 | 
			
		||||
 | 
			
		||||
@@ -190,10 +190,6 @@ final class ListAsideActivity implements ListInterface, GroupedExportInterface
 | 
			
		||||
        ];
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    /**
 | 
			
		||||
     * @param QueryBuilder $query
 | 
			
		||||
     * @param array $data
 | 
			
		||||
     */
 | 
			
		||||
    public function getResult($query, $data): array
 | 
			
		||||
    {
 | 
			
		||||
        return $query->getQuery()->getResult(AbstractQuery::HYDRATE_ARRAY);
 | 
			
		||||
 
 | 
			
		||||
@@ -33,27 +33,15 @@ class ElementController extends AbstractController
 | 
			
		||||
{
 | 
			
		||||
    private CalculatorManager $calculator;
 | 
			
		||||
 | 
			
		||||
    private LoggerInterface $chillMainLogger;
 | 
			
		||||
 | 
			
		||||
    private EntityManagerInterface $em;
 | 
			
		||||
 | 
			
		||||
    private ResourceRepository $resourceRepository;
 | 
			
		||||
 | 
			
		||||
    private ChargeRepository $chargeRepository;
 | 
			
		||||
 | 
			
		||||
    private TranslatorInterface $translator;
 | 
			
		||||
 | 
			
		||||
    public function __construct(
 | 
			
		||||
        EntityManagerInterface $em,
 | 
			
		||||
        TranslatorInterface $translator,
 | 
			
		||||
        LoggerInterface $chillMainLogger,
 | 
			
		||||
        CalculatorManager $calculator,
 | 
			
		||||
        ResourceRepository $resourceRepository,
 | 
			
		||||
        ChargeRepository $chargeRepository,
 | 
			
		||||
    ) {
 | 
			
		||||
        $this->em = $em;
 | 
			
		||||
        $this->translator = $translator;
 | 
			
		||||
        $this->chillMainLogger = $chillMainLogger;
 | 
			
		||||
        $this->calculator = $calculator;
 | 
			
		||||
        $this->resourceRepository = $resourceRepository;
 | 
			
		||||
        $this->chargeRepository = $chargeRepository;
 | 
			
		||||
 
 | 
			
		||||
@@ -30,7 +30,7 @@ final class ChargeKindRepository implements ChargeKindRepositoryInterface
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    /**
 | 
			
		||||
     * @return ChargeType[]
 | 
			
		||||
     * @return array<ChargeKind>
 | 
			
		||||
     */
 | 
			
		||||
    public function findAll(): array
 | 
			
		||||
    {
 | 
			
		||||
@@ -38,7 +38,7 @@ final class ChargeKindRepository implements ChargeKindRepositoryInterface
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    /**
 | 
			
		||||
     * @return ChargeType[]
 | 
			
		||||
     * @return array<ChargeKind>
 | 
			
		||||
     */
 | 
			
		||||
    public function findAllActive(): array
 | 
			
		||||
    {
 | 
			
		||||
@@ -53,7 +53,7 @@ final class ChargeKindRepository implements ChargeKindRepositoryInterface
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    /**
 | 
			
		||||
     * @return ChargeType[]
 | 
			
		||||
     * @return array<ChargeKind>
 | 
			
		||||
     */
 | 
			
		||||
    public function findAllByType(string $type): array
 | 
			
		||||
    {
 | 
			
		||||
@@ -64,7 +64,7 @@ final class ChargeKindRepository implements ChargeKindRepositoryInterface
 | 
			
		||||
     * @param mixed|null $limit
 | 
			
		||||
     * @param mixed|null $offset
 | 
			
		||||
     *
 | 
			
		||||
     * @return ChargeType[]
 | 
			
		||||
     * @return array<ChargeKind>
 | 
			
		||||
     */
 | 
			
		||||
    public function findBy(array $criteria, ?array $orderBy = null, ?int $limit = null, ?int $offset = null): array
 | 
			
		||||
    {
 | 
			
		||||
 
 | 
			
		||||
@@ -19,25 +19,25 @@ interface ChargeKindRepositoryInterface extends ObjectRepository
 | 
			
		||||
    public function find($id): ?ChargeKind;
 | 
			
		||||
 | 
			
		||||
    /**
 | 
			
		||||
     * @return ChargeType[]
 | 
			
		||||
     * @return array<ChargeKind>
 | 
			
		||||
     */
 | 
			
		||||
    public function findAll(): array;
 | 
			
		||||
 | 
			
		||||
    /**
 | 
			
		||||
     * @return ChargeType[]
 | 
			
		||||
     * @return array<ChargeKind>
 | 
			
		||||
     */
 | 
			
		||||
    public function findAllActive(): array;
 | 
			
		||||
 | 
			
		||||
    /**
 | 
			
		||||
     * @return ChargeType[]
 | 
			
		||||
     * @return array<ChargeKind>
 | 
			
		||||
     */
 | 
			
		||||
    public function findAllByType(string $type): array;
 | 
			
		||||
 | 
			
		||||
    /**
 | 
			
		||||
     * @param mixed|null $limit
 | 
			
		||||
     * @param mixed|null $offset
 | 
			
		||||
     * @param int|null $limit
 | 
			
		||||
     * @param int|null $offset
 | 
			
		||||
     *
 | 
			
		||||
     * @return ChargeType[]
 | 
			
		||||
     * @return array<ChargeKind>
 | 
			
		||||
     */
 | 
			
		||||
    public function findBy(array $criteria, ?array $orderBy = null, ?int $limit = null, ?int $offset = null): array;
 | 
			
		||||
 | 
			
		||||
 
 | 
			
		||||
@@ -30,7 +30,7 @@ final class ResourceKindRepository implements ResourceKindRepositoryInterface
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    /**
 | 
			
		||||
     * @return ResourceType[]
 | 
			
		||||
     * @return list<ResourceKind>
 | 
			
		||||
     */
 | 
			
		||||
    public function findAll(): array
 | 
			
		||||
    {
 | 
			
		||||
@@ -38,7 +38,7 @@ final class ResourceKindRepository implements ResourceKindRepositoryInterface
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    /**
 | 
			
		||||
     * @return ResourceType[]
 | 
			
		||||
     * @return list<ResourceKind>
 | 
			
		||||
     */
 | 
			
		||||
    public function findAllActive(): array
 | 
			
		||||
    {
 | 
			
		||||
@@ -58,7 +58,7 @@ final class ResourceKindRepository implements ResourceKindRepositoryInterface
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    /**
 | 
			
		||||
     * @return ResourceType[]
 | 
			
		||||
     * @return list<ResourceKind>
 | 
			
		||||
     */
 | 
			
		||||
    public function findAllByType(string $type): array
 | 
			
		||||
    {
 | 
			
		||||
@@ -69,7 +69,7 @@ final class ResourceKindRepository implements ResourceKindRepositoryInterface
 | 
			
		||||
     * @param mixed|null $limit
 | 
			
		||||
     * @param mixed|null $offset
 | 
			
		||||
     *
 | 
			
		||||
     * @return ResourceType[]
 | 
			
		||||
     * @return list<ResourceKind>
 | 
			
		||||
     */
 | 
			
		||||
    public function findBy(array $criteria, ?array $orderBy = null, ?int $limit = null, ?int $offset = null): array
 | 
			
		||||
    {
 | 
			
		||||
 
 | 
			
		||||
@@ -19,25 +19,25 @@ interface ResourceKindRepositoryInterface extends ObjectRepository
 | 
			
		||||
    public function find($id): ?ResourceKind;
 | 
			
		||||
 | 
			
		||||
    /**
 | 
			
		||||
     * @return ResourceType[]
 | 
			
		||||
     * @return list<ResourceKind>
 | 
			
		||||
     */
 | 
			
		||||
    public function findAll(): array;
 | 
			
		||||
 | 
			
		||||
    /**
 | 
			
		||||
     * @return ResourceType[]
 | 
			
		||||
     * @return list<ResourceKind>
 | 
			
		||||
     */
 | 
			
		||||
    public function findAllActive(): array;
 | 
			
		||||
 | 
			
		||||
    /**
 | 
			
		||||
     * @return ResourceType[]
 | 
			
		||||
     * @return list<ResourceKind>
 | 
			
		||||
     */
 | 
			
		||||
    public function findAllByType(string $type): array;
 | 
			
		||||
 | 
			
		||||
    /**
 | 
			
		||||
     * @param mixed|null $limit
 | 
			
		||||
     * @param mixed|null $offset
 | 
			
		||||
     * @param int|null $limit
 | 
			
		||||
     * @param int|null $offset
 | 
			
		||||
     *
 | 
			
		||||
     * @return ResourceType[]
 | 
			
		||||
     * @return list<ResourceKind>
 | 
			
		||||
     */
 | 
			
		||||
    public function findBy(array $criteria, ?array $orderBy = null, ?int $limit = null, ?int $offset = null): array;
 | 
			
		||||
 | 
			
		||||
 
 | 
			
		||||
@@ -544,21 +544,6 @@ class CalendarController extends AbstractController
 | 
			
		||||
        return $filterOrder->build();
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    private function buildParamsToUrl(?User $user, ?AccompanyingPeriod $accompanyingPeriod): array
 | 
			
		||||
    {
 | 
			
		||||
        $params = [];
 | 
			
		||||
 | 
			
		||||
        if (null !== $user) {
 | 
			
		||||
            $params['user_id'] = $user->getId();
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
        if (null !== $accompanyingPeriod) {
 | 
			
		||||
            $params['id'] = $accompanyingPeriod->getId();
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
        return $params;
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    /**
 | 
			
		||||
     * Creates a form to delete a Calendar entity by id.
 | 
			
		||||
     */
 | 
			
		||||
 
 | 
			
		||||
@@ -29,6 +29,7 @@ use DateTimeImmutable;
 | 
			
		||||
use Doctrine\Common\Collections\ArrayCollection;
 | 
			
		||||
use Doctrine\Common\Collections\Collection;
 | 
			
		||||
use Doctrine\Common\Collections\Criteria;
 | 
			
		||||
use Doctrine\Common\Collections\ReadableCollection;
 | 
			
		||||
use Doctrine\ORM\Mapping as ORM;
 | 
			
		||||
use LogicException;
 | 
			
		||||
use Symfony\Component\Serializer\Annotation as Serializer;
 | 
			
		||||
@@ -507,10 +508,10 @@ class Calendar implements TrackCreationInterface, TrackUpdateInterface, HasCente
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    /**
 | 
			
		||||
     * @return Collection|User[]
 | 
			
		||||
     * @return ReadableCollection<(int|string), User>
 | 
			
		||||
     * @Serializer\Groups({"calendar:read", "read"})
 | 
			
		||||
     */
 | 
			
		||||
    public function getUsers(): Collection
 | 
			
		||||
    public function getUsers(): ReadableCollection
 | 
			
		||||
    {
 | 
			
		||||
        return $this->getInvites()->map(static function (Invite $i) {
 | 
			
		||||
            return $i->getUser();
 | 
			
		||||
 
 | 
			
		||||
@@ -52,7 +52,7 @@ class CountCalendars implements ExportInterface, GroupedExportInterface
 | 
			
		||||
        return 'Exports of calendar';
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    public function getLabels($key, array $values, $data): Closure
 | 
			
		||||
    public function getLabels($key, array $values, $data)
 | 
			
		||||
    {
 | 
			
		||||
        if ('export_result' !== $key) {
 | 
			
		||||
            throw new LogicException("the key {$key} is not used by this export");
 | 
			
		||||
 
 | 
			
		||||
@@ -31,9 +31,6 @@ class NativeDateIntervalType extends DateIntervalType
 | 
			
		||||
{
 | 
			
		||||
    public const FORMAT = '%rP%YY%MM%DDT%HH%IM%SS';
 | 
			
		||||
 | 
			
		||||
    /**
 | 
			
		||||
     * @param DateInterval|null $value
 | 
			
		||||
     */
 | 
			
		||||
    public function convertToDatabaseValue($value, AbstractPlatform $platform)
 | 
			
		||||
    {
 | 
			
		||||
        if (null === $value) {
 | 
			
		||||
 
 | 
			
		||||
@@ -11,6 +11,7 @@ declare(strict_types=1);
 | 
			
		||||
 | 
			
		||||
namespace Chill\MainBundle\Export;
 | 
			
		||||
 | 
			
		||||
use Doctrine\ORM\NativeQuery;
 | 
			
		||||
use Doctrine\ORM\QueryBuilder;
 | 
			
		||||
 | 
			
		||||
/**
 | 
			
		||||
@@ -23,6 +24,7 @@ use Doctrine\ORM\QueryBuilder;
 | 
			
		||||
 * aggregation, use `ListInterface`.
 | 
			
		||||
 *
 | 
			
		||||
 * @example Chill\PersonBundle\Export\CountPerson an example of implementation
 | 
			
		||||
 * @template Q of QueryBuilder|NativeQuery
 | 
			
		||||
 */
 | 
			
		||||
interface ExportInterface extends ExportElementInterface
 | 
			
		||||
{
 | 
			
		||||
@@ -84,7 +86,7 @@ interface ExportInterface extends ExportElementInterface
 | 
			
		||||
     * @param mixed[] $values The values from the result. if there are duplicates, those might be given twice. Example: array('FR', 'BE', 'CZ', 'FR', 'BE', 'FR')
 | 
			
		||||
     * @param mixed $data The data from the export's form (as defined in `buildForm`)
 | 
			
		||||
     *
 | 
			
		||||
     * @return pure-callable(null|string|int|float|'_header' $value):string|int|\DateTimeInterface where the first argument is the value, and the function should return the label to show in the formatted file. Example : `function($countryCode) use ($countries) { return $countries[$countryCode]->getName(); }`
 | 
			
		||||
     * @return callable(null|string|int|float|'_header' $value): string|int|\DateTimeInterface where the first argument is the value, and the function should return the label to show in the formatted file. Example : `function($countryCode) use ($countries) { return $countries[$countryCode]->getName(); }`
 | 
			
		||||
     */
 | 
			
		||||
    public function getLabels($key, array $values, $data);
 | 
			
		||||
 | 
			
		||||
@@ -102,7 +104,7 @@ interface ExportInterface extends ExportElementInterface
 | 
			
		||||
    /**
 | 
			
		||||
     * Return the results of the query builder.
 | 
			
		||||
     *
 | 
			
		||||
     * @param \Doctrine\ORM\NativeQuery|QueryBuilder $query
 | 
			
		||||
     * @param Q $query
 | 
			
		||||
     * @param mixed[] $data the data from the export's fomr (added by self::buildForm)
 | 
			
		||||
     *
 | 
			
		||||
     * @return mixed[] an array of results
 | 
			
		||||
@@ -132,7 +134,7 @@ interface ExportInterface extends ExportElementInterface
 | 
			
		||||
     * @param array $acl an array where each row has a `center` key containing the Chill\MainBundle\Entity\Center, and `circles` keys containing the reachable circles. Example: `array( array('center' => $centerA, 'circles' => array($circleA, $circleB) ) )`
 | 
			
		||||
     * @param array $data the data from the form, if any
 | 
			
		||||
     *
 | 
			
		||||
     * @return \Doctrine\ORM\NativeQuery|QueryBuilder the query to execute.
 | 
			
		||||
     * @return Q the query to execute.
 | 
			
		||||
     */
 | 
			
		||||
    public function initiateQuery(array $requiredModifiers, array $acl, array $data = []);
 | 
			
		||||
 | 
			
		||||
 
 | 
			
		||||
@@ -24,15 +24,7 @@ class ExportPickCenterDataMapper implements DataMapperInterface
 | 
			
		||||
{
 | 
			
		||||
    protected RegroupmentRepository $regroupmentRepository;
 | 
			
		||||
 | 
			
		||||
    /**
 | 
			
		||||
     * @param array|Center[] $data
 | 
			
		||||
     * @param $forms
 | 
			
		||||
     *
 | 
			
		||||
     * @throws Exception
 | 
			
		||||
     *
 | 
			
		||||
     * @return void
 | 
			
		||||
     */
 | 
			
		||||
    public function mapDataToForms($data, $forms)
 | 
			
		||||
    public function mapDataToForms($data, $forms): void
 | 
			
		||||
    {
 | 
			
		||||
        if (null === $data) {
 | 
			
		||||
            return;
 | 
			
		||||
@@ -44,7 +36,9 @@ class ExportPickCenterDataMapper implements DataMapperInterface
 | 
			
		||||
        $pickedRegroupment = [];
 | 
			
		||||
 | 
			
		||||
        foreach ($this->regroupmentRepository->findAll() as $regroupment) {
 | 
			
		||||
            [$contained, $notContained] = $regroupment->getCenters()->partition(static function (Center $center) {
 | 
			
		||||
            /** @phpstan-ignore-next-line  */
 | 
			
		||||
            [$contained, $notContained] = $regroupment->getCenters()->partition(static function (Center $center): bool {
 | 
			
		||||
                return false;
 | 
			
		||||
            });
 | 
			
		||||
 | 
			
		||||
            if (0 === count($notContained)) {
 | 
			
		||||
@@ -56,13 +50,7 @@ class ExportPickCenterDataMapper implements DataMapperInterface
 | 
			
		||||
        $form['centers']->setData($data);
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    /**
 | 
			
		||||
     * @param iterable $forms
 | 
			
		||||
     * @param array $data
 | 
			
		||||
     *
 | 
			
		||||
     * @return void
 | 
			
		||||
     */
 | 
			
		||||
    public function mapFormsToData($forms, &$data)
 | 
			
		||||
    public function mapFormsToData($forms, &$data): void
 | 
			
		||||
    {
 | 
			
		||||
        /** @var array<string, FormInterface> $forms */
 | 
			
		||||
        $forms = iterator_to_array($forms);
 | 
			
		||||
@@ -74,8 +62,8 @@ class ExportPickCenterDataMapper implements DataMapperInterface
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
        if (array_key_exists('regroupment', $forms)) {
 | 
			
		||||
            /** @var Regroupment $regroupment */
 | 
			
		||||
            foreach ($forms['regroupment']->getData() as $regroupment) {
 | 
			
		||||
                /** @var Regroupment $regroupment */
 | 
			
		||||
                foreach ($regroupment->getCenters() as $center) {
 | 
			
		||||
                    $centers[spl_object_hash($center)] = $center;
 | 
			
		||||
                }
 | 
			
		||||
 
 | 
			
		||||
@@ -11,6 +11,7 @@ declare(strict_types=1);
 | 
			
		||||
 | 
			
		||||
namespace Chill\MainBundle\Workflow;
 | 
			
		||||
 | 
			
		||||
use Chill\MainBundle\Entity\User;
 | 
			
		||||
use Chill\MainBundle\Entity\Workflow\EntityWorkflow;
 | 
			
		||||
 | 
			
		||||
interface EntityWorkflowHandlerInterface
 | 
			
		||||
 
 | 
			
		||||
										
											
												File diff suppressed because it is too large
												Load Diff
											
										
									
								
							@@ -82,7 +82,7 @@ class HouseholdController extends AbstractController
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
        usort($accompanyingPeriods, static function ($a, $b) {
 | 
			
		||||
            return $b->getOpeningDate() > $a->getOpeningDate();
 | 
			
		||||
            return $b->getOpeningDate() <=> $a->getOpeningDate();
 | 
			
		||||
        });
 | 
			
		||||
 | 
			
		||||
        $oldMembers = $household->getNonCurrentMembers();
 | 
			
		||||
 
 | 
			
		||||
@@ -42,6 +42,7 @@ use DateTimeInterface;
 | 
			
		||||
use Doctrine\Common\Collections\ArrayCollection;
 | 
			
		||||
use Doctrine\Common\Collections\Collection;
 | 
			
		||||
use Doctrine\Common\Collections\Criteria;
 | 
			
		||||
use Doctrine\Common\Collections\ReadableCollection;
 | 
			
		||||
use Doctrine\ORM\Mapping as ORM;
 | 
			
		||||
use Iterator;
 | 
			
		||||
use LogicException;
 | 
			
		||||
@@ -615,9 +616,9 @@ class AccompanyingPeriod implements
 | 
			
		||||
    /**
 | 
			
		||||
     * Get a list of person which have an adresse available for a valid location.
 | 
			
		||||
     *
 | 
			
		||||
     * @return Collection|Person[]
 | 
			
		||||
     * @return ReadableCollection<(int|string), Person>
 | 
			
		||||
     */
 | 
			
		||||
    public function getAvailablePersonLocation(): Collection
 | 
			
		||||
    public function getAvailablePersonLocation(): ReadableCollection
 | 
			
		||||
    {
 | 
			
		||||
        return $this->getOpenParticipations()
 | 
			
		||||
            ->filter(
 | 
			
		||||
@@ -675,8 +676,9 @@ class AccompanyingPeriod implements
 | 
			
		||||
 | 
			
		||||
    /**
 | 
			
		||||
     * @Groups({"read"})
 | 
			
		||||
     * @return ReadableCollection<(int|string), Comment>
 | 
			
		||||
     */
 | 
			
		||||
    public function getComments(): Collection
 | 
			
		||||
    public function getComments(): ReadableCollection
 | 
			
		||||
    {
 | 
			
		||||
        $pinnedComment = $this->pinnedComment;
 | 
			
		||||
 | 
			
		||||
@@ -700,7 +702,7 @@ class AccompanyingPeriod implements
 | 
			
		||||
    /**
 | 
			
		||||
     * @Groups({"docgen:read"})
 | 
			
		||||
     */
 | 
			
		||||
    public function getCurrentParticipations(): Collection
 | 
			
		||||
    public function getCurrentParticipations(): ReadableCollection
 | 
			
		||||
    {
 | 
			
		||||
        return $this->getOpenParticipations();
 | 
			
		||||
    }
 | 
			
		||||
@@ -834,7 +836,10 @@ class AccompanyingPeriod implements
 | 
			
		||||
        return $collection->count() > 0 ? $collection->first() : null;
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    public function getOpenParticipations(): Collection
 | 
			
		||||
    /**
 | 
			
		||||
     * @return ReadableCollection<(int|string), AccompanyingPeriodParticipation>
 | 
			
		||||
     */
 | 
			
		||||
    public function getOpenParticipations(): ReadableCollection
 | 
			
		||||
    {
 | 
			
		||||
        return $this
 | 
			
		||||
            ->getParticipations()
 | 
			
		||||
@@ -860,8 +865,9 @@ class AccompanyingPeriod implements
 | 
			
		||||
 | 
			
		||||
    /**
 | 
			
		||||
     * Get the participation containing a person.
 | 
			
		||||
     * @return ReadableCollection<(int|string), AccompanyingPeriodParticipation>
 | 
			
		||||
     */
 | 
			
		||||
    public function getParticipationsContainsPerson(Person $person): Collection
 | 
			
		||||
    public function getParticipationsContainsPerson(Person $person): ReadableCollection
 | 
			
		||||
    {
 | 
			
		||||
        return $this
 | 
			
		||||
            ->getParticipations()
 | 
			
		||||
 
 | 
			
		||||
@@ -22,6 +22,7 @@ use DateTimeInterface;
 | 
			
		||||
use Doctrine\Common\Collections\ArrayCollection;
 | 
			
		||||
use Doctrine\Common\Collections\Collection;
 | 
			
		||||
use Doctrine\Common\Collections\Criteria;
 | 
			
		||||
use Doctrine\Common\Collections\ReadableCollection;
 | 
			
		||||
use Doctrine\ORM\Mapping as ORM;
 | 
			
		||||
use Symfony\Component\Serializer\Annotation as Serializer;
 | 
			
		||||
use Symfony\Component\Validator\Constraints as Assert;
 | 
			
		||||
@@ -265,7 +266,7 @@ class Household
 | 
			
		||||
     * @Serializer\Groups({"read"})
 | 
			
		||||
     * @Serializer\SerializedName("current_members_id")
 | 
			
		||||
     */
 | 
			
		||||
    public function getCurrentMembersIds(?DateTimeImmutable $now = null): Collection
 | 
			
		||||
    public function getCurrentMembersIds(?DateTimeImmutable $now = null): ReadableCollection
 | 
			
		||||
    {
 | 
			
		||||
        return $this->getCurrentMembers($now)->map(
 | 
			
		||||
            static fn (HouseholdMember $m) => $m->getId()
 | 
			
		||||
@@ -332,9 +333,9 @@ class Household
 | 
			
		||||
     *
 | 
			
		||||
     * Return a list of Person, instead of a list of HouseholdMembers
 | 
			
		||||
     *
 | 
			
		||||
     * @return Person[]
 | 
			
		||||
     * @return ReadableCollection<(int|string), Person>
 | 
			
		||||
     */
 | 
			
		||||
    public function getCurrentPersons(?DateTimeImmutable $now = null): Collection
 | 
			
		||||
    public function getCurrentPersons(?DateTimeImmutable $now = null): ReadableCollection
 | 
			
		||||
    {
 | 
			
		||||
        return $this->getCurrentMembers($now)
 | 
			
		||||
            ->map(static function (HouseholdMember $m) {
 | 
			
		||||
@@ -358,9 +359,9 @@ class Household
 | 
			
		||||
    /**
 | 
			
		||||
     * get all the members during a given membership.
 | 
			
		||||
     *
 | 
			
		||||
     * @return Collection|HouseholdMember[]
 | 
			
		||||
     * @return ReadableCollection<(int|string), HouseholdMember>
 | 
			
		||||
     */
 | 
			
		||||
    public function getMembersDuringMembership(HouseholdMember $membership): Collection
 | 
			
		||||
    public function getMembersDuringMembership(HouseholdMember $membership): ReadableCollection
 | 
			
		||||
    {
 | 
			
		||||
        return $this->getMembersOnRange(
 | 
			
		||||
            $membership->getStartDate(),
 | 
			
		||||
@@ -384,7 +385,7 @@ class Household
 | 
			
		||||
        return $this->getMembers()->matching($criteria);
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    public function getMembersOnRange(DateTimeImmutable $from, ?DateTimeImmutable $to): Collection
 | 
			
		||||
    public function getMembersOnRange(DateTimeImmutable $from, ?DateTimeImmutable $to): ReadableCollection
 | 
			
		||||
    {
 | 
			
		||||
        return $this->getMembers()->filter(static function (HouseholdMember $m) use ($from, $to) {
 | 
			
		||||
            if (null === $m->getEndDate() && null !== $to) {
 | 
			
		||||
 
 | 
			
		||||
@@ -28,11 +28,15 @@ class PickPersonDynamicType extends AbstractType
 | 
			
		||||
{
 | 
			
		||||
    private DenormalizerInterface $denormalizer;
 | 
			
		||||
 | 
			
		||||
    private DenormalizerInterface $normalizer;
 | 
			
		||||
    private NormalizerInterface $normalizer;
 | 
			
		||||
 | 
			
		||||
    private SerializerInterface $serializer;
 | 
			
		||||
 | 
			
		||||
    public function __construct(DenormalizerInterface $denormalizer, SerializerInterface $serializer, NormalizerInterface $normalizer)
 | 
			
		||||
    public function __construct(
 | 
			
		||||
        DenormalizerInterface $denormalizer,
 | 
			
		||||
        SerializerInterface $serializer,
 | 
			
		||||
        NormalizerInterface $normalizer
 | 
			
		||||
    )
 | 
			
		||||
    {
 | 
			
		||||
        $this->denormalizer = $denormalizer;
 | 
			
		||||
        $this->serializer = $serializer;
 | 
			
		||||
 
 | 
			
		||||
@@ -27,6 +27,7 @@ use Chill\PersonBundle\Entity\Person;
 | 
			
		||||
use Chill\PersonBundle\Repository\PersonRepository;
 | 
			
		||||
use Chill\PersonBundle\Templating\Entity\PersonRenderInterface;
 | 
			
		||||
use DateTime;
 | 
			
		||||
use Doctrine\Common\Collections\ArrayCollection;
 | 
			
		||||
use Doctrine\ORM\EntityManagerInterface;
 | 
			
		||||
use Doctrine\ORM\EntityRepository;
 | 
			
		||||
use Symfony\Bridge\Doctrine\Form\Type\EntityType;
 | 
			
		||||
@@ -159,9 +160,9 @@ class AccompanyingPeriodContext implements
 | 
			
		||||
    public function buildPublicForm(FormBuilderInterface $builder, DocGeneratorTemplate $template, mixed $entity): void
 | 
			
		||||
    {
 | 
			
		||||
        $options = $template->getOptions();
 | 
			
		||||
        $persons = $entity->getCurrentParticipations()->map(static function (AccompanyingPeriodParticipation $p) {
 | 
			
		||||
        $persons = new ArrayCollection($entity->getCurrentParticipations()->map(static function (AccompanyingPeriodParticipation $p) {
 | 
			
		||||
            return $p->getPerson();
 | 
			
		||||
        });
 | 
			
		||||
        })->toArray());
 | 
			
		||||
 | 
			
		||||
        foreach ($entity->getCurrentParticipations() as $p) {
 | 
			
		||||
            foreach ($p->getPerson()->getResources() as $r) {
 | 
			
		||||
 
 | 
			
		||||
@@ -102,7 +102,9 @@ class AccompanyingPeriodWorkWorkflowHandler implements EntityWorkflowHandlerInte
 | 
			
		||||
            ->getAccompanyingPeriod()
 | 
			
		||||
            ->getUser();
 | 
			
		||||
 | 
			
		||||
        $suggestedUsers[spl_object_hash($referrer)] = $referrer;
 | 
			
		||||
        if (null !== $referrer) {
 | 
			
		||||
            $suggestedUsers[spl_object_hash($referrer)] = $referrer;
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
        return $suggestedUsers;
 | 
			
		||||
    }
 | 
			
		||||
 
 | 
			
		||||
@@ -158,7 +158,7 @@ class ReportList implements ExportElementValidatedInterface, ListInterface
 | 
			
		||||
        );
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    public function getLabels($key, array $values, $data): Closure
 | 
			
		||||
    public function getLabels($key, array $values, $data)
 | 
			
		||||
    {
 | 
			
		||||
        switch ($key) {
 | 
			
		||||
            case 'person_birthdate':
 | 
			
		||||
 
 | 
			
		||||
@@ -66,22 +66,6 @@ class LoadThirdParty extends Fixture implements DependentFixtureInterface
 | 
			
		||||
        $manager->flush();
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    private function createAddress(): ObjectSet
 | 
			
		||||
    {
 | 
			
		||||
        $loader = new NativeLoader();
 | 
			
		||||
 | 
			
		||||
        return $loader->loadData([
 | 
			
		||||
            Address::class => [
 | 
			
		||||
                'address1' => [
 | 
			
		||||
                    'name' => '<fr_FR:company()>',
 | 
			
		||||
                    'telephone' => $this->phoneNumberUtil->getExampleNumber('FR'),
 | 
			
		||||
                    'email' => '<email()>',
 | 
			
		||||
                    'comment' => '<fr_FR:realTextBetween(10, 500)>',
 | 
			
		||||
                ],
 | 
			
		||||
            ],
 | 
			
		||||
        ]);
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    private function getCenters(): Iterator
 | 
			
		||||
    {
 | 
			
		||||
        $references = array_map(
 | 
			
		||||
 
 | 
			
		||||
@@ -23,6 +23,7 @@ use DateTimeImmutable;
 | 
			
		||||
use DateTimeInterface;
 | 
			
		||||
use Doctrine\Common\Collections\ArrayCollection;
 | 
			
		||||
use Doctrine\Common\Collections\Collection;
 | 
			
		||||
use Doctrine\Common\Collections\ReadableCollection;
 | 
			
		||||
use Doctrine\ORM\Mapping as ORM;
 | 
			
		||||
use libphonenumber\PhoneNumber;
 | 
			
		||||
use Symfony\Component\Serializer\Annotation\Context;
 | 
			
		||||
@@ -153,7 +154,7 @@ class ThirdParty implements TrackCreationInterface, TrackUpdateInterface
 | 
			
		||||
     * @ORM\OneToMany(targetEntity="Chill\ThirdPartyBundle\Entity\ThirdParty", mappedBy="parent",
 | 
			
		||||
     * cascade={"persist"}, orphanRemoval=true)
 | 
			
		||||
     *
 | 
			
		||||
     * @var Collection|ThirdParty[]
 | 
			
		||||
     * @var Collection<(int|string), ThirdParty>
 | 
			
		||||
     * @Assert\Valid(traverse=true)
 | 
			
		||||
     */
 | 
			
		||||
    private Collection $children;
 | 
			
		||||
@@ -400,7 +401,7 @@ class ThirdParty implements TrackCreationInterface, TrackUpdateInterface
 | 
			
		||||
    /**
 | 
			
		||||
     * Get the children where active = true.
 | 
			
		||||
     */
 | 
			
		||||
    public function getActiveChildren(): Collection
 | 
			
		||||
    public function getActiveChildren(): ReadableCollection
 | 
			
		||||
    {
 | 
			
		||||
        return $this->children->filter(static fn (ThirdParty $tp) => $tp->getActive());
 | 
			
		||||
    }
 | 
			
		||||
 
 | 
			
		||||
@@ -94,7 +94,7 @@ class Convert
 | 
			
		||||
                'Content-Type' => 'application/pdf',
 | 
			
		||||
            ]);
 | 
			
		||||
        } catch (ClientExceptionInterface|TransportExceptionInterface|RedirectionExceptionInterface|ServerExceptionInterface $exception) {
 | 
			
		||||
            return $this->onConversionFailed($url, $response);
 | 
			
		||||
            return $this->onConversionFailed($url, $exception->getResponse());
 | 
			
		||||
        }
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
 
 | 
			
		||||
 Submodule tests/app updated: 5b35e7ccd0...5e478fdfbf
									
								
							
		Reference in New Issue
	
	Block a user