upgrade php-cs 3.49

This commit is contained in:
2024-02-07 10:43:53 +01:00
parent 51ebc253aa
commit 036fe8d6f8
257 changed files with 605 additions and 605 deletions

View File

@@ -181,7 +181,7 @@ class CRUDController extends AbstractController
/**
* Count the number of entities.
*/
protected function countEntities(string $action, Request $request, FilterOrderHelper $filterOrder = null): int
protected function countEntities(string $action, Request $request, ?FilterOrderHelper $filterOrder = null): int
{
return $this->buildQueryEntities($action, $request)
->select('COUNT(e)')
@@ -210,7 +210,7 @@ class CRUDController extends AbstractController
* It is preferable to override customizeForm instead of overriding
* this method.
*/
protected function createFormFor(string $action, mixed $entity, string $formClass = null, array $formOptions = []): FormInterface
protected function createFormFor(string $action, mixed $entity, ?string $formClass = null, array $formOptions = []): FormInterface
{
$formClass ??= $this->getFormClassFor($action);
@@ -463,7 +463,7 @@ class CRUDController extends AbstractController
*
* @throws \Symfony\Component\HttpKernel\Exception\NotFoundHttpException
*/
protected function formEditAction(string $action, Request $request, mixed $id, string $formClass = null, array $formOptions = []): Response
protected function formEditAction(string $action, Request $request, mixed $id, ?string $formClass = null, array $formOptions = []): Response
{
$entity = $this->getEntity($action, $id, $request);
@@ -660,7 +660,7 @@ class CRUDController extends AbstractController
Request $request,
int $totalItems,
PaginatorInterface $paginator,
FilterOrderHelper $filterOrder = null
?FilterOrderHelper $filterOrder = null
) {
$query = $this->queryEntities($action, $request, $paginator, $filterOrder);
@@ -670,7 +670,7 @@ class CRUDController extends AbstractController
/**
* @return \Chill\MainBundle\Entity\Center[]
*/
protected function getReachableCenters(string $role, Scope $scope = null)
protected function getReachableCenters(string $role, ?Scope $scope = null)
{
return $this->getAuthorizationHelper()
->getReachableCenters($this->getUser(), $role, $scope);
@@ -934,7 +934,7 @@ class CRUDController extends AbstractController
*
* @return type
*/
protected function queryEntities(string $action, Request $request, PaginatorInterface $paginator, FilterOrderHelper $filterOrder = null)
protected function queryEntities(string $action, Request $request, PaginatorInterface $paginator, ?FilterOrderHelper $filterOrder = null)
{
$query = $this->buildQueryEntities($action, $request)
->setFirstResult($paginator->getCurrentPage()->getFirstItemNumber())

View File

@@ -334,7 +334,7 @@ class ExportController extends AbstractController
* When the method is POST, the form is stored if valid, and a redirection
* is done to next step.
*/
private function exportFormStep(Request $request, DirectExportInterface|ExportInterface $export, string $alias, SavedExport $savedExport = null): Response
private function exportFormStep(Request $request, DirectExportInterface|ExportInterface $export, string $alias, ?SavedExport $savedExport = null): Response
{
$exportManager = $this->exportManager;
@@ -392,7 +392,7 @@ class ExportController extends AbstractController
* If the form is posted and valid, store the data in session and
* redirect to the next step.
*/
private function formatterFormStep(Request $request, DirectExportInterface|ExportInterface $export, string $alias, SavedExport $savedExport = null): Response
private function formatterFormStep(Request $request, DirectExportInterface|ExportInterface $export, string $alias, ?SavedExport $savedExport = null): Response
{
// check we have data from the previous step (export step)
$data = $this->session->get('export_step', null);
@@ -521,7 +521,7 @@ class ExportController extends AbstractController
*
* @return Response
*/
private function selectCentersStep(Request $request, DirectExportInterface|ExportInterface $export, $alias, SavedExport $savedExport = null)
private function selectCentersStep(Request $request, DirectExportInterface|ExportInterface $export, $alias, ?SavedExport $savedExport = null)
{
if (!$this->filterStatsByCenters) {
return $this->redirectToRoute('chill_main_export_new', [

View File

@@ -400,7 +400,7 @@ final class PermissionsGroupController extends AbstractController
* get a role scope by his parameters. The role scope is persisted if it
* doesn't exist in database.
*/
protected function getPersistentRoleScopeBy(string $role, Scope $scope = null): RoleScope
protected function getPersistentRoleScopeBy(string $role, ?Scope $scope = null): RoleScope
{
$roleScope = $this->roleScopeRepository
->findOneBy(['role' => $role, 'scope' => $scope]);

View File

@@ -268,7 +268,7 @@ class UserController extends CRUDController
->build();
}
protected function countEntities(string $action, Request $request, FilterOrderHelper $filterOrder = null): int
protected function countEntities(string $action, Request $request, ?FilterOrderHelper $filterOrder = null): int
{
if (!$filterOrder instanceof FilterOrderHelper) {
return parent::countEntities($action, $request, $filterOrder);
@@ -281,7 +281,7 @@ class UserController extends CRUDController
return $this->userRepository->countByUsernameOrEmail($filterOrder->getQueryString());
}
protected function createFormFor(string $action, $entity, string $formClass = null, array $formOptions = []): FormInterface
protected function createFormFor(string $action, $entity, ?string $formClass = null, array $formOptions = []): FormInterface
{
// for "new", add special config
if ('new' === $action) {
@@ -325,7 +325,7 @@ class UserController extends CRUDController
Request $request,
int $totalItems,
PaginatorInterface $paginator,
FilterOrderHelper $filterOrder = null
?FilterOrderHelper $filterOrder = null
) {
if (0 === $totalItems) {
return [];

View File

@@ -28,5 +28,5 @@ interface CronJobInterface
*
* @return array|null optionally return an array with the same data than the previous execution
*/
public function run(array $lastExecutionData): null|array;
public function run(array $lastExecutionData): array|null;
}

View File

@@ -58,7 +58,7 @@ final readonly class CronManager implements CronManagerInterface
) {
}
public function run(string $forceJob = null): void
public function run(?string $forceJob = null): void
{
if (null !== $forceJob) {
$this->runForce($forceJob);

View File

@@ -16,5 +16,5 @@ interface CronManagerInterface
/**
* Execute one job, with a given priority, or the given job (identified by his key).
*/
public function run(string $forceJob = null): void;
public function run(?string $forceJob = null): void;
}

View File

@@ -50,7 +50,7 @@ class LoadAddressReferences extends AbstractFixture implements ContainerAwareInt
$manager->flush();
}
public function setContainer(ContainerInterface $container = null)
public function setContainer(?ContainerInterface $container = null)
{
$this->container = $container;
}

View File

@@ -43,7 +43,7 @@ class LoadCountries extends AbstractFixture implements ContainerAwareInterface,
$manager->flush();
}
public function setContainer(ContainerInterface $container = null)
public function setContainer(?ContainerInterface $container = null)
{
$this->container = $container;
}

View File

@@ -57,7 +57,7 @@ class LoadLanguages extends AbstractFixture implements ContainerAwareInterface,
$manager->flush();
}
public function setContainer(ContainerInterface $container = null)
public function setContainer(?ContainerInterface $container = null)
{
$this->container = $container;
}

View File

@@ -65,7 +65,7 @@ class LoadLocationType extends AbstractFixture implements ContainerAwareInterfac
$manager->flush();
}
public function setContainer(ContainerInterface $container = null)
public function setContainer(?ContainerInterface $container = null)
{
$this->container = $container;
}

View File

@@ -92,7 +92,7 @@ class LoadUsers extends AbstractFixture implements ContainerAwareInterface, Orde
$manager->flush();
}
public function setContainer(ContainerInterface $container = null)
public function setContainer(?ContainerInterface $container = null)
{
if (null === $container) {
throw new \LogicException('$container should not be null');

View File

@@ -29,7 +29,7 @@ class Extract extends FunctionNode
{
private string $field;
private null|\Doctrine\ORM\Query\AST\Node|string $value = null;
private \Doctrine\ORM\Query\AST\Node|string|null $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 null|\Doctrine\ORM\Query\AST\Node|string $element = null;
private \Doctrine\ORM\Query\AST\Node|string|null $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 null|\Doctrine\ORM\Query\AST\Node|string $fmt = null;
private \Doctrine\ORM\Query\AST\Node|string|null $fmt = null;
public function getSql(SqlWalker $sqlWalker)
{

View File

@@ -39,7 +39,7 @@ final class FlatHierarchyEntityHydrator extends ObjectHydrator
);
}
private function flatListGenerator(array $hashMap, object $parent = null): \Generator
private function flatListGenerator(array $hashMap, ?object $parent = null): \Generator
{
$parent = null === $parent ? null : spl_object_id($parent);
$hashMap += [$parent => []];

View File

@@ -440,7 +440,7 @@ class Address implements TrackCreationInterface, TrackUpdateInterface
return $this->getIsNoAddress();
}
public function setAddressReference(AddressReference $addressReference = null): Address
public function setAddressReference(?AddressReference $addressReference = null): Address
{
$this->addressReference = $addressReference;
@@ -529,7 +529,7 @@ class Address implements TrackCreationInterface, TrackUpdateInterface
*
* @return Address
*/
public function setPostcode(PostalCode $postcode = null)
public function setPostcode(?PostalCode $postcode = null)
{
$this->postcode = $postcode;
@@ -620,7 +620,7 @@ class Address implements TrackCreationInterface, TrackUpdateInterface
return $this;
}
public function setValidTo(\DateTimeInterface $validTo = null): self
public function setValidTo(?\DateTimeInterface $validTo = null): self
{
$this->validTo = $validTo;

View File

@@ -219,7 +219,7 @@ class AddressReference
*
* @return Address
*/
public function setPostcode(PostalCode $postcode = null)
public function setPostcode(?PostalCode $postcode = null)
{
$this->postcode = $postcode;

View File

@@ -210,7 +210,7 @@ class PostalCode implements TrackUpdateInterface, TrackCreationInterface
*
* @return PostalCode
*/
public function setCountry(Country $country = null)
public function setCountry(?Country $country = null)
{
$this->country = $country;

View File

@@ -78,14 +78,14 @@ class RoleScope
return $this->scope;
}
public function setRole(string $role = null): self
public function setRole(?string $role = null): self
{
$this->role = $role;
return $this;
}
public function setScope(Scope $scope = null): self
public function setScope(?Scope $scope = null): self
{
$this->scope = $scope;

View File

@@ -274,7 +274,7 @@ class User implements UserInterface, \Stringable
return $this->mainLocation;
}
public function getMainScope(\DateTimeImmutable $at = null): ?Scope
public function getMainScope(?\DateTimeImmutable $at = null): ?Scope
{
$at ??= new \DateTimeImmutable('now');
@@ -326,7 +326,7 @@ class User implements UserInterface, \Stringable
return $this->salt;
}
public function getUserJob(\DateTimeImmutable $at = null): ?UserJob
public function getUserJob(?\DateTimeImmutable $at = null): ?UserJob
{
$at ??= new \DateTimeImmutable('now');

View File

@@ -84,7 +84,7 @@ class UserJobHistory
return $this;
}
public function setJob(?UserJob $job): User\UserJobHistory
public function setJob(?UserJob $job): UserJobHistory
{
$this->job = $job;
@@ -98,7 +98,7 @@ class UserJobHistory
return $this;
}
public function setUser(User $user): User\UserJobHistory
public function setUser(User $user): UserJobHistory
{
$this->user = $user;

View File

@@ -84,7 +84,7 @@ class UserScopeHistory
return $this;
}
public function setScope(?Scope $scope): User\UserScopeHistory
public function setScope(?Scope $scope): UserScopeHistory
{
$this->scope = $scope;
@@ -98,7 +98,7 @@ class UserScopeHistory
return $this;
}
public function setUser(User $user): User\UserScopeHistory
public function setUser(User $user): UserScopeHistory
{
$this->user = $user;

View File

@@ -89,7 +89,7 @@ class ExportManager
*
* @return FilterInterface[] a \Generator that contains filters. The key is the filter's alias
*/
public function getFiltersApplyingOn(DirectExportInterface|ExportInterface $export, array $centers = null): array
public function getFiltersApplyingOn(DirectExportInterface|ExportInterface $export, ?array $centers = null): array
{
if ($export instanceof DirectExportInterface) {
return [];
@@ -116,7 +116,7 @@ class ExportManager
*
* @return array<string, AggregatorInterface> an array that contains aggregators. The key is the filter's alias
*/
public function getAggregatorsApplyingOn(DirectExportInterface|ExportInterface $export, array $centers = null): array
public function getAggregatorsApplyingOn(DirectExportInterface|ExportInterface $export, ?array $centers = null): array
{
if ($export instanceof ListInterface || $export instanceof DirectExportInterface) {
return [];
@@ -450,8 +450,8 @@ class ExportManager
*/
public function isGrantedForElement(
DirectExportInterface|ExportInterface|ModifierInterface $element,
DirectExportInterface|ExportInterface $export = null,
array $centers = null
DirectExportInterface|ExportInterface|null $export = null,
?array $centers = null
): bool {
if ($element instanceof ExportInterface || $element instanceof DirectExportInterface) {
$role = $element->requiredRole();

View File

@@ -34,7 +34,7 @@ class UserHelper
*/
public function getLabel($key, array $values, string $header): callable
{
return function (null|int|string $value) use ($header) {
return function (int|string|null $value) use ($header) {
if ('_header' === $value) {
return $header;
}

View File

@@ -46,7 +46,7 @@ class PostalCodeChoiceLoader implements ChoiceLoaderInterface
{
return new \Symfony\Component\Form\ChoiceList\ArrayChoiceList(
$this->lazyLoadedPostalCodes,
static fn (PostalCode $pc = null) => \call_user_func($value, $pc)
static fn (?PostalCode $pc = null) => \call_user_func($value, $pc)
);
}

View File

@@ -35,7 +35,7 @@ class IdToEntityDataTransformer implements DataTransformerInterface
public function __construct(
private readonly ObjectRepository $repository,
private readonly bool $multiple = false,
callable $getId = null
?callable $getId = null
) {
$this->getId = $getId ?? static fn (object $o) => $o->getId();
}

View File

@@ -74,7 +74,7 @@ class Mailer
mixed $recipient,
array $subject,
array $bodies,
callable $callback = null,
?callable $callback = null,
mixed $force = false
) {
$fromEmail = $this->routeParameters['from_email'];

View File

@@ -59,8 +59,8 @@ class PaginatorFactory
*/
public function create(
$totalItems,
string $route = null,
array $routeParameters = null
?string $route = null,
?array $routeParameters = null
) {
return new Paginator(
$totalItems,

View File

@@ -22,7 +22,7 @@ use libphonenumber\PhoneNumber;
*/
interface PhoneNumberHelperInterface
{
public function format(PhoneNumber $phoneNumber = null): string;
public function format(?PhoneNumber $phoneNumber = null): string;
/**
* Get type (mobile, landline, ...) for phone number.

View File

@@ -66,7 +66,7 @@ final class PhonenumberHelper implements PhoneNumberHelperInterface
*
* @throws NumberParseException
*/
public function format(PhoneNumber $phoneNumber = null): string
public function format(?PhoneNumber $phoneNumber = null): string
{
if (null === $phoneNumber) {
return '';

View File

@@ -71,7 +71,7 @@ final class AddressReferenceRepository implements ObjectRepository
*
* @return AddressReference[]
*/
public function findBy(array $criteria, array $orderBy = null, $limit = null, $offset = null): array
public function findBy(array $criteria, ?array $orderBy = null, $limit = null, $offset = null): array
{
return $this->repository->findBy($criteria, $orderBy, $limit, $offset);
}
@@ -103,7 +103,7 @@ final class AddressReferenceRepository implements ObjectRepository
->getResult();
}
public function findOneBy(array $criteria, array $orderBy = null): ?AddressReference
public function findOneBy(array $criteria, ?array $orderBy = null): ?AddressReference
{
return $this->repository->findOneBy($criteria, $orderBy);
}

View File

@@ -26,7 +26,7 @@ final class AddressRepository implements ObjectRepository
$this->repository = $entityManager->getRepository(Address::class);
}
public function createQueryBuilder(string $alias, string $indexBy = null): QueryBuilder
public function createQueryBuilder(string $alias, ?string $indexBy = null): QueryBuilder
{
return $this->repository->createQueryBuilder($alias, $indexBy);
}
@@ -50,12 +50,12 @@ final class AddressRepository implements ObjectRepository
*
* @return Address[]
*/
public function findBy(array $criteria, array $orderBy = null, $limit = null, $offset = null): array
public function findBy(array $criteria, ?array $orderBy = null, $limit = null, $offset = null): array
{
return $this->repository->findBy($criteria, $orderBy, $limit, $offset);
}
public function findOneBy(array $criteria, array $orderBy = null): ?Address
public function findOneBy(array $criteria, ?array $orderBy = null): ?Address
{
return $this->repository->findOneBy($criteria, $orderBy);
}

View File

@@ -51,12 +51,12 @@ final class CenterRepository implements CenterRepositoryInterface
*
* @return Center[]
*/
public function findBy(array $criteria, array $orderBy = null, $limit = null, $offset = null): array
public function findBy(array $criteria, ?array $orderBy = null, $limit = null, $offset = null): array
{
return $this->repository->findBy($criteria, $orderBy, $limit, $offset);
}
public function findOneBy(array $criteria, array $orderBy = null): ?Center
public function findOneBy(array $criteria, ?array $orderBy = null): ?Center
{
return $this->repository->findOneBy($criteria, $orderBy);
}

View File

@@ -34,7 +34,7 @@ class CivilityRepository implements CivilityRepositoryInterface
return $this->repository->findAll();
}
public function findBy(array $criteria, array $orderBy = null, int $limit = null, int $offset = null): array
public function findBy(array $criteria, ?array $orderBy = null, ?int $limit = null, ?int $offset = null): array
{
return $this->repository->findBy($criteria, $orderBy, $limit, $offset);
}

View File

@@ -26,7 +26,7 @@ interface CivilityRepositoryInterface extends ObjectRepository
/**
* @return array|Civility[]
*/
public function findBy(array $criteria, array $orderBy = null, int $limit = null, int $offset = null): array;
public function findBy(array $criteria, ?array $orderBy = null, ?int $limit = null, ?int $offset = null): array;
public function findOneBy(array $criteria): ?Civility;

View File

@@ -26,7 +26,7 @@ final class CountryRepository implements ObjectRepository
$this->repository = $entityManager->getRepository(Country::class);
}
public function createQueryBuilder(string $alias, string $indexBy = null): QueryBuilder
public function createQueryBuilder(string $alias, ?string $indexBy = null): QueryBuilder
{
return $this->repository->createQueryBuilder($alias, $indexBy);
}
@@ -50,12 +50,12 @@ final class CountryRepository implements ObjectRepository
*
* @return Country[]
*/
public function findBy(array $criteria, array $orderBy = null, $limit = null, $offset = null): array
public function findBy(array $criteria, ?array $orderBy = null, $limit = null, $offset = null): array
{
return $this->repository->findBy($criteria, $orderBy, $limit, $offset);
}
public function findOneBy(array $criteria, array $orderBy = null): ?Country
public function findOneBy(array $criteria, ?array $orderBy = null): ?Country
{
return $this->repository->findOneBy($criteria, $orderBy);
}

View File

@@ -40,7 +40,7 @@ class CronJobExecutionRepository implements CronJobExecutionRepositoryInterface
/**
* @return array|CronJobExecution[]
*/
public function findBy(array $criteria, array $orderBy = null, int $limit = null, int $offset = null): array
public function findBy(array $criteria, ?array $orderBy = null, ?int $limit = null, ?int $offset = null): array
{
return $this->repository->findBy($criteria, $orderBy, $limit, $offset);
}

View File

@@ -26,7 +26,7 @@ interface CronJobExecutionRepositoryInterface extends ObjectRepository
/**
* @return array|CronJobExecution[]
*/
public function findBy(array $criteria, array $orderBy = null, int $limit = null, int $offset = null): array;
public function findBy(array $criteria, ?array $orderBy = null, ?int $limit = null, ?int $offset = null): array;
public function findOneBy(array $criteria): ?CronJobExecution;

View File

@@ -49,7 +49,7 @@ final class GeographicalUnitLayerLayerRepository implements GeographicalUnitLaye
/**
* @return array|GeographicalUnitLayer[]
*/
public function findBy(array $criteria, array $orderBy = null, int $limit = null, int $offset = null): array
public function findBy(array $criteria, ?array $orderBy = null, ?int $limit = null, ?int $offset = null): array
{
return $this->repository->findBy($criteria, $orderBy, $limit, $offset);
}

View File

@@ -86,7 +86,7 @@ final class GeographicalUnitRepository implements GeographicalUnitRepositoryInte
->getResult();
}
public function findBy(array $criteria, array $orderBy = null, int $limit = null, int $offset = null): ?GeographicalUnit
public function findBy(array $criteria, ?array $orderBy = null, ?int $limit = null, ?int $offset = null): ?GeographicalUnit
{
return $this->repository->findBy($criteria, $orderBy, $limit, $offset);
}

View File

@@ -44,12 +44,12 @@ final class GroupCenterRepository implements ObjectRepository
*
* @return GroupCenter[]
*/
public function findBy(array $criteria, array $orderBy = null, $limit = null, $offset = null): array
public function findBy(array $criteria, ?array $orderBy = null, $limit = null, $offset = null): array
{
return $this->repository->findBy($criteria, $orderBy, $limit, $offset);
}
public function findOneBy(array $criteria, array $orderBy = null): ?GroupCenter
public function findOneBy(array $criteria, ?array $orderBy = null): ?GroupCenter
{
return $this->repository->findOneBy($criteria, $orderBy);
}

View File

@@ -43,12 +43,12 @@ final class LanguageRepository implements LanguageRepositoryInterface
*
* @return Language[]
*/
public function findBy(array $criteria, array $orderBy = null, $limit = null, $offset = null): array
public function findBy(array $criteria, ?array $orderBy = null, $limit = null, $offset = null): array
{
return $this->repository->findBy($criteria, $orderBy, $limit, $offset);
}
public function findOneBy(array $criteria, array $orderBy = null): ?Language
public function findOneBy(array $criteria, ?array $orderBy = null): ?Language
{
return $this->repository->findOneBy($criteria, $orderBy);
}

View File

@@ -29,9 +29,9 @@ interface LanguageRepositoryInterface extends ObjectRepository
*
* @return Language[]
*/
public function findBy(array $criteria, array $orderBy = null, $limit = null, $offset = null): array;
public function findBy(array $criteria, ?array $orderBy = null, $limit = null, $offset = null): array;
public function findOneBy(array $criteria, array $orderBy = null): ?Language;
public function findOneBy(array $criteria, ?array $orderBy = null): ?Language;
public function getClassName(): string;
}

View File

@@ -194,7 +194,7 @@ final class NotificationRepository implements ObjectRepository
*
* @return Notification[]
*/
public function findBy(array $criteria, array $orderBy = null, $limit = null, $offset = null): array
public function findBy(array $criteria, ?array $orderBy = null, $limit = null, $offset = null): array
{
return $this->repository->findBy($criteria, $orderBy, $limit, $offset);
}
@@ -214,7 +214,7 @@ final class NotificationRepository implements ObjectRepository
->getResult();
}
public function findOneBy(array $criteria, array $orderBy = null): ?Notification
public function findOneBy(array $criteria, ?array $orderBy = null): ?Notification
{
return $this->repository->findOneBy($criteria, $orderBy);
}

View File

@@ -57,12 +57,12 @@ final class PermissionsGroupRepository implements ObjectRepository
*
* @return PermissionsGroup[]
*/
public function findBy(array $criteria, array $orderBy = null, $limit = null, $offset = null): array
public function findBy(array $criteria, ?array $orderBy = null, $limit = null, $offset = null): array
{
return $this->repository->findBy($criteria, $orderBy, $limit, $offset);
}
public function findOneBy(array $criteria, array $orderBy = null): ?PermissionsGroup
public function findOneBy(array $criteria, ?array $orderBy = null): ?PermissionsGroup
{
return $this->repository->findOneBy($criteria, $orderBy);
}

View File

@@ -54,7 +54,7 @@ final class PostalCodeRepository implements PostalCodeRepositoryInterface
return $this->repository->findAll();
}
public function findBy(array $criteria, array $orderBy = null, $limit = null, $offset = null): array
public function findBy(array $criteria, ?array $orderBy = null, $limit = null, $offset = null): array
{
return $this->repository->findBy($criteria, $orderBy, $limit, $offset);
}
@@ -79,7 +79,7 @@ final class PostalCodeRepository implements PostalCodeRepositoryInterface
->getResult();
}
public function findOneBy(array $criteria, array $orderBy = null): ?PostalCode
public function findOneBy(array $criteria, ?array $orderBy = null): ?PostalCode
{
return $this->repository->findOneBy($criteria, $orderBy);
}

View File

@@ -32,11 +32,11 @@ interface PostalCodeRepositoryInterface extends ObjectRepository
*
* @return PostalCode[]
*/
public function findBy(array $criteria, array $orderBy = null, $limit = null, $offset = null): array;
public function findBy(array $criteria, ?array $orderBy = null, $limit = null, $offset = null): array;
public function findByPattern(string $pattern, ?Country $country, ?int $start = 0, ?int $limit = 50): array;
public function findOneBy(array $criteria, array $orderBy = null): ?PostalCode;
public function findOneBy(array $criteria, ?array $orderBy = null): ?PostalCode;
public function getClassName(): string;
}

View File

@@ -51,12 +51,12 @@ final class RegroupmentRepository implements ObjectRepository
*
* @return Regroupment[]
*/
public function findBy(array $criteria, array $orderBy = null, $limit = null, $offset = null): array
public function findBy(array $criteria, ?array $orderBy = null, $limit = null, $offset = null): array
{
return $this->repository->findBy($criteria, $orderBy, $limit, $offset);
}
public function findOneBy(array $criteria, array $orderBy = null): ?Regroupment
public function findOneBy(array $criteria, ?array $orderBy = null): ?Regroupment
{
return $this->repository->findOneBy($criteria, $orderBy);
}

View File

@@ -44,12 +44,12 @@ final class RoleScopeRepository implements ObjectRepository
*
* @return RoleScope[]
*/
public function findBy(array $criteria, array $orderBy = null, $limit = null, $offset = null): array
public function findBy(array $criteria, ?array $orderBy = null, $limit = null, $offset = null): array
{
return $this->repository->findBy($criteria, $orderBy, $limit, $offset);
}
public function findOneBy(array $criteria, array $orderBy = null): ?RoleScope
public function findOneBy(array $criteria, ?array $orderBy = null): ?RoleScope
{
return $this->repository->findOneBy($criteria, $orderBy);
}

View File

@@ -42,12 +42,12 @@ class SavedExportRepository implements SavedExportRepositoryInterface
return $this->repository->findAll();
}
public function findBy(array $criteria, array $orderBy = null, int $limit = null, int $offset = null): array
public function findBy(array $criteria, ?array $orderBy = null, ?int $limit = null, ?int $offset = null): array
{
return $this->repository->findBy($criteria, $orderBy, $limit, $offset);
}
public function findByUser(User $user, ?array $orderBy = [], int $limit = null, int $offset = null): array
public function findByUser(User $user, ?array $orderBy = [], ?int $limit = null, ?int $offset = null): array
{
$qb = $this->repository->createQueryBuilder('se');

View File

@@ -27,12 +27,12 @@ interface SavedExportRepositoryInterface extends ObjectRepository
*/
public function findAll(): array;
public function findBy(array $criteria, array $orderBy = null, int $limit = null, int $offset = null): array;
public function findBy(array $criteria, ?array $orderBy = null, ?int $limit = null, ?int $offset = null): array;
/**
* @return array|SavedExport[]
*/
public function findByUser(User $user, ?array $orderBy = [], int $limit = null, int $offset = null): array;
public function findByUser(User $user, ?array $orderBy = [], ?int $limit = null, ?int $offset = null): array;
public function findOneBy(array $criteria): ?SavedExport;

View File

@@ -58,12 +58,12 @@ final class ScopeRepository implements ScopeRepositoryInterface
*
* @return Scope[]
*/
public function findBy(array $criteria, array $orderBy = null, $limit = null, $offset = null): array
public function findBy(array $criteria, ?array $orderBy = null, $limit = null, $offset = null): array
{
return $this->repository->findBy($criteria, $orderBy, $limit, $offset);
}
public function findOneBy(array $criteria, array $orderBy = null): ?Scope
public function findOneBy(array $criteria, ?array $orderBy = null): ?Scope
{
return $this->repository->findOneBy($criteria, $orderBy);
}

View File

@@ -37,9 +37,9 @@ interface ScopeRepositoryInterface extends ObjectRepository
*
* @return Scope[]
*/
public function findBy(array $criteria, array $orderBy = null, $limit = null, $offset = null): array;
public function findBy(array $criteria, ?array $orderBy = null, $limit = null, $offset = null): array;
public function findOneBy(array $criteria, array $orderBy = null): ?Scope;
public function findOneBy(array $criteria, ?array $orderBy = null): ?Scope;
public function getClassName(): string;
}

View File

@@ -58,7 +58,7 @@ readonly class UserJobRepository implements UserJobRepositoryInterface
*
* @return array|object[]|UserJob[]
*/
public function findBy(array $criteria, array $orderBy = null, $limit = null, $offset = null)
public function findBy(array $criteria, ?array $orderBy = null, $limit = null, $offset = null)
{
return $this->repository->findBy($criteria, $orderBy, $limit, $offset);
}

View File

@@ -41,7 +41,7 @@ interface UserJobRepositoryInterface extends ObjectRepository
*
* @return array|object[]|UserJob[]
*/
public function findBy(array $criteria, array $orderBy = null, $limit = null, $offset = null);
public function findBy(array $criteria, ?array $orderBy = null, $limit = null, $offset = null);
public function findOneBy(array $criteria): ?UserJob;

View File

@@ -164,7 +164,7 @@ final readonly class UserRepository implements UserRepositoryInterface
*
* @return User[]
*/
public function findBy(array $criteria, array $orderBy = null, $limit = null, $offset = null): array
public function findBy(array $criteria, ?array $orderBy = null, $limit = null, $offset = null): array
{
return $this->repository->findBy($criteria, $orderBy, $limit, $offset);
}
@@ -172,7 +172,7 @@ final readonly class UserRepository implements UserRepositoryInterface
/**
* @return array|User[]
*/
public function findByActive(array $orderBy = null, int $limit = null, int $offset = null): array
public function findByActive(?array $orderBy = null, ?int $limit = null, ?int $offset = null): array
{
return $this->findBy(['enabled' => true], $orderBy, $limit, $offset);
}
@@ -182,7 +182,7 @@ final readonly class UserRepository implements UserRepositoryInterface
*
* @return array|User[]
*/
public function findByNotHavingAttribute(string $key, int $limit = null, int $offset = null): array
public function findByNotHavingAttribute(string $key, ?int $limit = null, ?int $offset = null): array
{
$rsm = new ResultSetMappingBuilder($this->entityManager);
$rsm->addRootEntityFromClassMetadata(User::class, 'u');
@@ -200,7 +200,7 @@ final readonly class UserRepository implements UserRepositoryInterface
return $this->entityManager->createNativeQuery($sql, $rsm)->setParameter(':key', $key)->getResult();
}
public function findByUsernameOrEmail(string $pattern, ?array $orderBy = [], int $limit = null, int $offset = null): array
public function findByUsernameOrEmail(string $pattern, ?array $orderBy = [], ?int $limit = null, ?int $offset = null): array
{
$qb = $this->queryByUsernameOrEmail($pattern);
@@ -221,7 +221,7 @@ final readonly class UserRepository implements UserRepositoryInterface
return $qb->getQuery()->getResult();
}
public function findOneBy(array $criteria, array $orderBy = null): ?User
public function findOneBy(array $criteria, ?array $orderBy = null): ?User
{
return $this->repository->findOneBy($criteria, $orderBy);
}

View File

@@ -51,16 +51,16 @@ interface UserRepositoryInterface extends ObjectRepository
/**
* @return array|User[]
*/
public function findByActive(array $orderBy = null, int $limit = null, int $offset = null): array;
public function findByActive(?array $orderBy = null, ?int $limit = null, ?int $offset = null): array;
/**
* Find users which does not have a key on attribute column.
*
* @return array|User[]
*/
public function findByNotHavingAttribute(string $key, int $limit = null, int $offset = null): array;
public function findByNotHavingAttribute(string $key, ?int $limit = null, ?int $offset = null): array;
public function findByUsernameOrEmail(string $pattern, ?array $orderBy = [], int $limit = null, int $offset = null): array;
public function findByUsernameOrEmail(string $pattern, ?array $orderBy = [], ?int $limit = null, ?int $offset = null): array;
public function findOneByUsernameOrEmail(string $pattern): ?User;

View File

@@ -105,12 +105,12 @@ class EntityWorkflowRepository implements ObjectRepository
*
* @return array|EntityWorkflow[]
*/
public function findBy(array $criteria, array $orderBy = null, $limit = null, $offset = null): array
public function findBy(array $criteria, ?array $orderBy = null, $limit = null, $offset = null): array
{
return $this->repository->findBy($criteria, $orderBy, $limit, $offset);
}
public function findByCc(User $user, array $orderBy = null, $limit = null, $offset = null): array
public function findByCc(User $user, ?array $orderBy = null, $limit = null, $offset = null): array
{
$qb = $this->buildQueryByCc($user)->select('ew');
@@ -123,7 +123,7 @@ class EntityWorkflowRepository implements ObjectRepository
return $qb->getQuery()->getResult();
}
public function findByDest(User $user, array $orderBy = null, $limit = null, $offset = null): array
public function findByDest(User $user, ?array $orderBy = null, $limit = null, $offset = null): array
{
$qb = $this->buildQueryByDest($user)->select('ew');
@@ -136,7 +136,7 @@ class EntityWorkflowRepository implements ObjectRepository
return $qb->getQuery()->getResult();
}
public function findByPreviousDestWithoutReaction(User $user, array $orderBy = null, $limit = null, $offset = null): array
public function findByPreviousDestWithoutReaction(User $user, ?array $orderBy = null, $limit = null, $offset = null): array
{
$qb = $this->buildQueryByPreviousDestWithoutReaction($user)->select('ew');
@@ -149,7 +149,7 @@ class EntityWorkflowRepository implements ObjectRepository
return $qb->getQuery()->getResult();
}
public function findByPreviousTransitionned(User $user, array $orderBy = null, $limit = null, $offset = null): array
public function findByPreviousTransitionned(User $user, ?array $orderBy = null, $limit = null, $offset = null): array
{
$qb = $this->buildQueryByPreviousTransitionned($user)->select('ew')->distinct(true);
@@ -162,7 +162,7 @@ class EntityWorkflowRepository implements ObjectRepository
return $qb->getQuery()->getResult();
}
public function findBySubscriber(User $user, array $orderBy = null, $limit = null, $offset = null): array
public function findBySubscriber(User $user, ?array $orderBy = null, $limit = null, $offset = null): array
{
$qb = $this->buildQueryBySubscriber($user)->select('ew');

View File

@@ -27,7 +27,7 @@ class EntityWorkflowStepRepository implements ObjectRepository
$this->repository = $entityManager->getRepository(EntityWorkflowStep::class);
}
public function countUnreadByUser(User $user, array $orderBy = null, $limit = null, $offset = null): int
public function countUnreadByUser(User $user, ?array $orderBy = null, $limit = null, $offset = null): int
{
$qb = $this->buildQueryByUser($user)->select('count(e)');
@@ -44,7 +44,7 @@ class EntityWorkflowStepRepository implements ObjectRepository
return $this->repository->findAll();
}
public function findBy(array $criteria, array $orderBy = null, $limit = null, $offset = null): array
public function findBy(array $criteria, ?array $orderBy = null, $limit = null, $offset = null): array
{
return $this->repository->findBy($criteria, $orderBy, $limit, $offset);
}

View File

@@ -87,7 +87,7 @@ class MenuTwig extends AbstractExtension implements ContainerAwareInterface
return 'chill_menu';
}
public function setContainer(ContainerInterface $container = null)
public function setContainer(?ContainerInterface $container = null)
{
$this->container = $container;
}

View File

@@ -17,7 +17,7 @@ class SearchApiNoQueryException extends \RuntimeException
private readonly array $types;
public function __construct(string $pattern = '', array $types = [], private readonly array $parameters = [], $code = 0, \Throwable $previous = null)
public function __construct(string $pattern = '', array $types = [], private readonly array $parameters = [], $code = 0, ?\Throwable $previous = null)
{
$typesStr = \implode(', ', $types);
$message = "No query for this search: pattern : {$pattern}, types: {$typesStr}";

View File

@@ -61,7 +61,7 @@ class AuthorizationHelper implements AuthorizationHelperInterface
*
* @return User[]
*/
public function findUsersReaching(string $role, array|Center $center, array|Scope $scope = null, bool $onlyEnabled = true): array
public function findUsersReaching(string $role, array|Center $center, array|Scope|null $scope = null, bool $onlyEnabled = true): array
{
return $this->userACLAwareRepository
->findUsersByReachedACL($role, $center, $scope, $onlyEnabled);
@@ -86,7 +86,7 @@ class AuthorizationHelper implements AuthorizationHelperInterface
*
* @return list<Center>
*/
public function getReachableCenters(UserInterface $user, string $role, Scope $scope = null): array
public function getReachableCenters(UserInterface $user, string $role, ?Scope $scope = null): array
{
if (!$user instanceof User) {
return [];

View File

@@ -21,7 +21,7 @@ class AuthorizationHelperForCurrentUser implements AuthorizationHelperForCurrent
{
}
public function getReachableCenters(string $role, Scope $scope = null): array
public function getReachableCenters(string $role, ?Scope $scope = null): array
{
if (!$this->security->getUser() instanceof User) {
return [];

View File

@@ -22,7 +22,7 @@ interface AuthorizationHelperForCurrentUserInterface
*
* @return Center[]
*/
public function getReachableCenters(string $role, Scope $scope = null): array;
public function getReachableCenters(string $role, ?Scope $scope = null): array;
/**
* @param list<Center>|Center $center

View File

@@ -23,7 +23,7 @@ interface AuthorizationHelperInterface
*
* @return list<Center>
*/
public function getReachableCenters(UserInterface $user, string $role, Scope $scope = null): array;
public function getReachableCenters(UserInterface $user, string $role, ?Scope $scope = null): array;
/**
* @param Center|array<Center> $center

View File

@@ -37,7 +37,7 @@ final readonly class ScopeResolverDispatcher
/**
* @return Scope|iterable<Scope>|Scope|null
*/
public function resolveScope(mixed $entity, ?array $options = []): null|iterable|Scope
public function resolveScope(mixed $entity, ?array $options = []): iterable|Scope|null
{
foreach ($this->resolvers as $resolver) {
if ($resolver->supports($entity, $options)) {

View File

@@ -32,7 +32,7 @@ class CommentEmbeddableDocGenNormalizer implements ContextAwareNormalizerInterfa
*
* @throws ExceptionInterface
*/
public function normalize($object, string $format = null, array $context = []): array
public function normalize($object, ?string $format = null, array $context = []): array
{
if (null === $object || $object->isEmpty()) {
return [
@@ -65,7 +65,7 @@ class CommentEmbeddableDocGenNormalizer implements ContextAwareNormalizerInterfa
];
}
public function supportsNormalization($data, string $format = null, array $context = []): bool
public function supportsNormalization($data, ?string $format = null, array $context = []): bool
{
if ('docgen' !== $format) {
return false;

View File

@@ -32,7 +32,7 @@ class EntityWorkflowNormalizer implements NormalizerInterface, NormalizerAwareIn
*
* @return array
*/
public function normalize($object, string $format = null, array $context = [])
public function normalize($object, ?string $format = null, array $context = [])
{
$workflow = $this->registry->get($object, $object->getWorkflowName());
$handler = $this->entityWorkflowManager->getHandler($object);
@@ -50,7 +50,7 @@ class EntityWorkflowNormalizer implements NormalizerInterface, NormalizerAwareIn
];
}
public function supportsNormalization($data, string $format = null): bool
public function supportsNormalization($data, ?string $format = null): bool
{
return $data instanceof EntityWorkflow && 'json' === $format;
}

View File

@@ -28,7 +28,7 @@ class EntityWorkflowStepNormalizer implements NormalizerAwareInterface, Normaliz
/**
* @param EntityWorkflowStep $object
*/
public function normalize($object, string $format = null, array $context = []): array
public function normalize($object, ?string $format = null, array $context = []): array
{
$data = [
'type' => 'entity_workflow_step',
@@ -77,7 +77,7 @@ class EntityWorkflowStepNormalizer implements NormalizerAwareInterface, Normaliz
return $data;
}
public function supportsNormalization($data, string $format = null): bool
public function supportsNormalization($data, ?string $format = null): bool
{
return $data instanceof EntityWorkflowStep && 'json' === $format;
}

View File

@@ -32,7 +32,7 @@ class NotificationNormalizer implements NormalizerAwareInterface, NormalizerInte
*
* @return array|\ArrayObject|bool|float|int|string|void|null
*/
public function normalize($object, string $format = null, array $context = [])
public function normalize($object, ?string $format = null, array $context = [])
{
$entity = $this->entityManager
->getRepository($object->getRelatedEntityClass())
@@ -53,7 +53,7 @@ class NotificationNormalizer implements NormalizerAwareInterface, NormalizerInte
];
}
public function supportsNormalization($data, string $format = null)
public function supportsNormalization($data, ?string $format = null)
{
return $data instanceof Notification && 'json' === $format;
}

View File

@@ -50,7 +50,7 @@ class PhonenumberNormalizer implements ContextAwareNormalizerInterface, Denormal
}
}
public function normalize($object, string $format = null, array $context = []): string
public function normalize($object, ?string $format = null, array $context = []): string
{
if ('docgen' === $format && null === $object) {
return '';
@@ -64,7 +64,7 @@ class PhonenumberNormalizer implements ContextAwareNormalizerInterface, Denormal
return 'libphonenumber\PhoneNumber' === $type;
}
public function supportsNormalization($data, string $format = null, array $context = []): bool
public function supportsNormalization($data, ?string $format = null, array $context = []): bool
{
if ($data instanceof PhoneNumber && 'json' === $format) {
return true;

View File

@@ -22,7 +22,7 @@ class PrivateCommentEmbeddableNormalizer implements NormalizerInterface, Denorma
{
}
public function denormalize($data, string $type, string $format = null, array $context = []): PrivateCommentEmbeddable
public function denormalize($data, string $type, ?string $format = null, array $context = []): PrivateCommentEmbeddable
{
$comment = new PrivateCommentEmbeddable();
@@ -40,12 +40,12 @@ class PrivateCommentEmbeddableNormalizer implements NormalizerInterface, Denorma
return $object->getCommentForUser($this->security->getUser());
}
public function supportsDenormalization($data, string $type, string $format = null): bool
public function supportsDenormalization($data, string $type, ?string $format = null): bool
{
return PrivateCommentEmbeddable::class === $type;
}
public function supportsNormalization($data, string $format = null): bool
public function supportsNormalization($data, ?string $format = null): bool
{
return $data instanceof PrivateCommentEmbeddable;
}

View File

@@ -41,7 +41,7 @@ final readonly class CollateAddressWithReferenceOrPostalCodeCronJob implements C
return 'collate-address';
}
public function run(array $lastExecutionData): null|array
public function run(array $lastExecutionData): array|null
{
$maxId = ($this->collateAddressWithReferenceOrPostalCode)($lastExecutionData[self::LAST_MAX_ID] ?? 0);

View File

@@ -46,7 +46,7 @@ final readonly class RefreshAddressToGeographicalUnitMaterializedViewCronJob imp
return 'refresh-materialized-view-address-to-geog-units';
}
public function run(array $lastExecutionData): null|array
public function run(array $lastExecutionData): array|null
{
$this->connection->executeQuery('REFRESH MATERIALIZED VIEW view_chill_main_address_geographical_unit');

View File

@@ -68,9 +68,9 @@ final class AddressReferenceBaseImporter
string $street,
string $streetNumber,
string $source,
float $lat = null,
float $lon = null,
int $srid = null
?float $lat = null,
?float $lon = null,
?int $srid = null
): void {
if (!$this->isInitialized) {
$this->initialize($source);

View File

@@ -66,7 +66,7 @@ final class GeographicalUnitBaseImporter
string $unitName,
string $unitKey,
string $geomAsWKT,
int $srid = null
?int $srid = null
): void {
$this->initialize();

View File

@@ -26,7 +26,7 @@ class ChillMailer implements MailerInterface
{
}
public function send(RawMessage $message, Envelope $envelope = null): void
public function send(RawMessage $message, ?Envelope $envelope = null): void
{
if ($message instanceof Email) {
$message->subject($this->prefix.$message->getSubject());

View File

@@ -76,7 +76,7 @@ final class FilterOrderHelper
return $this->entityChoices;
}
public function addUserPicker(string $name, string $label = null, array $options = []): self
public function addUserPicker(string $name, ?string $label = null, array $options = []): self
{
$this->userPickers[$name] = ['label' => $label, 'options' => $options];
@@ -99,7 +99,7 @@ final class FilterOrderHelper
return $this;
}
public function addDateRange(string $name, string $label = null, \DateTimeImmutable $from = null, \DateTimeImmutable $to = null): self
public function addDateRange(string $name, ?string $label = null, ?\DateTimeImmutable $from = null, ?\DateTimeImmutable $to = null): self
{
$this->dateRanges[$name] = ['from' => $from, 'to' => $to, 'label' => $label];

View File

@@ -65,7 +65,7 @@ class FilterOrderHelperBuilder
return $this;
}
public function addDateRange(string $name, string $label = null, \DateTimeImmutable $from = null, \DateTimeImmutable $to = null): self
public function addDateRange(string $name, ?string $label = null, ?\DateTimeImmutable $from = null, ?\DateTimeImmutable $to = null): self
{
$this->dateRanges[$name] = ['from' => $from, 'to' => $to, 'label' => $label];
@@ -79,7 +79,7 @@ class FilterOrderHelperBuilder
return $this;
}
public function addUserPicker(string $name, string $label = null, ?array $options = []): self
public function addUserPicker(string $name, ?string $label = null, ?array $options = []): self
{
$this->userPickers[$name] = ['label' => $label, 'options' => $options];

View File

@@ -91,7 +91,7 @@ class JobWithReturn implements CronJobInterface
return 'with-data';
}
public function run(array $lastExecutionData): null|array
public function run(array $lastExecutionData): array|null
{
return ['data' => 'test'];
}

View File

@@ -175,7 +175,7 @@ class JobCanRun implements CronJobInterface
return $this->key;
}
public function run(array $lastExecutionData): null|array
public function run(array $lastExecutionData): array|null
{
return null;
}
@@ -193,7 +193,7 @@ class JobCannotRun implements CronJobInterface
return 'job-b';
}
public function run(array $lastExecutionData): null|array
public function run(array $lastExecutionData): array|null
{
return null;
}

View File

@@ -498,11 +498,11 @@ final class ExportManagerTest extends KernelTestCase
* user 'center a_social' from database.
*/
protected function createExportManager(
LoggerInterface $logger = null,
EntityManagerInterface $em = null,
AuthorizationCheckerInterface $authorizationChecker = null,
AuthorizationHelper $authorizationHelper = null,
UserInterface $user = null,
?LoggerInterface $logger = null,
?EntityManagerInterface $em = null,
?AuthorizationCheckerInterface $authorizationChecker = null,
?AuthorizationHelper $authorizationHelper = null,
?UserInterface $user = null,
array $exports = [],
array $aggregators = [],
array $filters = [],

View File

@@ -102,7 +102,7 @@ class SortExportElementTest extends KernelTestCase
private function makeTranslator(): TranslatorInterface
{
return new class () implements TranslatorInterface {
public function trans(string $id, array $parameters = [], string $domain = null, string $locale = null)
public function trans(string $id, array $parameters = [], ?string $domain = null, ?string $locale = null)
{
return $id;
}

View File

@@ -113,7 +113,7 @@ class NotificationMailerTest extends TestCase
}
private function buildNotificationMailer(
MailerInterface $mailer = null,
?MailerInterface $mailer = null,
): NotificationMailer {
return new NotificationMailer(
$mailer,

View File

@@ -84,7 +84,7 @@ final class DateNormalizerTest extends KernelTestCase
$this->assertFalse($this->buildDateNormalizer()->supportsNormalization(new \DateTime(), 'xml'));
}
private function buildDateNormalizer(string $locale = null): DateNormalizer
private function buildDateNormalizer(?string $locale = null): DateNormalizer
{
$requestStack = $this->prophet->prophesize(RequestStack::class);
$parameterBag = new ParameterBag();

View File

@@ -117,19 +117,19 @@ final class UserNormalizerTest extends TestCase
*
* @throws ExceptionInterface
*/
public function testNormalize(null|User $user, mixed $format, mixed $context, mixed $expected)
public function testNormalize(User|null $user, mixed $format, mixed $context, mixed $expected)
{
$userRender = $this->prophesize(UserRender::class);
$userRender->renderString(Argument::type(User::class), Argument::type('array'))->willReturn($user ? $user->getLabel() : '');
$normalizer = new UserNormalizer($userRender->reveal());
$normalizer->setNormalizer(new class () implements NormalizerInterface {
public function normalize($object, string $format = null, array $context = [])
public function normalize($object, ?string $format = null, array $context = [])
{
return ['context' => $context['docgen:expects'] ?? null];
}
public function supportsNormalization($data, string $format = null)
public function supportsNormalization($data, ?string $format = null)
{
return true;
}

View File

@@ -66,7 +66,7 @@ class DateRangeCovering
$this->minCover = $minCover;
}
public function add(\DateTimeInterface $start, \DateTimeInterface $end = null, $metadata = null): self
public function add(\DateTimeInterface $start, ?\DateTimeInterface $end = null, $metadata = null): self
{
if ($this->computed) {
throw new \LogicException('You cannot add intervals to a computed instance');
@@ -152,7 +152,7 @@ class DateRangeCovering
return \count($this->intersections) > 0;
}
private function addToSequence($timestamp, int $start = null, int $end = null)
private function addToSequence($timestamp, ?int $start = null, ?int $end = null)
{
if (!\array_key_exists($timestamp, $this->sequence)) {
$this->sequence[$timestamp] = ['s' => [], 'e' => []];

View File

@@ -45,7 +45,7 @@ class MetadataExtractor
return $workflowsList;
}
public function buildArrayPresentationForPlace(EntityWorkflow $entityWorkflow, EntityWorkflowStep $step = null): array
public function buildArrayPresentationForPlace(EntityWorkflow $entityWorkflow, ?EntityWorkflowStep $step = null): array
{
$workflow = $this->registry->get($entityWorkflow, $entityWorkflow->getWorkflowName());
$step ??= $entityWorkflow->getCurrentStep();