mirror of
https://gitlab.com/Chill-Projet/chill-bundles.git
synced 2025-10-04 12:29:43 +00:00
Rector changes return typing
This commit is contained in:
@@ -35,7 +35,7 @@ class SetPasswordCommand extends Command
|
||||
parent::__construct();
|
||||
}
|
||||
|
||||
public function _getUser($username)
|
||||
public function _getUser($username): ?object
|
||||
{
|
||||
return $this->entityManager
|
||||
->getRepository(User::class)
|
||||
|
@@ -391,7 +391,7 @@ class ExportController extends AbstractController
|
||||
*
|
||||
* @return Response
|
||||
*/
|
||||
private function selectCentersStep(Request $request, DirectExportInterface|ExportInterface $export, $alias, ExportGeneration|SavedExport|null $savedExport = null)
|
||||
private function selectCentersStep(Request $request, DirectExportInterface|ExportInterface $export, $alias, ExportGeneration|SavedExport|null $savedExport = null): \Symfony\Component\HttpFoundation\RedirectResponse|\Symfony\Component\HttpFoundation\Response
|
||||
{
|
||||
if (!$this->filterStatsByCenters) {
|
||||
return $this->redirectToRoute('chill_main_export_new', [
|
||||
|
@@ -37,7 +37,7 @@ class LocationApiController extends ApiController
|
||||
/**
|
||||
* @param QueryBuilder $query
|
||||
*/
|
||||
protected function orderQuery(string $action, $query, Request $request, PaginatorInterface $paginator, $_format)
|
||||
protected function orderQuery(string $action, $query, Request $request, PaginatorInterface $paginator, $_format): \Doctrine\ORM\QueryBuilder
|
||||
{
|
||||
return $query
|
||||
->addOrderBy('e.name', 'ASC');
|
||||
|
@@ -21,7 +21,7 @@ class Age extends FunctionNode
|
||||
|
||||
private mixed $value2 = null;
|
||||
|
||||
public function getSql(SqlWalker $sqlWalker)
|
||||
public function getSql(SqlWalker $sqlWalker): string
|
||||
{
|
||||
if (null !== $this->value2) {
|
||||
return sprintf(
|
||||
|
@@ -33,7 +33,7 @@ class Extract extends FunctionNode
|
||||
// private FunctionNode $value;
|
||||
// private DateDiffFunction $value;
|
||||
|
||||
public function getSql(SqlWalker $sqlWalker)
|
||||
public function getSql(SqlWalker $sqlWalker): string
|
||||
{
|
||||
return sprintf(
|
||||
'EXTRACT(%s FROM %s)',
|
||||
|
@@ -21,7 +21,7 @@ class GetJsonFieldByKey extends FunctionNode
|
||||
|
||||
private ?\Doctrine\ORM\Query\AST\Node $expr2 = null;
|
||||
|
||||
public function getSql(SqlWalker $sqlWalker)
|
||||
public function getSql(SqlWalker $sqlWalker): string
|
||||
{
|
||||
return sprintf(
|
||||
'(%s->%s)',
|
||||
|
@@ -30,7 +30,7 @@ class Greatest extends FunctionNode
|
||||
*/
|
||||
private array $exprs = [];
|
||||
|
||||
public function getSql(SqlWalker $sqlWalker)
|
||||
public function getSql(SqlWalker $sqlWalker): string
|
||||
{
|
||||
return 'GREATEST('.implode(', ', array_map(static fn (Node $expr) => $expr->dispatch($sqlWalker), $this->exprs)).')';
|
||||
}
|
||||
|
@@ -25,7 +25,7 @@ class JsonAggregate extends FunctionNode
|
||||
{
|
||||
private ?\Doctrine\ORM\Query\AST\Node $expr = null;
|
||||
|
||||
public function getSql(SqlWalker $sqlWalker)
|
||||
public function getSql(SqlWalker $sqlWalker): string
|
||||
{
|
||||
return sprintf('jsonb_agg(%s)', $this->expr->dispatch($sqlWalker));
|
||||
}
|
||||
|
@@ -29,7 +29,7 @@ class JsonBuildObject extends FunctionNode
|
||||
*/
|
||||
private array $exprs = [];
|
||||
|
||||
public function getSql(SqlWalker $sqlWalker)
|
||||
public function getSql(SqlWalker $sqlWalker): string
|
||||
{
|
||||
return 'JSONB_BUILD_OBJECT('.implode(', ', array_map(static fn (Node $expr) => $expr->dispatch($sqlWalker), $this->exprs)).')';
|
||||
}
|
||||
|
@@ -21,7 +21,7 @@ class JsonExtract extends FunctionNode
|
||||
|
||||
private ?\Doctrine\ORM\Query\AST\ArithmeticExpression $keyToExtract = null;
|
||||
|
||||
public function getSql(SqlWalker $sqlWalker)
|
||||
public function getSql(SqlWalker $sqlWalker): string
|
||||
{
|
||||
return sprintf('%s->>%s', $this->element->dispatch($sqlWalker), $this->keyToExtract->dispatch($sqlWalker));
|
||||
}
|
||||
|
@@ -30,7 +30,7 @@ class Least extends FunctionNode
|
||||
*/
|
||||
private array $exprs = [];
|
||||
|
||||
public function getSql(SqlWalker $sqlWalker)
|
||||
public function getSql(SqlWalker $sqlWalker): string
|
||||
{
|
||||
return 'LEAST('.implode(', ', array_map(static fn (Node $expr) => $expr->dispatch($sqlWalker), $this->exprs)).')';
|
||||
}
|
||||
|
@@ -31,7 +31,7 @@ class OverlapsI extends FunctionNode
|
||||
|
||||
private ?\Doctrine\ORM\Query\AST\Node $secondPeriodStart = null;
|
||||
|
||||
public function getSql(\Doctrine\ORM\Query\SqlWalker $sqlWalker)
|
||||
public function getSql(\Doctrine\ORM\Query\SqlWalker $sqlWalker): string
|
||||
{
|
||||
return sprintf(
|
||||
'(%s, %s) OVERLAPS (%s, %s)',
|
||||
|
@@ -22,7 +22,7 @@ class STContains extends FunctionNode
|
||||
|
||||
private ?\Doctrine\ORM\Query\AST\Node $secondPart = null;
|
||||
|
||||
public function getSql(\Doctrine\ORM\Query\SqlWalker $sqlWalker)
|
||||
public function getSql(\Doctrine\ORM\Query\SqlWalker $sqlWalker): string
|
||||
{
|
||||
return 'ST_CONTAINS('.$this->firstPart->dispatch($sqlWalker).
|
||||
', '.$this->secondPart->dispatch($sqlWalker).')';
|
||||
|
@@ -19,7 +19,7 @@ class STX extends FunctionNode
|
||||
{
|
||||
private ?\Doctrine\ORM\Query\AST\ArithmeticExpression $field = null;
|
||||
|
||||
public function getSql(SqlWalker $sqlWalker)
|
||||
public function getSql(SqlWalker $sqlWalker): string
|
||||
{
|
||||
return sprintf('ST_X(%s)', $this->field->dispatch($sqlWalker));
|
||||
}
|
||||
|
@@ -19,7 +19,7 @@ class STY extends FunctionNode
|
||||
{
|
||||
private ?\Doctrine\ORM\Query\AST\ArithmeticExpression $field = null;
|
||||
|
||||
public function getSql(SqlWalker $sqlWalker)
|
||||
public function getSql(SqlWalker $sqlWalker): string
|
||||
{
|
||||
return sprintf('ST_Y(%s)', $this->field->dispatch($sqlWalker));
|
||||
}
|
||||
|
@@ -19,7 +19,7 @@ class Similarity extends FunctionNode
|
||||
|
||||
private ?\Doctrine\ORM\Query\AST\Node $secondPart = null;
|
||||
|
||||
public function getSql(\Doctrine\ORM\Query\SqlWalker $sqlWalker)
|
||||
public function getSql(\Doctrine\ORM\Query\SqlWalker $sqlWalker): string
|
||||
{
|
||||
return 'SIMILARITY('.$this->firstPart->dispatch($sqlWalker).
|
||||
', '.$this->secondPart->dispatch($sqlWalker).')';
|
||||
|
@@ -20,7 +20,7 @@ class StrictWordSimilarityOPS extends \Doctrine\ORM\Query\AST\Functions\Function
|
||||
|
||||
private ?\Doctrine\ORM\Query\AST\Node $secondPart = null;
|
||||
|
||||
public function getSql(SqlWalker $sqlWalker)
|
||||
public function getSql(SqlWalker $sqlWalker): string
|
||||
{
|
||||
return $this->firstPart->dispatch($sqlWalker).
|
||||
' <<% '.$this->secondPart->dispatch($sqlWalker);
|
||||
|
@@ -24,7 +24,7 @@ class ToChar extends FunctionNode
|
||||
|
||||
private \Doctrine\ORM\Query\AST\Node|string|null $fmt = null;
|
||||
|
||||
public function getSql(SqlWalker $sqlWalker)
|
||||
public function getSql(SqlWalker $sqlWalker): string
|
||||
{
|
||||
return sprintf(
|
||||
'TO_CHAR(%s, %s)',
|
||||
|
@@ -17,7 +17,7 @@ final class FlatHierarchyEntityHydrator extends ObjectHydrator
|
||||
{
|
||||
public const LIST = 'chill_flat_hierarchy_list';
|
||||
|
||||
protected function hydrateAllData()
|
||||
protected function hydrateAllData(): array
|
||||
{
|
||||
return array_values(iterator_to_array($this->flatListGenerator($this->buildChildrenHashmap(parent::hydrateAllData()))));
|
||||
}
|
||||
|
@@ -145,7 +145,7 @@ class Notification implements TrackUpdateInterface
|
||||
/**
|
||||
* @deprecated
|
||||
*/
|
||||
public function addAddressesEmail(string $email)
|
||||
public function addAddressesEmail(string $email): void
|
||||
{
|
||||
if (!\in_array($email, $this->addressesEmails, true)) {
|
||||
$this->addressesEmails[] = $email;
|
||||
|
@@ -638,7 +638,7 @@ class User implements UserInterface, \Stringable, PasswordAuthenticatedUserInter
|
||||
return $this->notificationFlags;
|
||||
}
|
||||
|
||||
public function setNotificationFlags(array $notificationFlags)
|
||||
public function setNotificationFlags(array $notificationFlags): void
|
||||
{
|
||||
$this->notificationFlags = $notificationFlags;
|
||||
}
|
||||
|
@@ -266,7 +266,7 @@ final readonly class ExportGenerator
|
||||
*
|
||||
* @param list<Center> $centers
|
||||
*/
|
||||
private function buildCenterReachableScopes(array $centers)
|
||||
private function buildCenterReachableScopes(array $centers): array
|
||||
{
|
||||
return array_map(static fn (Center $center) => ['center' => $center, 'circles' => []], $centers);
|
||||
}
|
||||
|
@@ -136,7 +136,7 @@ class ExportManager
|
||||
*
|
||||
* @internal used by DI
|
||||
*/
|
||||
public function addFormatter(FormatterInterface $formatter, string $alias)
|
||||
public function addFormatter(FormatterInterface $formatter, string $alias): void
|
||||
{
|
||||
$this->formatters[$alias] = $formatter;
|
||||
}
|
||||
|
@@ -107,7 +107,7 @@ class CSVFormatter implements FormatterInterface
|
||||
return $descriptions;
|
||||
}
|
||||
|
||||
public function getName()
|
||||
public function getName(): string|\Symfony\Contracts\Translation\TranslatableInterface
|
||||
{
|
||||
return 'Comma separated values (CSV)';
|
||||
}
|
||||
@@ -140,7 +140,7 @@ class CSVFormatter implements FormatterInterface
|
||||
return $response;
|
||||
}
|
||||
|
||||
public function getType()
|
||||
public function getType(): string
|
||||
{
|
||||
return 'tabular';
|
||||
}
|
||||
|
@@ -101,7 +101,7 @@ final class SpreadSheetFormatter implements FormatterInterface, ExportManagerAwa
|
||||
array $filtersData,
|
||||
array $aggregatorsData,
|
||||
ExportGenerationContext $context,
|
||||
) {
|
||||
): \Chill\MainBundle\Export\FormattedExportGeneration {
|
||||
// Initialize local variables instead of class properties
|
||||
/** @var ExportInterface $export */
|
||||
$export = $this->getExportManager()->getExport($exportAlias);
|
||||
@@ -244,7 +244,7 @@ final class SpreadSheetFormatter implements FormatterInterface, ExportManagerAwa
|
||||
* Add the title to the worksheet and merge the cell containing
|
||||
* the title.
|
||||
*/
|
||||
private function addTitleToWorkSheet(Worksheet &$worksheet, $export)
|
||||
private function addTitleToWorkSheet(Worksheet &$worksheet, $export): void
|
||||
{
|
||||
$worksheet->setCellValue('A1', $this->getTitle($export));
|
||||
$worksheet->mergeCells('A1:G1');
|
||||
@@ -281,7 +281,7 @@ final class SpreadSheetFormatter implements FormatterInterface, ExportManagerAwa
|
||||
array $filtersData,
|
||||
array $aggregatorsData,
|
||||
array $cacheDisplayableResult,
|
||||
) {
|
||||
): void {
|
||||
[$spreadsheet, $worksheet] = $this->createSpreadsheet($export);
|
||||
|
||||
$this->addTitleToWorkSheet($worksheet, $export);
|
||||
|
@@ -195,7 +195,7 @@ class SpreadsheetListFormatter implements FormatterInterface, ExportManagerAware
|
||||
array $filtersData,
|
||||
array $aggregatorsData,
|
||||
ExportGenerationContext $context,
|
||||
) {
|
||||
): \Symfony\Component\HttpFoundation\BinaryFileResponse {
|
||||
$generated = $this->generate($result, $formatterData, $exportAlias, $exportData, $filtersData, $aggregatorsData, $context);
|
||||
|
||||
$response = new BinaryFileResponse($generated->content);
|
||||
|
@@ -36,7 +36,7 @@ final readonly class ExportRequestGenerationMessageHandler implements MessageHan
|
||||
private LoggerInterface $logger,
|
||||
) {}
|
||||
|
||||
public function __invoke(ExportRequestGenerationMessage $exportRequestGenerationMessage)
|
||||
public function __invoke(ExportRequestGenerationMessage $exportRequestGenerationMessage): void
|
||||
{
|
||||
$start = microtime(true);
|
||||
|
||||
|
@@ -41,12 +41,12 @@ class PickUserOrMeDynamicType extends AbstractType
|
||||
private readonly NormalizerInterface $normalizer,
|
||||
) {}
|
||||
|
||||
public function buildForm(FormBuilderInterface $builder, array $options)
|
||||
public function buildForm(FormBuilderInterface $builder, array $options): void
|
||||
{
|
||||
$builder->addViewTransformer(new EntityToJsonTransformer($this->denormalizer, $this->serializer, $options['multiple'], 'user'));
|
||||
}
|
||||
|
||||
public function buildView(FormView $view, FormInterface $form, array $options)
|
||||
public function buildView(FormView $view, FormInterface $form, array $options): void
|
||||
{
|
||||
$view->vars['multiple'] = $options['multiple'];
|
||||
$view->vars['types'] = ['user'];
|
||||
@@ -61,7 +61,7 @@ class PickUserOrMeDynamicType extends AbstractType
|
||||
// $user = /* should come from context */ $options['context'];
|
||||
}
|
||||
|
||||
public function configureOptions(OptionsResolver $resolver)
|
||||
public function configureOptions(OptionsResolver $resolver): void
|
||||
{
|
||||
$resolver
|
||||
->setDefault('multiple', false)
|
||||
|
@@ -19,7 +19,7 @@ use Symfony\Component\OptionsResolver\OptionsResolver;
|
||||
|
||||
class UserProfileType extends AbstractType
|
||||
{
|
||||
public function buildForm(FormBuilderInterface $builder, array $options)
|
||||
public function buildForm(FormBuilderInterface $builder, array $options): void
|
||||
{
|
||||
$builder
|
||||
->add('phonenumber', ChillPhoneNumberType::class, [
|
||||
@@ -32,7 +32,7 @@ class UserProfileType extends AbstractType
|
||||
;
|
||||
}
|
||||
|
||||
public function configureOptions(OptionsResolver $resolver)
|
||||
public function configureOptions(OptionsResolver $resolver): void
|
||||
{
|
||||
$resolver->setDefaults([
|
||||
'data_class' => \Chill\MainBundle\Entity\User::class,
|
||||
|
@@ -74,7 +74,7 @@ class NewsItemRepository implements ObjectRepository
|
||||
return $qb;
|
||||
}
|
||||
|
||||
public function findAllFilteredBySearchTerm(?string $pattern = null)
|
||||
public function findAllFilteredBySearchTerm(?string $pattern = null): mixed
|
||||
{
|
||||
$qb = $this->buildBaseQuery($pattern);
|
||||
$qb
|
||||
@@ -105,7 +105,7 @@ class NewsItemRepository implements ObjectRepository
|
||||
->getResult();
|
||||
}
|
||||
|
||||
public function countAllFilteredBySearchTerm(?string $pattern = null)
|
||||
public function countAllFilteredBySearchTerm(?string $pattern = null): mixed
|
||||
{
|
||||
$qb = $this->buildBaseQuery($pattern);
|
||||
|
||||
@@ -115,7 +115,7 @@ class NewsItemRepository implements ObjectRepository
|
||||
->getSingleScalarResult();
|
||||
}
|
||||
|
||||
public function countCurrentNews()
|
||||
public function countCurrentNews(): mixed
|
||||
{
|
||||
return $this->buildQueryCurrentNews()
|
||||
->select('COUNT(n)')
|
||||
|
@@ -68,7 +68,7 @@ readonly class UserJobRepository implements UserJobRepositoryInterface
|
||||
return $qb->getQuery()->getResult();
|
||||
}
|
||||
|
||||
public function findBy(array $criteria, ?array $orderBy = null, $limit = null, $offset = null)
|
||||
public function findBy(array $criteria, ?array $orderBy = null, $limit = null, $offset = null): array
|
||||
{
|
||||
return $this->repository->findBy($criteria, $orderBy, $limit, $offset);
|
||||
}
|
||||
|
@@ -237,7 +237,7 @@ abstract class AbstractFilterTest extends KernelTestCase
|
||||
}
|
||||
}
|
||||
|
||||
public function testApplyOn()
|
||||
public function testApplyOn(): void
|
||||
{
|
||||
$filter = $this->getFilter();
|
||||
|
||||
|
@@ -35,7 +35,7 @@ final class AddressControllerTest extends \Symfony\Bundle\FrameworkBundle\Test\W
|
||||
/**
|
||||
* @dataProvider generateAddressIds
|
||||
*/
|
||||
public function testDuplicate(int $addressId)
|
||||
public function testDuplicate(int $addressId): void
|
||||
{
|
||||
$this->client = $this->getClientAuthenticated();
|
||||
$this->client->request('POST', "/api/1.0/main/address/{$addressId}/duplicate.json");
|
||||
|
@@ -28,7 +28,7 @@ final class AddressReferenceApiControllerTest extends WebTestCase
|
||||
/**
|
||||
* @dataProvider provideData
|
||||
*/
|
||||
public function testSearch(int $postCodeId, string $pattern)
|
||||
public function testSearch(int $postCodeId, string $pattern): void
|
||||
{
|
||||
$client = $this->getClientAuthenticated();
|
||||
|
||||
|
@@ -55,7 +55,7 @@ class NewsItemControllerTest extends WebTestCase
|
||||
$em->flush();
|
||||
}
|
||||
|
||||
public function testList()
|
||||
public function testList(): void
|
||||
{
|
||||
$client = $this->getClientAuthenticated('admin', 'password');
|
||||
$client->request('GET', '/fr/admin/news_item');
|
||||
@@ -66,7 +66,7 @@ class NewsItemControllerTest extends WebTestCase
|
||||
/**
|
||||
* @dataProvider generateNewsItemIds
|
||||
*/
|
||||
public function testShowSingleItem(NewsItem $newsItem)
|
||||
public function testShowSingleItem(NewsItem $newsItem): void
|
||||
{
|
||||
$client = $this->getClientAuthenticated('admin', 'password');
|
||||
$client->request('GET', "/fr/admin/news_item/{$newsItem->getId()}/view");
|
||||
|
@@ -51,7 +51,7 @@ class NewsItemsHistoryControllerTest extends WebTestCase
|
||||
self::ensureKernelShutdown();
|
||||
}
|
||||
|
||||
public function testList()
|
||||
public function testList(): void
|
||||
{
|
||||
self::ensureKernelShutdown();
|
||||
$client = $this->getClientAuthenticated();
|
||||
@@ -64,7 +64,7 @@ class NewsItemsHistoryControllerTest extends WebTestCase
|
||||
/**
|
||||
* @dataProvider generateNewsItemIds
|
||||
*/
|
||||
public function testShowSingleItem(int $newsItemId)
|
||||
public function testShowSingleItem(int $newsItemId): void
|
||||
{
|
||||
self::ensureKernelShutdown();
|
||||
$client = $this->getClientAuthenticated();
|
||||
|
@@ -27,7 +27,7 @@ final class UserControllerTest extends WebTestCase
|
||||
{
|
||||
use PrepareClientTrait;
|
||||
|
||||
public function testList()
|
||||
public function testList(): void
|
||||
{
|
||||
$client = $this->getClientAuthenticatedAsAdmin();
|
||||
|
||||
@@ -135,7 +135,7 @@ final class UserControllerTest extends WebTestCase
|
||||
yield [$user->getId(), $user->getUsername()];
|
||||
}
|
||||
|
||||
protected function isPasswordValid($username, $password)
|
||||
protected function isPasswordValid($username, $password): void
|
||||
{
|
||||
/** @var \Symfony\Component\PasswordHasher\Hasher\UserPasswordHasher $passwordEncoder */
|
||||
$passwordEncoder = self::getContainer()
|
||||
|
@@ -34,7 +34,7 @@ final class AgeTest extends KernelTestCase
|
||||
/**
|
||||
* @dataProvider generateQueries
|
||||
*/
|
||||
public function testWorking(string $dql, array $args)
|
||||
public function testWorking(string $dql, array $args): void
|
||||
{
|
||||
$dql = $this->entityManager->createQuery($dql)->setMaxResults(3);
|
||||
|
||||
|
@@ -44,7 +44,7 @@ final class NotificationTest extends KernelTestCase
|
||||
$em->flush();
|
||||
}
|
||||
|
||||
public function testAddAddresseeStoreAnUread()
|
||||
public function testAddAddresseeStoreAnUread(): void
|
||||
{
|
||||
$notification = new Notification();
|
||||
$notification->addAddressee($user1 = new User());
|
||||
|
@@ -32,7 +32,7 @@ class RemoveExpiredExportGenerationCronJobTest extends TestCase
|
||||
{
|
||||
use ProphecyTrait;
|
||||
|
||||
public function testCanRunReturnsTrueWhenLastExecutionIsNull()
|
||||
public function testCanRunReturnsTrueWhenLastExecutionIsNull(): void
|
||||
{
|
||||
$clock = new MockClock(new \DateTimeImmutable('2024-06-25 10:00:00'));
|
||||
$repo = $this->prophesize(ExportGenerationRepository::class);
|
||||
@@ -47,7 +47,7 @@ class RemoveExpiredExportGenerationCronJobTest extends TestCase
|
||||
$this->assertTrue($cronJob->canRun(null));
|
||||
}
|
||||
|
||||
public function testCanRunReturnsTrueWhenLastStartIsOlderThan24Hours()
|
||||
public function testCanRunReturnsTrueWhenLastStartIsOlderThan24Hours(): void
|
||||
{
|
||||
$clock = new MockClock(new \DateTimeImmutable('2024-06-25 10:00:00'));
|
||||
$repo = $this->prophesize(ExportGenerationRepository::class);
|
||||
@@ -65,7 +65,7 @@ class RemoveExpiredExportGenerationCronJobTest extends TestCase
|
||||
$this->assertTrue($cronJob->canRun($execution));
|
||||
}
|
||||
|
||||
public function testCanRunReturnsFalseWhenLastStartIsWithin24Hours()
|
||||
public function testCanRunReturnsFalseWhenLastStartIsWithin24Hours(): void
|
||||
{
|
||||
$clock = new MockClock(new \DateTimeImmutable('2024-06-25 10:00:00'));
|
||||
$repo = $this->prophesize(ExportGenerationRepository::class);
|
||||
@@ -83,7 +83,7 @@ class RemoveExpiredExportGenerationCronJobTest extends TestCase
|
||||
$this->assertFalse($cronJob->canRun($execution));
|
||||
}
|
||||
|
||||
public function testRunDispatchesMessagesForExpiredExportsAndReturnsLastDeletion()
|
||||
public function testRunDispatchesMessagesForExpiredExportsAndReturnsLastDeletion(): void
|
||||
{
|
||||
$clock = new MockClock(new \DateTimeImmutable('2024-06-25 11:21:00'));
|
||||
$repo = $this->prophesize(ExportGenerationRepository::class);
|
||||
|
@@ -36,7 +36,7 @@ class ExportDataNormalizerTraitTest extends TestCase
|
||||
return $this->normalizeDoctrineEntity($entity);
|
||||
}
|
||||
|
||||
public function denormalizeEntity(mixed $entity, ObjectRepository $repository)
|
||||
public function denormalizeEntity(mixed $entity, ObjectRepository $repository): object|array
|
||||
{
|
||||
return $this->denormalizeDoctrineEntity($entity, $repository);
|
||||
}
|
||||
|
@@ -54,7 +54,7 @@ class ExportGeneratorTest extends TestCase
|
||||
);
|
||||
}
|
||||
|
||||
public function testGenerateHappyScenario()
|
||||
public function testGenerateHappyScenario(): void
|
||||
{
|
||||
$initialData = ['initial' => 'test'];
|
||||
$fullConfig = [
|
||||
@@ -168,7 +168,7 @@ class ExportGeneratorTest extends TestCase
|
||||
self::assertEquals('text/text', $actual->contentType);
|
||||
}
|
||||
|
||||
public function testGenerateNativeSqlHappyScenario()
|
||||
public function testGenerateNativeSqlHappyScenario(): void
|
||||
{
|
||||
$initialData = ['initial' => 'test'];
|
||||
$fullConfig = [
|
||||
@@ -241,7 +241,7 @@ class ExportGeneratorTest extends TestCase
|
||||
self::assertEquals('text/text', $actual->contentType);
|
||||
}
|
||||
|
||||
public function testGenerateDirectExportHappyScenario()
|
||||
public function testGenerateDirectExportHappyScenario(): void
|
||||
{
|
||||
$initialData = ['initial' => 'test'];
|
||||
$fullConfig = [
|
||||
@@ -295,7 +295,7 @@ class ExportGeneratorTest extends TestCase
|
||||
self::assertEquals('text/text', $actual->contentType);
|
||||
}
|
||||
|
||||
public function testGenerateHappyScenarioWithoutCenterFiltering()
|
||||
public function testGenerateHappyScenarioWithoutCenterFiltering(): void
|
||||
{
|
||||
$initialData = ['initial' => 'test'];
|
||||
$fullConfig = [
|
||||
|
@@ -64,7 +64,7 @@ final class ExportManagerTest extends KernelTestCase
|
||||
$this->prophet->checkPredictions();
|
||||
}
|
||||
|
||||
public function testAggregatorsApplyingOn()
|
||||
public function testAggregatorsApplyingOn(): void
|
||||
{
|
||||
$centers = [$center = new Center()];
|
||||
$user = $this->prepareUser([]);
|
||||
@@ -125,7 +125,7 @@ final class ExportManagerTest extends KernelTestCase
|
||||
$this->assertEquals(0, \count($obtained));
|
||||
}
|
||||
|
||||
public function testFiltersApplyingOn()
|
||||
public function testFiltersApplyingOn(): void
|
||||
{
|
||||
$centers = [$center = new Center()];
|
||||
$user = $this->prepareUser([]);
|
||||
@@ -172,7 +172,7 @@ final class ExportManagerTest extends KernelTestCase
|
||||
$this->assertEquals(0, \count($obtained));
|
||||
}
|
||||
|
||||
public function testFormattersByTypes()
|
||||
public function testFormattersByTypes(): void
|
||||
{
|
||||
$exportManager = $this->createExportManager();
|
||||
|
||||
@@ -192,7 +192,7 @@ final class ExportManagerTest extends KernelTestCase
|
||||
$this->assertNotContains($formatterBar->reveal(), $obtained);
|
||||
}
|
||||
|
||||
public function testIsGrantedForElementWithExportAndUserIsGranted()
|
||||
public function testIsGrantedForElementWithExportAndUserIsGranted(): void
|
||||
{
|
||||
$center = $this->prepareCenter(100, 'center A');
|
||||
$user = $this->prepareUser([]);
|
||||
@@ -220,7 +220,7 @@ final class ExportManagerTest extends KernelTestCase
|
||||
$this->assertTrue($result);
|
||||
}
|
||||
|
||||
public function testIsGrantedForElementWithExportAndUserIsGrantedNotForAllCenters()
|
||||
public function testIsGrantedForElementWithExportAndUserIsGrantedNotForAllCenters(): void
|
||||
{
|
||||
$center = $this->prepareCenter(100, 'center A');
|
||||
$centerB = $this->prepareCenter(102, 'center B');
|
||||
@@ -250,7 +250,7 @@ final class ExportManagerTest extends KernelTestCase
|
||||
$this->assertFalse($result);
|
||||
}
|
||||
|
||||
public function testIsGrantedForElementWithExportEmptyCenters()
|
||||
public function testIsGrantedForElementWithExportEmptyCenters(): void
|
||||
{
|
||||
$user = $this->prepareUser([]);
|
||||
|
||||
@@ -271,7 +271,7 @@ final class ExportManagerTest extends KernelTestCase
|
||||
$this->assertFalse($result);
|
||||
}
|
||||
|
||||
public function testIsGrantedForElementWithModifierFallbackToExport()
|
||||
public function testIsGrantedForElementWithModifierFallbackToExport(): void
|
||||
{
|
||||
$center = $this->prepareCenter(100, 'center A');
|
||||
$centerB = $this->prepareCenter(102, 'center B');
|
||||
@@ -309,7 +309,7 @@ final class ExportManagerTest extends KernelTestCase
|
||||
$this->assertFalse($result);
|
||||
}
|
||||
|
||||
public function testNonExistingFormatter()
|
||||
public function testNonExistingFormatter(): void
|
||||
{
|
||||
$this->expectException(\RuntimeException::class);
|
||||
|
||||
@@ -486,7 +486,7 @@ class DummyExport implements ExportInterface
|
||||
return $this->role;
|
||||
}
|
||||
|
||||
public function supportsModifiers()
|
||||
public function supportsModifiers(): array
|
||||
{
|
||||
return $this->supportedModifiers;
|
||||
}
|
||||
|
@@ -30,7 +30,7 @@ class RemoveExportGenerationMessageHandlerTest extends TestCase
|
||||
{
|
||||
use ProphecyTrait;
|
||||
|
||||
public function testInvokeUpdatesDeleteAtAndRemovesAndFlushes()
|
||||
public function testInvokeUpdatesDeleteAtAndRemovesAndFlushes(): void
|
||||
{
|
||||
// Arrange
|
||||
|
||||
|
@@ -108,7 +108,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): string
|
||||
{
|
||||
return $id;
|
||||
}
|
||||
|
@@ -103,7 +103,7 @@ final class PageTest extends KernelTestCase
|
||||
];
|
||||
}
|
||||
|
||||
public function testPageNumber()
|
||||
public function testPageNumber(): void
|
||||
{
|
||||
$page = $this->generatePage(1);
|
||||
|
||||
|
@@ -34,7 +34,7 @@ final class PaginatorTest extends KernelTestCase
|
||||
$this->prophet = new \Prophecy\Prophet();
|
||||
}
|
||||
|
||||
public function testGetPage()
|
||||
public function testGetPage(): void
|
||||
{
|
||||
$paginator = $this->generatePaginator(105, 10);
|
||||
|
||||
@@ -184,7 +184,7 @@ final class PaginatorTest extends KernelTestCase
|
||||
];
|
||||
}
|
||||
|
||||
public function testPagesGenerator()
|
||||
public function testPagesGenerator(): void
|
||||
{
|
||||
$paginator = $this->generatePaginator(105, 10);
|
||||
|
||||
|
@@ -28,7 +28,7 @@ final class PhonenumberHelperTest extends KernelTestCase
|
||||
/**
|
||||
* @dataProvider formatPhonenumbers
|
||||
*/
|
||||
public function testFormatPhonenumbers(string $defaultCarrierCode, string $phoneNumber, string $expected)
|
||||
public function testFormatPhonenumbers(string $defaultCarrierCode, string $phoneNumber, string $expected): void
|
||||
{
|
||||
$util = PhoneNumberUtil::getInstance();
|
||||
$subject = new PhonenumberHelper(
|
||||
|
@@ -25,7 +25,7 @@ final class ExtractPhonenumberFromPatternTest extends KernelTestCase
|
||||
/**
|
||||
* @dataProvider provideData
|
||||
*/
|
||||
public function testExtract(string $defaultCarrierCode, mixed $subject, mixed $expectedCount, mixed $expected, mixed $filteredSubject, mixed $msg)
|
||||
public function testExtract(string $defaultCarrierCode, mixed $subject, mixed $expectedCount, mixed $expected, mixed $filteredSubject, mixed $msg): void
|
||||
{
|
||||
$extractor = new ExtractPhonenumberFromPattern(new ParameterBag(['chill_main' => [
|
||||
'phone_helper' => ['default_carrier_code' => $defaultCarrierCode],
|
||||
|
@@ -48,7 +48,7 @@ final class AuthorizationHelperTest extends KernelTestCase
|
||||
/**
|
||||
* @group legacy
|
||||
*/
|
||||
public function testGetParentRoles()
|
||||
public function testGetParentRoles(): void
|
||||
{
|
||||
$parentRoles = $this->getAuthorizationHelper()
|
||||
->getParentRoles('CHILL_INHERITED_ROLE_1');
|
||||
@@ -63,7 +63,7 @@ final class AuthorizationHelperTest extends KernelTestCase
|
||||
/**
|
||||
* @dataProvider dataProvider_getReachableCenters
|
||||
*/
|
||||
public function testGetReachableCenters(mixed $test, mixed $result, mixed $msg)
|
||||
public function testGetReachableCenters(mixed $test, mixed $result, mixed $msg): void
|
||||
{
|
||||
$this->assertEquals($test, $result, $msg);
|
||||
}
|
||||
@@ -179,7 +179,7 @@ final class AuthorizationHelperTest extends KernelTestCase
|
||||
string $role,
|
||||
Center $center,
|
||||
$message,
|
||||
) {
|
||||
): void {
|
||||
$reachableScopes = $this->getAuthorizationHelper()
|
||||
->getReachableScopes($user, $role, $center);
|
||||
|
||||
@@ -245,7 +245,7 @@ final class AuthorizationHelperTest extends KernelTestCase
|
||||
];
|
||||
}
|
||||
|
||||
public function testtestUserHasAccessUserShouldHaveAccessEntityWithScope()
|
||||
public function testtestUserHasAccessUserShouldHaveAccessEntityWithScope(): void
|
||||
{
|
||||
$center = $this->prepareCenter(1, 'center');
|
||||
$scope = $this->prepareScope(1, 'default');
|
||||
|
@@ -35,7 +35,7 @@ final class DateNormalizerTest extends KernelTestCase
|
||||
/**
|
||||
* @dataProvider generateDataNormalize
|
||||
*/
|
||||
public function testNormalize(mixed $expected, mixed $date, mixed $format, mixed $locale, mixed $msg)
|
||||
public function testNormalize(mixed $expected, mixed $date, mixed $format, mixed $locale, mixed $msg): void
|
||||
{
|
||||
$this->assertEquals($expected, $this->buildDateNormalizer($locale)->normalize($date, $format, []), $msg);
|
||||
}
|
||||
@@ -71,7 +71,7 @@ final class DateNormalizerTest extends KernelTestCase
|
||||
];
|
||||
}
|
||||
|
||||
public function testSupports()
|
||||
public function testSupports(): void
|
||||
{
|
||||
$this->assertTrue($this->buildDateNormalizer()->supportsNormalization(new \DateTime(), 'json'));
|
||||
$this->assertTrue($this->buildDateNormalizer()->supportsNormalization(new \DateTimeImmutable(), 'json'));
|
||||
|
@@ -38,7 +38,7 @@ final class DoctrineExistingEntityNormalizerTest extends KernelTestCase
|
||||
/**
|
||||
* @dataProvider dataProviderUserId
|
||||
*/
|
||||
public function testGetMappedClass(mixed $userId)
|
||||
public function testGetMappedClass(mixed $userId): void
|
||||
{
|
||||
$data = ['type' => 'user', 'id' => $userId];
|
||||
$supports = $this->normalizer->supportsDenormalization($data, User::class);
|
||||
|
@@ -43,7 +43,7 @@ final class UserNormalizerTest extends TestCase
|
||||
*
|
||||
* @throws ExceptionInterface
|
||||
*/
|
||||
public function testNormalize(?User $user, mixed $format, mixed $context, mixed $expected)
|
||||
public function testNormalize(?User $user, mixed $format, mixed $context, mixed $expected): void
|
||||
{
|
||||
$userRender = $this->prophesize(UserRender::class);
|
||||
$userRender->renderString(Argument::type(User::class), Argument::type('array'))->willReturn($user ? $user->getLabel() : '');
|
||||
@@ -52,12 +52,12 @@ final class UserNormalizerTest extends TestCase
|
||||
|
||||
$normalizer = new UserNormalizer($userRender->reveal(), $clock);
|
||||
$normalizer->setNormalizer(new class () implements NormalizerInterface {
|
||||
public function normalize($object, ?string $format = null, array $context = [])
|
||||
public function normalize($object, ?string $format = null, array $context = []): string|int|float|bool|\ArrayObject|array|null
|
||||
{
|
||||
return ['context' => $context['docgen:expects'] ?? null];
|
||||
}
|
||||
|
||||
public function supportsNormalization($data, ?string $format = null)
|
||||
public function supportsNormalization($data, ?string $format = null): bool
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
@@ -28,7 +28,7 @@ final class RollingDateConverterTest extends TestCase
|
||||
return new RollingDateConverter(new MockClock($pivot));
|
||||
}
|
||||
|
||||
public function testConversionFixedDate()
|
||||
public function testConversionFixedDate(): void
|
||||
{
|
||||
$rollingDate = new RollingDate(RollingDate::T_FIXED_DATE, new \DateTimeImmutable('2022-01-01'));
|
||||
|
||||
@@ -69,7 +69,7 @@ final class RollingDateConverterTest extends TestCase
|
||||
/**
|
||||
* @dataProvider generateDataConversionDate
|
||||
*/
|
||||
public function testConvertOnClock(string $roll, string $expectedDateTime, string $format)
|
||||
public function testConvertOnClock(string $roll, string $expectedDateTime, string $format): void
|
||||
{
|
||||
$pivot = \DateTimeImmutable::createFromFormat('Y-m-d His', '2022-11-07 000000');
|
||||
$rollingDate = new RollingDate($roll, null);
|
||||
|
@@ -120,7 +120,7 @@ class EntityWorkflowGuardUnsignedTransitionTest extends TestCase
|
||||
/**
|
||||
* @dataProvider guardWaitingForSignatureWithPermissionToApplyAllTransitionsProvider
|
||||
*/
|
||||
public function testGuardWaitingForSignatureWithPermissionToApplyAllTransitions(EntityWorkflow $entityWorkflow, string $transition, bool $expectIsGranted, string $message)
|
||||
public function testGuardWaitingForSignatureWithPermissionToApplyAllTransitions(EntityWorkflow $entityWorkflow, string $transition, bool $expectIsGranted, string $message): void
|
||||
{
|
||||
$chillEntityRender = $this->prophesize(ChillEntityRenderManagerInterface::class);
|
||||
$chillEntityRender->renderString(Argument::type('object'), Argument::type('array'))->will(fn ($args) => spl_object_hash($args[0]));
|
||||
|
@@ -60,7 +60,7 @@ class TimelineBuilder
|
||||
*
|
||||
* @return \Doctrine\DBAL\Driver\Statement|mixed|null
|
||||
*/
|
||||
public function countItems($context, array $args)
|
||||
public function countItems($context, array $args): mixed
|
||||
{
|
||||
$rsm = (new ResultSetMapping())
|
||||
->addScalarResult('total', 'total', Types::INTEGER);
|
||||
|
Reference in New Issue
Block a user