Fix cs with new cs rules (php-cs-fixer version 3.35)

This commit is contained in:
Julien Fastré 2023-10-16 11:59:49 +02:00
parent 68d28f3e28
commit 51a4ffca2e
Signed by: julienfastre
GPG Key ID: BDE2190974723FCB
35 changed files with 53 additions and 53 deletions

View File

@ -193,7 +193,7 @@ final readonly class ActivityACLAwareRepository implements ActivityACLAwareRepos
return $qb->getQuery()->getResult();
}
public function findUserJobByAssociated(Person|AccompanyingPeriod $associated): array
public function findUserJobByAssociated(AccompanyingPeriod|Person $associated): array
{
$in = $this->em->createQueryBuilder();
$in->select('IDENTITY(u.job)')

View File

@ -34,7 +34,7 @@ class ChargeRepository extends ServiceEntityRepository
/**
* @return Charge[]
*/
public function findAllByEntity(Person|Household $entity): array
public function findAllByEntity(Household|Person $entity): array
{
$qb = $this->createQueryBuilder('c');

View File

@ -35,7 +35,7 @@ class ResourceRepository extends ServiceEntityRepository
/**
* @return Resource[]
*/
public function findAllByEntity(Person|Household $entity): array
public function findAllByEntity(Household|Person $entity): array
{
$qb = $this->createQueryBuilder('r');
@ -47,7 +47,7 @@ class ResourceRepository extends ServiceEntityRepository
return $qb->getQuery()->getResult();
}
public function findByEntityAndDate(Person|Household $entity, DateTime $date, $sort = null)
public function findByEntityAndDate(Household|Person $entity, DateTime $date, $sort = null)
{
$qb = $this->createQueryBuilder('c');

View File

@ -33,7 +33,7 @@ final readonly class MSUserAbsenceReader implements MSUserAbsenceReaderInterface
/**
* @throw UserAbsenceSyncException when the data cannot be reached or is not valid from microsoft
*/
public function isUserAbsent(User $user): bool|null
public function isUserAbsent(User $user): null|bool
{
$id = $this->mapCalendarToUser->getUserId($user);

View File

@ -18,5 +18,5 @@ interface MSUserAbsenceReaderInterface
/**
* @throw UserAbsenceSyncException when the data cannot be reached or is not valid from microsoft
*/
public function isUserAbsent(User $user): bool|null;
public function isUserAbsent(User $user): null|bool;
}

View File

@ -366,7 +366,7 @@ class CustomFieldChoice extends AbstractCustomField
* If the value had an 'allow_other' = true option, the returned value
* **is not** the content of the _other field, but the `_other` string.
*/
private function guessValue(array|string|null $value)
private function guessValue(null|array|string $value)
{
if (null === $value) {
return null;

View File

@ -138,7 +138,7 @@ class CustomFieldsGroup
/**
* Get name.
*/
public function getName(?string $language = null): string|array
public function getName(?string $language = null): array|string
{
//TODO set this in a service, PLUS twig function
if (null !== $language) {

View File

@ -44,7 +44,7 @@ class ParticipationController extends AbstractController
* @return Response|\Symfony\Component\HttpFoundation\RedirectResponse
* @\Symfony\Component\Routing\Annotation\Route(path="/{_locale}/event/participation/create", name="chill_event_participation_create")
*/
public function createAction(Request $request): \Symfony\Component\HttpFoundation\Response|\Symfony\Component\HttpFoundation\RedirectResponse
public function createAction(Request $request): \Symfony\Component\HttpFoundation\RedirectResponse|\Symfony\Component\HttpFoundation\Response
{
// test the request is correct
try {
@ -162,7 +162,7 @@ class ParticipationController extends AbstractController
/**
* @return Response|\Symfony\Component\HttpFoundation\RedirectResponse
*/
public function createMultiple(Request $request): \Symfony\Component\HttpFoundation\Response|\Symfony\Component\HttpFoundation\RedirectResponse
public function createMultiple(Request $request): \Symfony\Component\HttpFoundation\RedirectResponse|\Symfony\Component\HttpFoundation\Response
{
$participations = $this->handleRequest($request, new Participation(), true);
@ -205,7 +205,7 @@ class ParticipationController extends AbstractController
/**
* @return Response|\Symfony\Component\HttpFoundation\RedirectResponse
*/
public function createSingle(Request $request): \Symfony\Component\HttpFoundation\Response|\Symfony\Component\HttpFoundation\RedirectResponse
public function createSingle(Request $request): \Symfony\Component\HttpFoundation\RedirectResponse|\Symfony\Component\HttpFoundation\Response
{
$participation = $this->handleRequest($request, new Participation(), false);
@ -249,7 +249,7 @@ class ParticipationController extends AbstractController
* @return Response|\Symfony\Component\HttpFoundation\RedirectResponse
* @\Symfony\Component\Routing\Annotation\Route(path="/{_locale}/event/participation/{participation_id}/delete", name="chill_event_participation_delete", requirements={"participation_id"="\d+"}, methods={"GET", "DELETE"})
*/
public function deleteAction($participation_id, Request $request): \Symfony\Component\HttpFoundation\Response|\Symfony\Component\HttpFoundation\RedirectResponse
public function deleteAction($participation_id, Request $request): \Symfony\Component\HttpFoundation\RedirectResponse|\Symfony\Component\HttpFoundation\Response
{
$em = $this->getDoctrine()->getManager();
$participation = $em->getRepository(\Chill\EventBundle\Entity\Participation::class)->findOneBy([
@ -330,7 +330,7 @@ class ParticipationController extends AbstractController
* @return Response|\Symfony\Component\HttpFoundation\RedirectResponse
* @\Symfony\Component\Routing\Annotation\Route(path="/{_locale}/event/participation/{event_id}/edit_multiple", name="chill_event_participation_edit_multiple")
*/
public function editMultipleAction($event_id): \Symfony\Component\HttpFoundation\Response|\Symfony\Component\HttpFoundation\RedirectResponse
public function editMultipleAction($event_id): \Symfony\Component\HttpFoundation\RedirectResponse|\Symfony\Component\HttpFoundation\Response
{
$event = $this->getDoctrine()->getRepository(\Chill\EventBundle\Entity\Event::class)
->find($event_id);
@ -388,7 +388,7 @@ class ParticipationController extends AbstractController
* @return Response|\Symfony\Component\HttpFoundation\RedirectResponse
* @\Symfony\Component\Routing\Annotation\Route(path="/{_locale}/event/participation/new", name="chill_event_participation_new")
*/
public function newAction(Request $request): \Symfony\Component\HttpFoundation\Response|\Symfony\Component\HttpFoundation\RedirectResponse
public function newAction(Request $request): \Symfony\Component\HttpFoundation\RedirectResponse|\Symfony\Component\HttpFoundation\Response
{
// test the request is correct
try {
@ -560,7 +560,7 @@ class ParticipationController extends AbstractController
Request $request,
Participation $participation,
bool $multiple = false
): \Chill\EventBundle\Entity\Participation|array {
): array|\Chill\EventBundle\Entity\Participation {
$em = $this->getDoctrine()->getManager();
if ($em->contains($participation)) {
@ -637,7 +637,7 @@ class ParticipationController extends AbstractController
*
* @return Response|\Symfony\Component\HttpFoundation\RedirectResponse
*/
protected function newMultiple(Request $request): \Symfony\Component\HttpFoundation\Response|\Symfony\Component\HttpFoundation\RedirectResponse
protected function newMultiple(Request $request): \Symfony\Component\HttpFoundation\RedirectResponse|\Symfony\Component\HttpFoundation\Response
{
$participations = $this->handleRequest($request, new Participation(), true);
$ignoredParticipations = $newParticipations = [];

View File

@ -135,7 +135,7 @@ class Event implements HasCenterInterface, HasScopeInterface
return $this->id;
}
public function getModerator(): User|null
public function getModerator(): null|User
{
return $this->moderator;
}

View File

@ -96,7 +96,7 @@ class LoadPostalCodesCommand extends Command
try {
$this->addPostalCode($row, $output);
++$num;
} catch (ExistingPostalCodeException|CountryCodeNotFoundException|PostalCodeNotValidException $ex) {
} catch (CountryCodeNotFoundException|ExistingPostalCodeException|PostalCodeNotValidException $ex) {
$output->writeln('<warning> on line ' . $line . ' : ' . $ex->getMessage() . '</warning>');
}
++$line;

View File

@ -99,7 +99,7 @@ class PasswordController extends AbstractController
* @return Response|\Symfony\Component\HttpFoundation\RedirectResponse
* @\Symfony\Component\Routing\Annotation\Route(path="/public/{_locale}/password/recover", name="password_recover")
*/
public function recoverAction(Request $request): \Symfony\Component\HttpFoundation\Response|\Symfony\Component\HttpFoundation\RedirectResponse
public function recoverAction(Request $request): \Symfony\Component\HttpFoundation\RedirectResponse|\Symfony\Component\HttpFoundation\Response
{
if (false === $this->isGranted(PasswordRecoverVoter::ASK_TOKEN)) {
return new Response($this->translator->trans('You are not allowed '
@ -168,7 +168,7 @@ class PasswordController extends AbstractController
* @return Response|\Symfony\Component\HttpFoundation\RedirectResponse
* @\Symfony\Component\Routing\Annotation\Route(path="/public/{_locale}/password/request-recover", name="password_request_recover")
*/
public function requestRecoverAction(Request $request): \Symfony\Component\HttpFoundation\Response|\Symfony\Component\HttpFoundation\RedirectResponse
public function requestRecoverAction(Request $request): \Symfony\Component\HttpFoundation\RedirectResponse|\Symfony\Component\HttpFoundation\Response
{
if (false === $this->isGranted(PasswordRecoverVoter::ASK_TOKEN)) {
return new Response($this->translator->trans('You are not allowed '

View File

@ -29,7 +29,7 @@ class Extract extends FunctionNode
{
private string $field;
private \Doctrine\ORM\Query\AST\Node|string|null $value = null;
private null|\Doctrine\ORM\Query\AST\Node|string $value = null;
//private PathExpression $value;
//private FunctionNode $value;
//private DateDiffFunction $value;

View File

@ -18,7 +18,7 @@ use Doctrine\ORM\Query\SqlWalker;
class JsonExtract extends FunctionNode
{
private \Doctrine\ORM\Query\AST\Node|string|null $element = null;
private null|\Doctrine\ORM\Query\AST\Node|string $element = null;
private ?\Doctrine\ORM\Query\AST\ArithmeticExpression $keyToExtract = null;

View File

@ -23,7 +23,7 @@ class ToChar extends FunctionNode
{
private ?\Doctrine\ORM\Query\AST\ArithmeticExpression $datetime = null;
private \Doctrine\ORM\Query\AST\Node|string|null $fmt = null;
private null|\Doctrine\ORM\Query\AST\Node|string $fmt = null;
public function getSql(SqlWalker $sqlWalker)
{

View File

@ -28,7 +28,7 @@ final readonly class ExportFormHelper
private FormFactoryInterface $formFactory,
) {}
public function getDefaultData(string $step, ExportInterface|DirectExportInterface $export, array $options = []): array
public function getDefaultData(string $step, DirectExportInterface|ExportInterface $export, array $options = []): array
{
return match ($step) {
'centers', 'generate_centers' => ['centers' => $this->authorizationHelper->getReachableCenters($export->requiredRole())],
@ -45,7 +45,7 @@ final readonly class ExportFormHelper
return $formatter->getFormDefaultData($options['aggregator_aliases']);
}
private function getDefaultDataStepExport(ExportInterface|DirectExportInterface $export, array $options): array
private function getDefaultDataStepExport(DirectExportInterface|ExportInterface $export, array $options): array
{
$data = [
ExportType::EXPORT_KEY => $export->getFormDefaultData(),

View File

@ -101,7 +101,7 @@ class ExportManager
*
* @return FilterInterface[] a \Generator that contains filters. The key is the filter's alias
*/
public function &getFiltersApplyingOn(ExportInterface|DirectExportInterface $export, ?array $centers = null): iterable
public function &getFiltersApplyingOn(DirectExportInterface|ExportInterface $export, ?array $centers = null): iterable
{
if ($export instanceof DirectExportInterface) {
return;
@ -124,7 +124,7 @@ class ExportManager
*
* @return null|iterable<string, AggregatorInterface> a \Generator that contains aggretagors. The key is the filter's alias
*/
public function &getAggregatorsApplyingOn(ExportInterface|DirectExportInterface $export, ?array $centers = null): ?iterable
public function &getAggregatorsApplyingOn(DirectExportInterface|ExportInterface $export, ?array $centers = null): ?iterable
{
if ($export instanceof ListInterface || $export instanceof DirectExportInterface) {
return;
@ -307,7 +307,7 @@ class ExportManager
*
* @throws RuntimeException
*/
public function getExport($alias): ExportInterface|DirectExportInterface
public function getExport($alias): DirectExportInterface|ExportInterface
{
if (!array_key_exists($alias, $this->exports)) {
throw new RuntimeException("The export with alias {$alias} is not known.");
@ -453,7 +453,7 @@ class ExportManager
*
*/
public function isGrantedForElement(
ExportInterface|DirectExportInterface|ModifierInterface $element,
DirectExportInterface|ExportInterface|ModifierInterface $element,
\Chill\MainBundle\Export\DirectExportInterface|\Chill\MainBundle\Export\ExportInterface $export = null,
?array $centers = null
): bool {

View File

@ -66,7 +66,7 @@ class AuthorizationHelper implements AuthorizationHelperInterface
*
* @return User[]
*/
public function findUsersReaching(string $role, array|\Chill\MainBundle\Entity\Center $center, array|\Chill\MainBundle\Entity\Scope|null $scope = null, bool $onlyEnabled = true): array
public function findUsersReaching(string $role, array|\Chill\MainBundle\Entity\Center $center, null|array|\Chill\MainBundle\Entity\Scope $scope = null, bool $onlyEnabled = true): array
{
return $this->userACLAwareRepository
->findUsersByReachedACL($role, $center, $scope, $onlyEnabled);
@ -130,7 +130,7 @@ class AuthorizationHelper implements AuthorizationHelperInterface
* @param Center|Center[] $center
* @return Scope[]
*/
public function getReachableCircles(UserInterface $user, string $role, \Chill\MainBundle\Entity\Center|array $center)
public function getReachableCircles(UserInterface $user, string $role, array|\Chill\MainBundle\Entity\Center $center)
{
$scopes = [];
@ -162,7 +162,7 @@ class AuthorizationHelper implements AuthorizationHelperInterface
/**
* Return all reachable scope for a given user, center and role.
*/
public function getReachableScopes(UserInterface $user, string $role, Center|array $center): array
public function getReachableScopes(UserInterface $user, string $role, array|Center $center): array
{
return $this->getReachableCircles($user, $role, $center);
}
@ -172,7 +172,7 @@ class AuthorizationHelper implements AuthorizationHelperInterface
*
* @param Center|Center[] $center May be an array of center
*/
public function userCanReachCenter(User $user, \Chill\MainBundle\Entity\Center|array $center): bool
public function userCanReachCenter(User $user, array|\Chill\MainBundle\Entity\Center $center): bool
{
if ($center instanceof Traversable) {
foreach ($center as $c) {

View File

@ -29,5 +29,5 @@ interface AuthorizationHelperInterface
* @param Center|array<Center> $center
* @return list<Scope>
*/
public function getReachableScopes(UserInterface $user, string $role, Center|array $center): array;
public function getReachableScopes(UserInterface $user, string $role, array|Center $center): array;
}

View File

@ -32,7 +32,7 @@ final readonly class ScopeResolverDispatcher
return false;
}
public function resolveScope(mixed $entity, ?array $options = []): iterable|\Chill\MainBundle\Entity\Scope|null
public function resolveScope(mixed $entity, ?array $options = []): null|\Chill\MainBundle\Entity\Scope|iterable
{
foreach ($this->resolvers as $resolver) {
if ($resolver->supports($entity, $options)) {

View File

@ -45,7 +45,7 @@ class DiscriminatedObjectDenormalizer implements ContextAwareDenormalizerInterfa
if ($this->denormalizer->supportsDenormalization($data, $localType, $format)) {
try {
return $this->denormalizer->denormalize($data, $localType, $format, $context);
} catch (RuntimeException|NotNormalizableValueException $e) {
} catch (NotNormalizableValueException|RuntimeException $e) {
$lastException = $e;
}
}

View File

@ -40,7 +40,7 @@ abstract class AddressPart extends FunctionNode
'country_id',
];
private \Doctrine\ORM\Query\AST\Node|string|null $date = null;
private null|\Doctrine\ORM\Query\AST\Node|string $date = null;
/**
* @var \Doctrine\ORM\Query\AST\Node

View File

@ -977,7 +977,7 @@ class AccompanyingPeriod implements
/**
* @Groups({"read"})
*/
public function getRequestor(): Person|ThirdParty|null
public function getRequestor(): null|Person|ThirdParty
{
return $this->requestorPerson ?? $this->requestorThirdParty;
}

View File

@ -96,7 +96,7 @@ class Resource
/**
* @Groups({"read"})
*/
public function getResource(): \Chill\PersonBundle\Entity\Person|\Chill\ThirdPartyBundle\Entity\ThirdParty|null
public function getResource(): null|\Chill\PersonBundle\Entity\Person|\Chill\ThirdPartyBundle\Entity\ThirdParty
{
return $this->person ?? $this->thirdParty;
}

View File

@ -619,7 +619,7 @@ class Person implements HasCenterInterface, TrackCreationInterface, TrackUpdateI
* @return true | array True if the accompanying periods are not collapsing,
* an array with data for displaying the error
*/
public function checkAccompanyingPeriodsAreNotCollapsing(): bool|array
public function checkAccompanyingPeriodsAreNotCollapsing(): array|bool
{
$periods = $this->getAccompanyingPeriodsOrdered();
$periodsNbr = count($periods);

View File

@ -156,7 +156,7 @@ class SocialAction
*
* @return Collection|SocialAction[] a list with the elements of the given list which are parent of other elements in the given list
*/
public static function findAncestorSocialActions(\Doctrine\Common\Collections\Collection|array $socialActions): Collection
public static function findAncestorSocialActions(array|\Doctrine\Common\Collections\Collection $socialActions): Collection
{
$ancestors = new ArrayCollection();
@ -236,7 +236,7 @@ class SocialAction
/**
* @param Collection|SocialAction[] $socialActions
*/
public static function getDescendantsWithThisForActions(\Doctrine\Common\Collections\Collection|array $socialActions): Collection
public static function getDescendantsWithThisForActions(array|\Doctrine\Common\Collections\Collection $socialActions): Collection
{
$unique = [];
@ -420,7 +420,7 @@ class SocialAction
return $this;
}
public static function filterRemoveDeactivatedActions(ReadableCollection|array $actions, \DateTime $comparisonDate): ReadableCollection|array
public static function filterRemoveDeactivatedActions(array|ReadableCollection $actions, \DateTime $comparisonDate): array|ReadableCollection
{
$filterFn = fn (SocialAction $socialAction) => !$socialAction->isDesactivated($comparisonDate);

View File

@ -110,7 +110,7 @@ class SocialIssue
*
* @return Collection|SocialIssue[]
*/
public static function findAncestorSocialIssues(\Doctrine\Common\Collections\Collection|array $socialIssues): Collection
public static function findAncestorSocialIssues(array|\Doctrine\Common\Collections\Collection $socialIssues): Collection
{
$ancestors = new ArrayCollection();

View File

@ -81,7 +81,7 @@ final readonly class JobWorkingOnCourseAggregator implements AggregatorInterface
public function getLabels($key, array $values, $data): \Closure
{
return function (int|string|null $jobId) {
return function (null|int|string $jobId) {
if (null === $jobId || '' === $jobId) {
return '';
}

View File

@ -81,7 +81,7 @@ final readonly class ScopeWorkingOnCourseAggregator implements AggregatorInterfa
public function getLabels($key, array $values, $data): \Closure
{
return function (int|string|null $scopeId) {
return function (null|int|string $scopeId) {
if (null === $scopeId || '' === $scopeId) {
return '';
}

View File

@ -41,7 +41,7 @@ final readonly class UserWorkingOnCourseAggregator implements AggregatorInterfac
public function getLabels($key, array $values, $data): \Closure
{
return function (int|string|null $userId) {
return function (null|int|string $userId) {
if (null === $userId || '' === $userId) {
return '';
}

View File

@ -46,7 +46,7 @@ final readonly class CenterAggregator implements AggregatorInterface
public function getLabels($key, array $values, $data): Closure
{
return function (int|string|null $value) {
return function (null|int|string $value) {
if (null === $value || '' === $value) {
return '';
}

View File

@ -37,7 +37,7 @@ class AccompanyingPeriodWorkNormalizer implements ContextAwareNormalizerInterfac
*
* @throws ExceptionInterface
*/
public function normalize($object, ?string $format = null, array $context = []): array|\ArrayObject|bool|float|int|string|null
public function normalize($object, ?string $format = null, array $context = []): null|array|\ArrayObject|bool|float|int|string
{
$initial = $this->normalizer->normalize($object, $format, array_merge(
$context,

View File

@ -518,7 +518,7 @@ class AccompanyingPeriodACLAwareRepositoryTest extends KernelTestCase
/**
* @param array<Scope> $scopes
*/
private function buildPeriod(Person $person, array $scopes, User|null $creator, bool $confirm): AccompanyingPeriod
private function buildPeriod(Person $person, array $scopes, null|User $creator, bool $confirm): AccompanyingPeriod
{
$period = new AccompanyingPeriod();
$period->addPerson($person);

View File

@ -165,7 +165,7 @@ final class LoadReports extends AbstractFixture implements OrderedFixtureInterfa
*
* @return string|string[]
*/
private function getRandomChoice(CustomField $field): string|array
private function getRandomChoice(CustomField $field): array|string
{
$choices = $field->getOptions()['choices'];
$multiple = $field->getOptions()['multiple'];

View File

@ -27,7 +27,7 @@ class AuthorizationEvent extends \Symfony\Contracts\EventDispatcher\Event
protected $vote;
public function __construct(
private readonly Person|AbstractTask|AccompanyingPeriod|null $subject,
private readonly null|AbstractTask|AccompanyingPeriod|Person $subject,
private readonly string $attribute,
private readonly TokenInterface $token
) {}

View File

@ -78,7 +78,7 @@ class Convert
return new Response($response->getContent(), Response::HTTP_OK, [
'Content-Type' => 'application/pdf',
]);
} catch (ClientExceptionInterface|TransportExceptionInterface|RedirectionExceptionInterface|ServerExceptionInterface $exception) {
} catch (ClientExceptionInterface|RedirectionExceptionInterface|ServerExceptionInterface|TransportExceptionInterface $exception) {
return $this->onConversionFailed($url, $exception->getResponse());
}
}