cs: Second part - ignore test/app subdirectory.

This commit is contained in:
Pol Dellaiera 2021-11-23 14:34:34 +01:00
parent 5f37304796
commit 3ea35682eb
No known key found for this signature in database
GPG Key ID: D476DFE9C67467CA
72 changed files with 326 additions and 365 deletions

View File

@ -15,6 +15,7 @@ $config = require __DIR__ . '/tests/app/vendor/drupol/php-conventions/config/php
$config $config
->getFinder() ->getFinder()
->ignoreDotFiles(false) ->ignoreDotFiles(false)
->notPath('tests/app')
->name(['.php_cs.dist.php']); ->name(['.php_cs.dist.php']);
$rules = $config->getRules(); $rules = $config->getRules();

View File

@ -29,8 +29,7 @@ namespace Chill\MainBundle\DependencyInjection;
public function __construct( public function __construct(
array $widgetFactories = [], array $widgetFactories = [],
ContainerBuilder $containerBuilder ContainerBuilder $containerBuilder
) ) {
{
// we register here widget factories (see below) // we register here widget factories (see below)
$this->setWidgetFactories($widgetFactories); $this->setWidgetFactories($widgetFactories);
// we will need the container builder later... // we will need the container builder later...

View File

@ -50,7 +50,7 @@ class LoadActivity extends AbstractFixture implements OrderedFixtureInterface
foreach ($persons as $person) { foreach ($persons as $person) {
$activityNbr = rand(0, 3); $activityNbr = rand(0, 3);
for ($i = 0; $i < $activityNbr; ++$i ) { for ($i = 0; $i < $activityNbr; ++$i) {
$activity = $this->newRandomActivity($person); $activity = $this->newRandomActivity($person);
if (null !== $activity) { if (null !== $activity) {

View File

@ -56,8 +56,8 @@ class Configuration implements ConfigurationInterface
->cannotBeEmpty() ->cannotBeEmpty()
->validate() ->validate()
->ifTrue(function ($data) { ->ifTrue(function ($data) {
return !is_int($data); return !is_int($data);
})->thenInvalid('The value %s is not a valid integer') })->thenInvalid('The value %s is not a valid integer')
->end() ->end()
->end() ->end()
->scalarNode('label') ->scalarNode('label')

View File

@ -125,24 +125,24 @@ class ActivityType extends AbstractType
$builder->get('socialIssues') $builder->get('socialIssues')
->addModelTransformer(new CallbackTransformer( ->addModelTransformer(new CallbackTransformer(
function (iterable $socialIssuesAsIterable): string { function (iterable $socialIssuesAsIterable): string {
$socialIssueIds = []; $socialIssueIds = [];
foreach ($socialIssuesAsIterable as $value) { foreach ($socialIssuesAsIterable as $value) {
$socialIssueIds[] = $value->getId(); $socialIssueIds[] = $value->getId();
} }
return implode(',', $socialIssueIds); return implode(',', $socialIssueIds);
}, },
function (?string $socialIssuesAsString): array { function (?string $socialIssuesAsString): array {
if (null === $socialIssuesAsString) { if (null === $socialIssuesAsString) {
return []; return [];
} }
return array_map( return array_map(
fn (string $id): ?SocialIssue => $this->om->getRepository(SocialIssue::class)->findOneBy(['id' => (int) $id]), fn (string $id): ?SocialIssue => $this->om->getRepository(SocialIssue::class)->findOneBy(['id' => (int) $id]),
explode(',', $socialIssuesAsString) explode(',', $socialIssuesAsString)
); );
} }
)); ));
} }
@ -151,24 +151,24 @@ class ActivityType extends AbstractType
$builder->get('socialActions') $builder->get('socialActions')
->addModelTransformer(new CallbackTransformer( ->addModelTransformer(new CallbackTransformer(
function (iterable $socialActionsAsIterable): string { function (iterable $socialActionsAsIterable): string {
$socialActionIds = []; $socialActionIds = [];
foreach ($socialActionsAsIterable as $value) { foreach ($socialActionsAsIterable as $value) {
$socialActionIds[] = $value->getId(); $socialActionIds[] = $value->getId();
} }
return implode(',', $socialActionIds); return implode(',', $socialActionIds);
}, },
function (?string $socialActionsAsString): array { function (?string $socialActionsAsString): array {
if (null === $socialActionsAsString) { if (null === $socialActionsAsString) {
return []; return [];
} }
return array_map( return array_map(
fn (string $id): ?SocialAction => $this->om->getRepository(SocialAction::class)->findOneBy(['id' => (int) $id]), fn (string $id): ?SocialAction => $this->om->getRepository(SocialAction::class)->findOneBy(['id' => (int) $id]),
explode(',', $socialActionsAsString) explode(',', $socialActionsAsString)
); );
} }
)); ));
} }
@ -248,20 +248,20 @@ class ActivityType extends AbstractType
$builder->get('persons') $builder->get('persons')
->addModelTransformer(new CallbackTransformer( ->addModelTransformer(new CallbackTransformer(
function (iterable $personsAsIterable): string { function (iterable $personsAsIterable): string {
$personIds = []; $personIds = [];
foreach ($personsAsIterable as $value) { foreach ($personsAsIterable as $value) {
$personIds[] = $value->getId(); $personIds[] = $value->getId();
} }
return implode(',', $personIds); return implode(',', $personIds);
}, },
function (?string $personsAsString): array { function (?string $personsAsString): array {
return array_map( return array_map(
fn (string $id): ?Person => $this->om->getRepository(Person::class)->findOneBy(['id' => (int) $id]), fn (string $id): ?Person => $this->om->getRepository(Person::class)->findOneBy(['id' => (int) $id]),
explode(',', $personsAsString) explode(',', $personsAsString)
); );
} }
)); ));
} }
@ -270,20 +270,20 @@ class ActivityType extends AbstractType
$builder->get('thirdParties') $builder->get('thirdParties')
->addModelTransformer(new CallbackTransformer( ->addModelTransformer(new CallbackTransformer(
function (iterable $thirdpartyAsIterable): string { function (iterable $thirdpartyAsIterable): string {
$thirdpartyIds = []; $thirdpartyIds = [];
foreach ($thirdpartyAsIterable as $value) { foreach ($thirdpartyAsIterable as $value) {
$thirdpartyIds[] = $value->getId(); $thirdpartyIds[] = $value->getId();
} }
return implode(',', $thirdpartyIds); return implode(',', $thirdpartyIds);
}, },
function (?string $thirdpartyAsString): array { function (?string $thirdpartyAsString): array {
return array_map( return array_map(
fn (string $id): ?ThirdParty => $this->om->getRepository(ThirdParty::class)->findOneBy(['id' => (int) $id]), fn (string $id): ?ThirdParty => $this->om->getRepository(ThirdParty::class)->findOneBy(['id' => (int) $id]),
explode(',', $thirdpartyAsString) explode(',', $thirdpartyAsString)
); );
} }
)); ));
} }
@ -303,20 +303,20 @@ class ActivityType extends AbstractType
$builder->get('users') $builder->get('users')
->addModelTransformer(new CallbackTransformer( ->addModelTransformer(new CallbackTransformer(
function (iterable $usersAsIterable): string { function (iterable $usersAsIterable): string {
$userIds = []; $userIds = [];
foreach ($usersAsIterable as $value) { foreach ($usersAsIterable as $value) {
$userIds[] = $value->getId(); $userIds[] = $value->getId();
} }
return implode(',', $userIds); return implode(',', $userIds);
}, },
function (?string $usersAsString): array { function (?string $usersAsString): array {
return array_map( return array_map(
fn (string $id): ?User => $this->om->getRepository(User::class)->findOneBy(['id' => (int) $id]), fn (string $id): ?User => $this->om->getRepository(User::class)->findOneBy(['id' => (int) $id]),
explode(',', $usersAsString) explode(',', $usersAsString)
); );
} }
)); ));
} }

View File

@ -30,8 +30,7 @@ class PersonMenuBuilder implements LocalMenuBuilderInterface
public function __construct( public function __construct(
AuthorizationCheckerInterface $authorizationChecker, AuthorizationCheckerInterface $authorizationChecker,
TranslatorInterface $translator TranslatorInterface $translator
) ) {
{
$this->translator = $translator; $this->translator = $translator;
$this->authorizationChecker = $authorizationChecker; $this->authorizationChecker = $authorizationChecker;
} }

View File

@ -71,8 +71,7 @@ class TranslatableActivityReasonTest extends TypeTestCase
protected function getTranslatableStringHelper( protected function getTranslatableStringHelper(
$locale = 'en', $locale = 'en',
$fallbackLocale = 'en' $fallbackLocale = 'en'
) ) {
{
$prophet = new \Prophecy\Prophet(); $prophet = new \Prophecy\Prophet();
$requestStack = $prophet->prophesize(); $requestStack = $prophet->prophesize();
$request = $prophet->prophesize(); $request = $prophet->prophesize();

View File

@ -26,11 +26,11 @@ use Symfony\Component\Security\Core\Authorization\Voter\VoterInterface;
*/ */
class ActivityVoterTest extends KernelTestCase class ActivityVoterTest extends KernelTestCase
{ {
use PrepareUserTrait;
use PrepareCenterTrait;
use PrepareScopeTrait;
use PreparePersonTrait;
use PrepareActivityTrait; use PrepareActivityTrait;
use PrepareCenterTrait;
use PreparePersonTrait;
use PrepareScopeTrait;
use PrepareUserTrait;
/** /**
* @var \Prophecy\Prophet * @var \Prophecy\Prophet
@ -132,8 +132,7 @@ class ActivityVoterTest extends KernelTestCase
Center $center, Center $center,
$attribute, $attribute,
$message $message
) ) {
{
$token = $this->prepareToken($user); $token = $this->prepareToken($user);
$activity = $this->prepareActivity($scope, $this->preparePerson($center)); $activity = $this->prepareActivity($scope, $this->preparePerson($center));

View File

@ -125,8 +125,8 @@ class Configuration implements ConfigurationInterface
->cannotBeEmpty() ->cannotBeEmpty()
->validate() ->validate()
->ifTrue(function ($data) { ->ifTrue(function ($data) {
return !is_int($data); return !is_int($data);
})->thenInvalid('The value %s is not a valid integer') })->thenInvalid('The value %s is not a valid integer')
->end() ->end()
->end() ->end()
->scalarNode('label') ->scalarNode('label')

View File

@ -201,20 +201,20 @@ class CalendarType extends AbstractType
$builder->get('invites') $builder->get('invites')
->addModelTransformer(new CallbackTransformer( ->addModelTransformer(new CallbackTransformer(
function (iterable $usersAsIterable): string { function (iterable $usersAsIterable): string {
$userIds = []; $userIds = [];
foreach ($usersAsIterable as $value) { foreach ($usersAsIterable as $value) {
$userIds[] = $value->getId(); $userIds[] = $value->getId();
} }
return implode(',', $userIds); return implode(',', $userIds);
}, },
function (?string $usersAsString): array { function (?string $usersAsString): array {
return array_map( return array_map(
fn (string $id): ?Invite => $this->om->getRepository(Invite::class)->findOneBy(['id' => (int) $id]), fn (string $id): ?Invite => $this->om->getRepository(Invite::class)->findOneBy(['id' => (int) $id]),
explode(',', $usersAsString) explode(',', $usersAsString)
); );
} }
)); ));
} }

View File

@ -54,8 +54,7 @@ class CustomFieldChoice extends AbstractCustomField
TranslatorInterface $translator, TranslatorInterface $translator,
TwigEngine $templating, TwigEngine $templating,
TranslatableStringHelper $translatableStringHelper TranslatableStringHelper $translatableStringHelper
) ) {
{
$this->defaultLocales = $translator->getFallbackLocales(); $this->defaultLocales = $translator->getFallbackLocales();
$this->templating = $templating; $this->templating = $templating;
$this->translatableStringHelper = $translatableStringHelper; $this->translatableStringHelper = $translatableStringHelper;

View File

@ -41,8 +41,7 @@ class CustomFieldText extends AbstractCustomField
RequestStack $requestStack, RequestStack $requestStack,
TwigEngine $templating, TwigEngine $templating,
TranslatableStringHelper $translatableStringHelper TranslatableStringHelper $translatableStringHelper
) ) {
{
$this->requestStack = $requestStack; $this->requestStack = $requestStack;
$this->templating = $templating; $this->templating = $templating;
$this->translatableStringHelper = $translatableStringHelper; $this->translatableStringHelper = $translatableStringHelper;

View File

@ -41,8 +41,7 @@ class CustomFieldTitle extends AbstractCustomField
RequestStack $requestStack, RequestStack $requestStack,
TwigEngine $templating, TwigEngine $templating,
TranslatableStringHelper $translatableStringHelper TranslatableStringHelper $translatableStringHelper
) ) {
{
$this->requestStack = $requestStack; $this->requestStack = $requestStack;
$this->templating = $templating; $this->templating = $templating;
$this->translatableStringHelper = $translatableStringHelper; $this->translatableStringHelper = $translatableStringHelper;

View File

@ -25,8 +25,7 @@ class CustomFieldDataTransformer implements DataTransformerInterface
public function __construct( public function __construct(
CustomFieldInterface $customFieldDefinition, CustomFieldInterface $customFieldDefinition,
CustomField $customField CustomField $customField
) ) {
{
$this->customFieldDefinition = $customFieldDefinition; $this->customFieldDefinition = $customFieldDefinition;
$this->customField = $customField; $this->customField = $customField;
} }

View File

@ -39,8 +39,7 @@ class CustomFieldsHelper
public function __construct( public function __construct(
EntityManagerInterface $em, EntityManagerInterface $em,
CustomFieldProvider $provider CustomFieldProvider $provider
) ) {
{
$this->em = $em; $this->em = $em;
$this->provider = $provider; $this->provider = $provider;
} }

View File

@ -137,8 +137,7 @@ class DocGeneratorTemplateController extends AbstractController
public function listTemplateApiAction( public function listTemplateApiAction(
string $entityClassName, string $entityClassName,
DocGeneratorTemplateRepository $templateRepository DocGeneratorTemplateRepository $templateRepository
): Response ): Response {
{
$entities = $templateRepository->findByEntity($entityClassName); $entities = $templateRepository->findByEntity($entityClassName);
$ret = []; $ret = [];

View File

@ -120,7 +120,7 @@ class EventController extends AbstractController
$this->addFlash( $this->addFlash(
'success', 'success',
$this->get('translator') $this->get('translator')
->trans('The event has been sucessfully removed') ->trans('The event has been sucessfully removed')
); );
return $this->redirectToRoute('chill_main_search', [ return $this->redirectToRoute('chill_main_search', [

View File

@ -275,7 +275,7 @@ class ParticipationController extends AbstractController
$this->addFlash( $this->addFlash(
'success', 'success',
$this->get('translator') $this->get('translator')
->trans('The participation has been sucessfully removed') ->trans('The participation has been sucessfully removed')
); );
return $this->redirectToRoute('chill_event__event_show', [ return $this->redirectToRoute('chill_event__event_show', [
@ -551,8 +551,7 @@ class ParticipationController extends AbstractController
Request $request, Request $request,
Participation $participation, Participation $participation,
bool $multiple = false bool $multiple = false
) ) {
{
$em = $this->getDoctrine()->getManager(); $em = $this->getDoctrine()->getManager();
if ($em->contains($participation)) { if ($em->contains($participation)) {
@ -653,8 +652,8 @@ class ParticipationController extends AbstractController
$ignoredParticipations[] = $participation $ignoredParticipations[] = $participation
->getEvent()->getParticipations()->filter( ->getEvent()->getParticipations()->filter(
function (Participation $p) use ($participation) { function (Participation $p) use ($participation) {
return $p->getPerson()->getId() === $participation->getPerson()->getId(); return $p->getPerson()->getId() === $participation->getPerson()->getId();
} }
)->first(); )->first();
} else { } else {
$newParticipations[] = $participation; $newParticipations[] = $participation;

View File

@ -45,8 +45,8 @@ class LoadParticipation extends AbstractFixture implements OrderedFixtureInterfa
->setCenter($center) ->setCenter($center)
->setCircle( ->setCircle(
$this->getReference( $this->getReference(
LoadScopes::$references[array_rand(LoadScopes::$references)] LoadScopes::$references[array_rand(LoadScopes::$references)]
) )
); );
$manager->persist($event); $manager->persist($event);
$events[] = $event; $events[] = $event;

View File

@ -70,20 +70,20 @@ class PickRoleType extends AbstractType
$builder->addEventListener( $builder->addEventListener(
FormEvents::PRE_SET_DATA, FormEvents::PRE_SET_DATA,
function (FormEvent $event) use ($options) { function (FormEvent $event) use ($options) {
if (null === $options['event_type']) { if (null === $options['event_type']) {
$form = $event->getForm(); $form = $event->getForm();
$name = $form->getName(); $name = $form->getName();
$config = $form->getConfig(); $config = $form->getConfig();
$type = $config->getType()->getName(); $type = $config->getType()->getName();
$options = $config->getOptions(); $options = $config->getOptions();
$form->getParent()->add($name, $type, array_replace($options, [ $form->getParent()->add($name, $type, array_replace($options, [
'group_by' => function (Role $r) { 'group_by' => function (Role $r) {
return $this->translatableStringHelper->localize($r->getType()->getName()); return $this->translatableStringHelper->localize($r->getType()->getName());
}, },
])); ]));
} }
} }
); );
} }
} }

View File

@ -74,17 +74,17 @@ class PickStatusType extends AbstractType
$builder->addEventListener( $builder->addEventListener(
FormEvents::PRE_SET_DATA, FormEvents::PRE_SET_DATA,
function (FormEvent $event) { function (FormEvent $event) {
$form = $event->getForm(); $form = $event->getForm();
$name = $form->getName(); $name = $form->getName();
$config = $form->getConfig(); $config = $form->getConfig();
$type = $config->getType()->getName(); $type = $config->getType()->getName();
$options = $config->getOptions(); $options = $config->getOptions();
$form->getParent()->add($name, $type, array_replace($options, [ $form->getParent()->add($name, $type, array_replace($options, [
'group_by' => function (Status $s) { 'group_by' => function (Status $s) {
return $this->translatableStringHelper->localize($s->getType()->getName()); return $this->translatableStringHelper->localize($s->getType()->getName());
}, },
])); ]));
} }
); );
} }
} }

View File

@ -92,8 +92,7 @@ class EventSearch extends AbstractSearch
$limit = 50, $limit = 50,
array $options = [], array $options = [],
$format = 'html' $format = 'html'
) ) {
{
$total = $this->count($terms); $total = $this->count($terms);
$paginator = $this->paginationFactory->create($total); $paginator = $this->paginationFactory->create($total);

View File

@ -235,9 +235,9 @@ class ParticipationControllerTest extends WebTestCase
$this->personsIdsCache = array_merge( $this->personsIdsCache = array_merge(
$this->personsIdsCache, $this->personsIdsCache,
$event->getParticipations()->map( $event->getParticipations()->map(
function ($p) { return $p->getPerson()->getId(); } function ($p) { return $p->getPerson()->getId(); }
) )
->toArray() ->toArray()
); );
// get some random people // get some random people
$person1 = $this->getRandomPerson(); $person1 = $this->getRandomPerson();
@ -476,8 +476,7 @@ class ParticipationControllerTest extends WebTestCase
protected function getRandomEventWithMultipleParticipations( protected function getRandomEventWithMultipleParticipations(
$centerName = 'Center A', $centerName = 'Center A',
$circleName = 'social' $circleName = 'social'
) ) {
{
$event = $this->getRandomEvent($centerName, $circleName); $event = $this->getRandomEvent($centerName, $circleName);
return $event->getParticipations()->count() > 1 ? return $event->getParticipations()->count() > 1 ?

View File

@ -714,8 +714,7 @@ class CRUDController extends AbstractController
int $totalItems, int $totalItems,
PaginatorInterface $paginator, PaginatorInterface $paginator,
?FilterOrderHelper $filterOrder = null ?FilterOrderHelper $filterOrder = null
) ) {
{
$query = $this->queryEntities($action, $request, $paginator, $filterOrder); $query = $this->queryEntities($action, $request, $paginator, $filterOrder);
return $query->getQuery()->getResult(); return $query->getQuery()->getResult();

View File

@ -206,6 +206,7 @@ class ExportController extends AbstractController
* *
* @param string $alias * @param string $alias
* @param array $data the data from previous step. Required for steps 'formatter' and 'generate_formatter' * @param array $data the data from previous step. Required for steps 'formatter' and 'generate_formatter'
* @param mixed $step
* *
* @return \Symfony\Component\Form\Form * @return \Symfony\Component\Form\Form
*/ */

View File

@ -35,8 +35,7 @@ class NotificationController extends AbstractController
NotificationRepository $notificationRepository, NotificationRepository $notificationRepository,
NotificationRenderer $notificationRenderer, NotificationRenderer $notificationRenderer,
PaginatorFactory $paginatorFactory PaginatorFactory $paginatorFactory
) ) {
{
$currentUser = $this->security->getUser(); $currentUser = $this->security->getUser();
$notificationsNbr = $notificationRepository->countAllForAttendee(($currentUser)); $notificationsNbr = $notificationRepository->countAllForAttendee(($currentUser));

View File

@ -358,19 +358,19 @@ class PermissionsGroupController extends AbstractController
usort( usort(
$roleScopes, $roleScopes,
function (RoleScope $a, RoleScope $b) use ($translatableStringHelper) { function (RoleScope $a, RoleScope $b) use ($translatableStringHelper) {
if ($a->getScope() === null) { if ($a->getScope() === null) {
return 1; return 1;
} }
if ($b->getScope() === null) { if ($b->getScope() === null) {
return +1; return +1;
} }
return strcmp( return strcmp(
$translatableStringHelper->localize($a->getScope()->getName()), $translatableStringHelper->localize($a->getScope()->getName()),
$translatableStringHelper->localize($b->getScope()->getName()) $translatableStringHelper->localize($b->getScope()->getName())
); );
} }
); );
// sort role scope by title // sort role scope by title
@ -526,8 +526,7 @@ class PermissionsGroupController extends AbstractController
private function createDeleteRoleScopeForm( private function createDeleteRoleScopeForm(
PermissionsGroup $permissionsGroup, PermissionsGroup $permissionsGroup,
RoleScope $roleScope RoleScope $roleScope
) ) {
{
return $this->createFormBuilder() return $this->createFormBuilder()
->setAction($this->generateUrl( ->setAction($this->generateUrl(
'admin_permissionsgroup_delete_role_scope', 'admin_permissionsgroup_delete_role_scope',
@ -571,12 +570,12 @@ class PermissionsGroupController extends AbstractController
$expandedRoles[$roleScope->getRole()] = $expandedRoles[$roleScope->getRole()] =
array_map( array_map(
function (Role $role) { function (Role $role) {
return $role->getRole(); return $role->getRole();
}, },
$this->roleHierarchy $this->roleHierarchy
->getReachableRoles( ->getReachableRoles(
[new Role($roleScope->getRole())] [new Role($roleScope->getRole())]
) )
); );
} }
} }

View File

@ -51,15 +51,15 @@ class PostalCodeController extends AbstractController
$query = $this->getDoctrine()->getManager() $query = $this->getDoctrine()->getManager()
->createQuery( ->createQuery(
sprintf( sprintf(
'SELECT p.id AS id, p.name AS name, p.code AS code, ' 'SELECT p.id AS id, p.name AS name, p.code AS code, '
. 'country.name AS country_name, ' . 'country.name AS country_name, '
. 'country.countryCode AS country_code ' . 'country.countryCode AS country_code '
. 'FROM %s p ' . 'FROM %s p '
. 'JOIN p.country country ' . 'JOIN p.country country '
. 'WHERE LOWER(p.name) LIKE LOWER(:pattern) OR LOWER(p.code) LIKE LOWER(:pattern) ' . 'WHERE LOWER(p.name) LIKE LOWER(:pattern) OR LOWER(p.code) LIKE LOWER(:pattern) '
. 'ORDER BY code', . 'ORDER BY code',
PostalCode::class PostalCode::class
) )
) )
->setParameter('pattern', '%' . $pattern . '%') ->setParameter('pattern', '%' . $pattern . '%')
->setMaxResults(30); ->setMaxResults(30);

View File

@ -78,8 +78,8 @@ class LoadUsers extends AbstractFixture implements OrderedFixtureInterface, Cont
->setUsername($username) ->setUsername($username)
->setPassword( ->setPassword(
$encoderFactory $encoderFactory
->getEncoder($user) ->getEncoder($user)
->encodePassword('password', $user->getSalt()) ->encodePassword('password', $user->getSalt())
) )
->setEmail(sprintf('%s@chill.social', str_replace(' ', '', $username))); ->setEmail(sprintf('%s@chill.social', str_replace(' ', '', $username)));

View File

@ -36,10 +36,10 @@ class ACLFlagsCompilerPass implements CompilerPassInterface
default: default:
throw new LogicException( throw new LogicException(
sprintf( sprintf(
"This tag 'scope' is not implemented: %s, on service with id %s", "This tag 'scope' is not implemented: %s, on service with id %s",
$tag['scope'], $tag['scope'],
$id $id
) )
); );
} }
} }

View File

@ -47,8 +47,7 @@ class ExportsCompilerPass implements CompilerPassInterface
private function compileAggregators( private function compileAggregators(
Definition $chillManagerDefinition, Definition $chillManagerDefinition,
ContainerBuilder $container ContainerBuilder $container
) ) {
{
$taggedServices = $container->findTaggedServiceIds( $taggedServices = $container->findTaggedServiceIds(
'chill.export_aggregator' 'chill.export_aggregator'
); );
@ -79,8 +78,7 @@ class ExportsCompilerPass implements CompilerPassInterface
private function compileExportElementsProvider( private function compileExportElementsProvider(
Definition $chillManagerDefinition, Definition $chillManagerDefinition,
ContainerBuilder $container ContainerBuilder $container
) ) {
{
$taggedServices = $container->findTaggedServiceIds( $taggedServices = $container->findTaggedServiceIds(
'chill.export_elements_provider' 'chill.export_elements_provider'
); );
@ -111,8 +109,7 @@ class ExportsCompilerPass implements CompilerPassInterface
private function compileExports( private function compileExports(
Definition $chillManagerDefinition, Definition $chillManagerDefinition,
ContainerBuilder $container ContainerBuilder $container
) ) {
{
$taggedServices = $container->findTaggedServiceIds( $taggedServices = $container->findTaggedServiceIds(
'chill.export' 'chill.export'
); );
@ -143,8 +140,7 @@ class ExportsCompilerPass implements CompilerPassInterface
private function compileFilters( private function compileFilters(
Definition $chillManagerDefinition, Definition $chillManagerDefinition,
ContainerBuilder $container ContainerBuilder $container
) ) {
{
$taggedServices = $container->findTaggedServiceIds( $taggedServices = $container->findTaggedServiceIds(
'chill.export_filter' 'chill.export_filter'
); );
@ -175,8 +171,7 @@ class ExportsCompilerPass implements CompilerPassInterface
private function compileFormatters( private function compileFormatters(
Definition $chillManagerDefinition, Definition $chillManagerDefinition,
ContainerBuilder $container ContainerBuilder $container
) ) {
{
$taggedServices = $container->findTaggedServiceIds( $taggedServices = $container->findTaggedServiceIds(
'chill.export_formatter' 'chill.export_formatter'
); );

View File

@ -27,8 +27,7 @@ class Configuration implements ConfigurationInterface
public function __construct( public function __construct(
array $widgetFactories, array $widgetFactories,
ContainerBuilder $containerBuilder ContainerBuilder $containerBuilder
) ) {
{
$this->setWidgetFactories($widgetFactories); $this->setWidgetFactories($widgetFactories);
$this->containerBuilder = $containerBuilder; $this->containerBuilder = $containerBuilder;
} }

View File

@ -36,7 +36,7 @@ abstract class AbstractWidgetFactory implements WidgetFactoryInterface
{ {
return $containerBuilder->getDefinition( return $containerBuilder->getDefinition(
$this $this
->getServiceId($containerBuilder, $place, $order, $config) ->getServiceId($containerBuilder, $place, $order, $config)
); );
} }
} }

View File

@ -120,8 +120,8 @@ class PermissionsGroup
{ {
$roleScopesId = array_map( $roleScopesId = array_map(
function (RoleScope $roleScope) { function (RoleScope $roleScope) {
return $roleScope->getId(); return $roleScope->getId();
}, },
$this->getRoleScopes()->toArray() $this->getRoleScopes()->toArray()
); );
$countedIds = array_count_values($roleScopesId); $countedIds = array_count_values($roleScopesId);

View File

@ -92,8 +92,7 @@ class ExportManager
AuthorizationCheckerInterface $authorizationChecker, AuthorizationCheckerInterface $authorizationChecker,
AuthorizationHelper $authorizationHelper, AuthorizationHelper $authorizationHelper,
TokenStorageInterface $tokenStorage TokenStorageInterface $tokenStorage
) ) {
{
$this->logger = $logger; $this->logger = $logger;
$this->em = $em; $this->em = $em;
$this->authorizationChecker = $authorizationChecker; $this->authorizationChecker = $authorizationChecker;
@ -280,9 +279,9 @@ class ExportManager
if (!is_iterable($result)) { if (!is_iterable($result)) {
throw new UnexpectedValueException( throw new UnexpectedValueException(
sprintf( sprintf(
'The result of the export should be an iterable, %s given', 'The result of the export should be an iterable, %s given',
gettype($result) gettype($result)
) )
); );
} }
@ -602,8 +601,7 @@ class ExportManager
QueryBuilder $qb, QueryBuilder $qb,
$data, $data,
array $center array $center
) ) {
{
$aggregators = $this->retrieveUsedAggregators($data); $aggregators = $this->retrieveUsedAggregators($data);
foreach ($aggregators as $alias => $aggregator) { foreach ($aggregators as $alias => $aggregator) {
@ -626,8 +624,7 @@ class ExportManager
QueryBuilder $qb, QueryBuilder $qb,
$data, $data,
array $centers array $centers
) ) {
{
$filters = $this->retrieveUsedFilters($data); $filters = $this->retrieveUsedFilters($data);
foreach ($filters as $alias => $filter) { foreach ($filters as $alias => $filter) {

View File

@ -55,8 +55,7 @@ class CSVFormatter implements FormatterInterface
public function __construct( public function __construct(
TranslatorInterface $translator, TranslatorInterface $translator,
ExportManager $manager ExportManager $manager
) ) {
{
$this->translator = $translator; $this->translator = $translator;
$this->exportManager = $manager; $this->exportManager = $manager;
} }

View File

@ -102,8 +102,7 @@ trait AppendScopeChoiceTypeTrait
TranslatableStringHelper $translatableStringHelper, TranslatableStringHelper $translatableStringHelper,
ObjectManager $om, ObjectManager $om,
$name = 'scope' $name = 'scope'
) ) {
{
$reachableScopes = $authorizationHelper $reachableScopes = $authorizationHelper
->getReachableScopes($user, $role, $center); ->getReachableScopes($user, $role, $center);
@ -119,21 +118,21 @@ trait AppendScopeChoiceTypeTrait
$builder->addEventListener( $builder->addEventListener(
FormEvents::PRE_SET_DATA, FormEvents::PRE_SET_DATA,
function (FormEvent $event) use ($choices, $name, $dataTransformer, $builder) { function (FormEvent $event) use ($choices, $name, $dataTransformer, $builder) {
$form = $event->getForm(); $form = $event->getForm();
$form->add( $form->add(
$builder $builder
->create( ->create(
$name, $name,
ChoiceType::class, ChoiceType::class,
[ [
'choices' => array_combine(array_values($choices), array_keys($choices)), 'choices' => array_combine(array_values($choices), array_keys($choices)),
'auto_initialize' => false, 'auto_initialize' => false,
] ]
) )
->addModelTransformer($dataTransformer) ->addModelTransformer($dataTransformer)
->getForm() ->getForm()
); );
} }
); );
} }
} }

View File

@ -58,8 +58,7 @@ class PickCenterType extends AbstractType
TokenStorageInterface $tokenStorage, TokenStorageInterface $tokenStorage,
ExportManager $exportManager, ExportManager $exportManager,
AuthorizationHelper $authorizationHelper AuthorizationHelper $authorizationHelper
) ) {
{
$this->exportManager = $exportManager; $this->exportManager = $exportManager;
$this->user = $tokenStorage->getToken()->getUser(); $this->user = $tokenStorage->getToken()->getUser();
$this->authorizationHelper = $authorizationHelper; $this->authorizationHelper = $authorizationHelper;

View File

@ -105,14 +105,14 @@ class UserType extends AbstractType
} else { } else {
$builder->add( $builder->add(
$builder $builder
->create('enabled', ChoiceType::class, [ ->create('enabled', ChoiceType::class, [
'choices' => [ 'choices' => [
'Disabled, the user is not allowed to login' => 0, 'Disabled, the user is not allowed to login' => 0,
'Enabled, the user is active' => 1, 'Enabled, the user is active' => 1,
], ],
'expanded' => false, 'expanded' => false,
'multiple' => false, 'multiple' => false,
]) ])
); );
} }
} }

View File

@ -21,8 +21,7 @@ final class NotificationRenderer
public function __construct( public function __construct(
AccompanyingPeriodNotificationRenderer $accompanyingPeriodNotificationRenderer, AccompanyingPeriodNotificationRenderer $accompanyingPeriodNotificationRenderer,
ActivityNotificationRenderer $activityNotificationRenderer ActivityNotificationRenderer $activityNotificationRenderer
) ) {
{
// TODO configure automatically // TODO configure automatically
// TODO CREER UNE INTERFACE POUR ETRE SUR QUE LES RENDERERS SONT OK // TODO CREER UNE INTERFACE POUR ETRE SUR QUE LES RENDERERS SONT OK

View File

@ -138,8 +138,7 @@ class SearchProvider
$limit = 50, $limit = 50,
array $options = [], array $options = [],
$format = 'html' $format = 'html'
) ) {
{
$terms = $this->parse($pattern); $terms = $this->parse($pattern);
$search = $this->getByName($name); $search = $this->getByName($name);
@ -169,8 +168,7 @@ class SearchProvider
$limit = 50, $limit = 50,
array $options = [], array $options = [],
$format = 'html' $format = 'html'
) ) {
{
$terms = $this->parse($pattern); $terms = $this->parse($pattern);
$results = []; $results = [];

View File

@ -35,6 +35,7 @@ class AddressRender implements ChillEntityRenderInterface
/** /**
* @param Address addr * @param Address addr
* @param mixed $addr
*/ */
public function renderBox($addr, array $options): string public function renderBox($addr, array $options): string
{ {

View File

@ -47,10 +47,10 @@ class FilterOrderHelper
$this->checkboxes[$name] = [ $this->checkboxes[$name] = [
'choices' => $choices, 'default' => $default, 'choices' => $choices, 'default' => $default,
'trans' => array_merge( 'trans' => array_merge(
$trans, $trans,
0 < $missing ? 0 < $missing ?
array_fill(0, $missing, null) : [] array_fill(0, $missing, null) : []
), ),
]; ];
return $this; return $this;

View File

@ -170,9 +170,9 @@ abstract class AbstractFilterTest extends KernelTestCase
} }
$this->assertTrue( $this->assertTrue(
$catalogue->has( $catalogue->has(
$description[0], $description[0],
$description[2] ?? 'messages' $description[2] ?? 'messages'
), ),
sprintf('Test that the message returned by getDescriptionAction is ' sprintf('Test that the message returned by getDescriptionAction is '
. 'present in the catalogue of translations. HINT : check that "%s" ' . 'present in the catalogue of translations. HINT : check that "%s" '
. 'is correctly translated', $description[0]) . 'is correctly translated', $description[0])

View File

@ -230,11 +230,11 @@ class ExportManagerTest extends KernelTestCase
Argument::is(['a' => 'b']) Argument::is(['a' => 'b'])
) )
->will(function () use ($em) { ->will(function () use ($em) {
$qb = $em->createQueryBuilder(); $qb = $em->createQueryBuilder();
return $qb->addSelect('COUNT(user.id) as export') return $qb->addSelect('COUNT(user.id) as export')
->from('ChillMainBundle:User', 'user'); ->from('ChillMainBundle:User', 'user');
}); });
//$export->initiateQuery()->shouldBeCalled(); //$export->initiateQuery()->shouldBeCalled();
$export->supportsModifiers()->willReturn(['foo']); $export->supportsModifiers()->willReturn(['foo']);
$export->requiredRole()->willReturn(new Role('CHILL_STAT_DUMMY')); $export->requiredRole()->willReturn(new Role('CHILL_STAT_DUMMY'));
@ -254,7 +254,7 @@ class ExportManagerTest extends KernelTestCase
Argument::Type('array') Argument::Type('array')
) )
->willReturn(function ($value) { ->willReturn(function ($value) {
switch ($value) { switch ($value) {
case 0: case 0:
case 1: case 1:
return $value; return $value;
@ -264,7 +264,7 @@ class ExportManagerTest extends KernelTestCase
default: throw new RuntimeException(sprintf('The value %s is not valid', $value)); default: throw new RuntimeException(sprintf('The value %s is not valid', $value));
} }
}); });
$export->getQueryKeys(Argument::Type('array'))->willReturn(['export']); $export->getQueryKeys(Argument::Type('array'))->willReturn(['export']);
$export->getTitle()->willReturn('dummy title'); $export->getTitle()->willReturn('dummy title');
@ -294,7 +294,7 @@ class ExportManagerTest extends KernelTestCase
Argument::is([]) Argument::is([])
) )
->willReturn(function ($value) { ->willReturn(function ($value) {
switch ($value) { switch ($value) {
case '_header': return 'foo_header'; case '_header': return 'foo_header';
case 'cat a': return 'label cat a'; case 'cat a': return 'label cat a';
@ -304,7 +304,7 @@ class ExportManagerTest extends KernelTestCase
default: default:
throw new RuntimeException(sprintf('This value (%s) is not valid', $value)); throw new RuntimeException(sprintf('This value (%s) is not valid', $value));
} }
}); });
$aggregator->addRole()->willReturn(null); $aggregator->addRole()->willReturn(null);
//$aggregator->addRole()->shouldBeCalled(); //$aggregator->addRole()->shouldBeCalled();
$exportManager->addAggregator($aggregator->reveal(), 'aggregator_foo'); $exportManager->addAggregator($aggregator->reveal(), 'aggregator_foo');

View File

@ -136,8 +136,7 @@ class PaginatorTest extends KernelTestCase
$itemPerpage, $itemPerpage,
$pageNumber, $pageNumber,
$expectedHasPage $expectedHasPage
) ) {
{
$paginator = $this->generatePaginator($totalItems, $itemPerpage); $paginator = $this->generatePaginator($totalItems, $itemPerpage);
$this->assertEquals($expectedHasPage, $paginator->hasPage($pageNumber)); $this->assertEquals($expectedHasPage, $paginator->hasPage($pageNumber));

View File

@ -30,9 +30,9 @@ use function array_map;
*/ */
class AuthorizationHelperTest extends KernelTestCase class AuthorizationHelperTest extends KernelTestCase
{ {
use PrepareUserTrait;
use PrepareCenterTrait; use PrepareCenterTrait;
use PrepareScopeTrait; use PrepareScopeTrait;
use PrepareUserTrait;
use ProphecyTrait; use ProphecyTrait;
public function setUp() public function setUp()
@ -247,8 +247,7 @@ class AuthorizationHelperTest extends KernelTestCase
Role $role, Role $role,
Center $center, Center $center,
$message $message
) ) {
{
$reachableScopes = $this->getAuthorizationHelper() $reachableScopes = $this->getAuthorizationHelper()
->getReachableScopes($user, $role, $center); ->getReachableScopes($user, $role, $center);

View File

@ -27,8 +27,7 @@ class TestHelper
public static function getAuthenticatedClientOptions( public static function getAuthenticatedClientOptions(
$username = 'center a_social', $username = 'center a_social',
$password = 'password' $password = 'password'
) ) {
{
return [ return [
'PHP_AUTH_USER' => $username, 'PHP_AUTH_USER' => $username,
'PHP_AUTH_PW' => $password, 'PHP_AUTH_PW' => $password,

View File

@ -39,8 +39,7 @@ class RoleScopeScopePresence extends ConstraintValidator
RoleProvider $roleProvider, RoleProvider $roleProvider,
LoggerInterface $logger, LoggerInterface $logger,
TranslatorInterface $translator TranslatorInterface $translator
) ) {
{
$this->roleProvider = $roleProvider; $this->roleProvider = $roleProvider;
$this->logger = $logger; $this->logger = $logger;
$this->translator = $translator; $this->translator = $translator;

View File

@ -616,12 +616,12 @@ final class ImportPeopleFromCSVCommand extends Command
$helper = $this->getHelper('question'); $helper = $this->getHelper('question');
$question = new ChoiceQuestion( $question = new ChoiceQuestion(
sprintf( sprintf(
'Which postal code match the ' 'Which postal code match the '
. 'name "%s" with postal code "%s" ? (default to "%s")', . 'name "%s" with postal code "%s" ? (default to "%s")',
$locality, $locality,
$postalCode, $postalCode,
$names[0] $names[0]
), ),
$names, $names,
0 0
); );
@ -908,11 +908,11 @@ final class ImportPeopleFromCSVCommand extends Command
$this->output->writeln( $this->output->writeln(
sprintf( sprintf(
'You have selected "%s"', 'You have selected "%s"',
is_array($answers[$matchingTableRowAnswer[$selected]]) ? is_array($answers[$matchingTableRowAnswer[$selected]]) ?
implode(',', $answers[$matchingTableRowAnswer[$selected]]) : implode(',', $answers[$matchingTableRowAnswer[$selected]]) :
$answers[$matchingTableRowAnswer[$selected]] $answers[$matchingTableRowAnswer[$selected]]
) )
); );
// recording value in cache // recording value in cache
@ -933,10 +933,10 @@ final class ImportPeopleFromCSVCommand extends Command
$this->logger->debug( $this->logger->debug(
sprintf( sprintf(
"Found value : %s for custom field with question '%s'", "Found value : %s for custom field with question '%s'",
is_array($value) ? implode(',', $value) : $value, is_array($value) ? implode(',', $value) : $value,
$this->helper->localize($cf->getName()) $this->helper->localize($cf->getName())
) )
); );
return $value; return $value;

View File

@ -64,9 +64,9 @@ class AccompanyingCourseWorkController extends AbstractController
$this->addFlash( $this->addFlash(
'error', 'error',
$this->trans->trans( $this->trans->trans(
'accompanying_work.You must add at least ' . 'accompanying_work.You must add at least ' .
'one social issue on accompanying period' 'one social issue on accompanying period'
) )
); );
return $this->redirectToRoute('chill_person_accompanying_course_index', [ return $this->redirectToRoute('chill_person_accompanying_course_index', [

View File

@ -296,7 +296,7 @@ class AccompanyingPeriodController extends AbstractController
->add( ->add(
'error', 'error',
$this->get('translator') $this->get('translator')
->trans('Period not opened : form is invalid') ->trans('Period not opened : form is invalid')
); );
} }
} }

View File

@ -30,7 +30,7 @@ class LoadHouseholdPosition extends Fixture
public function load(ObjectManager $manager) public function load(ObjectManager $manager)
{ {
foreach (self::POSITIONS_DATA as [$name, $share, $allowHolder, foreach (self::POSITIONS_DATA as [$name, $share, $allowHolder,
$ordering, $ref]) { $ordering, $ref, ]) {
$position = (new Position()) $position = (new Position())
->setLabel(['fr' => $name]) ->setLabel(['fr' => $name])
->setAllowHolder($allowHolder) ->setAllowHolder($allowHolder)

View File

@ -857,8 +857,8 @@ class ChillPersonExtension extends Extension implements PrependExtensionInterfac
$container->prependExtensionConfig( $container->prependExtensionConfig(
'chill_custom_fields', 'chill_custom_fields',
['customizables_entities' => [ ['customizables_entities' => [
['class' => 'Chill\PersonBundle\Entity\Person', 'name' => 'PersonEntity'], ['class' => 'Chill\PersonBundle\Entity\Person', 'name' => 'PersonEntity'],
], ],
] ]
); );
} }

View File

@ -45,14 +45,14 @@ class Configuration implements ConfigurationInterface
->defaultValue('P1D') ->defaultValue('P1D')
->validate() ->validate()
->ifTrue(function ($period) { ->ifTrue(function ($period) {
try { try {
$interval = new DateInterval($period); $interval = new DateInterval($period);
} catch (Exception $ex) { } catch (Exception $ex) {
return true; return true;
} }
return false; return false;
}) })
->thenInvalid('Invalid period for birthdate validation : "%s" ' ->thenInvalid('Invalid period for birthdate validation : "%s" '
. 'The parameter should match duration as defined by ISO8601 : ' . 'The parameter should match duration as defined by ISO8601 : '
. 'https://en.wikipedia.org/wiki/ISO_8601#Durations') . 'https://en.wikipedia.org/wiki/ISO_8601#Durations')

View File

@ -197,7 +197,9 @@ class Household
} }
return -1; return -1;
} elseif ($b->getPosition() === null) { }
if ($b->getPosition() === null) {
return 1; return 1;
} }

View File

@ -119,14 +119,14 @@ class AccompanyingPeriodControllerTest extends WebTestCase
$this->assertTrue( $this->assertTrue(
$this->client->getResponse()->isRedirect( $this->client->getResponse()->isRedirect(
'/fr/person/' . $this->person->getId() . '/accompanying-period' '/fr/person/' . $this->person->getId() . '/accompanying-period'
), ),
'the server redirects to /accompanying-period page' 'the server redirects to /accompanying-period page'
); );
$this->assertGreaterThan( $this->assertGreaterThan(
0, 0,
$this->client->followRedirect() $this->client->followRedirect()
->filter('.alert-success')->count(), ->filter('.alert-success')->count(),
"a 'success' element is shown" "a 'success' element is shown"
); );
} }
@ -159,14 +159,14 @@ class AccompanyingPeriodControllerTest extends WebTestCase
$this->assertTrue( $this->assertTrue(
$this->client->getResponse()->isRedirect( $this->client->getResponse()->isRedirect(
'/fr/person/' . $this->person->getId() . '/accompanying-period' '/fr/person/' . $this->person->getId() . '/accompanying-period'
), ),
'the server redirects to /accompanying-period page' 'the server redirects to /accompanying-period page'
); );
$this->assertGreaterThan( $this->assertGreaterThan(
0, 0,
$this->client->followRedirect() $this->client->followRedirect()
->filter('.alert-success')->count(), ->filter('.alert-success')->count(),
"a 'success' element is shown" "a 'success' element is shown"
); );
} }
@ -204,7 +204,7 @@ class AccompanyingPeriodControllerTest extends WebTestCase
$this->assertGreaterThan( $this->assertGreaterThan(
0, 0,
$crawlerResponse $crawlerResponse
->filter('.alert-danger')->count(), ->filter('.alert-danger')->count(),
"an '.alert-danger' element is shown" "an '.alert-danger' element is shown"
); );
} }
@ -473,10 +473,10 @@ class AccompanyingPeriodControllerTest extends WebTestCase
$this->client->request( $this->client->request(
'GET', 'GET',
sprintf( sprintf(
'/fr/person/%d/accompanying-period/%d/re-open', '/fr/person/%d/accompanying-period/%d/re-open',
$this->person->getId(), $this->person->getId(),
$this->person->getOpenedAccompanyingPeriod()->getId() $this->person->getOpenedAccompanyingPeriod()->getId()
) )
); );
$this->assertEquals( $this->assertEquals(
400, 400,

View File

@ -117,15 +117,15 @@ class PersonAddressControllerTest extends WebTestCase
$this->assertEquals( $this->assertEquals(
1, 1,
$crawler $crawler
->filter('div.flash_message.success') ->filter('div.flash_message.success')
->count(), ->count(),
'Asserting that the response page contains a success flash message' 'Asserting that the response page contains a success flash message'
); );
$this->assertEquals( $this->assertEquals(
1, 1,
$crawler $crawler
->filter('td:contains("Rue de la Paix, 50")') ->filter('td:contains("Rue de la Paix, 50")')
->count(), ->count(),
'Asserting that the page contains the new address' 'Asserting that the page contains the new address'
); );
} }
@ -140,7 +140,7 @@ class PersonAddressControllerTest extends WebTestCase
$this->assertEquals( $this->assertEquals(
1, 1,
$crawler->filter('td:contains("Pas d\'adresse renseignée")') $crawler->filter('td:contains("Pas d\'adresse renseignée")')
->count(), ->count(),
"assert that a message say 'no address given'" "assert that a message say 'no address given'"
); );
} }
@ -175,15 +175,15 @@ class PersonAddressControllerTest extends WebTestCase
$this->assertGreaterThan( $this->assertGreaterThan(
0, 0,
$crawler $crawler
->filter('div.flash_message.success') ->filter('div.flash_message.success')
->count(), ->count(),
'Asserting that the response page contains a success flash message' 'Asserting that the response page contains a success flash message'
); );
$this->assertEquals( $this->assertEquals(
1, 1,
$crawler $crawler
->filter('td:contains("Rue du Trou Normand")') ->filter('td:contains("Rue du Trou Normand")')
->count(), ->count(),
'Asserting that the page contains the new address' 'Asserting that the page contains the new address'
); );
} }

View File

@ -26,9 +26,9 @@ use Symfony\Component\Security\Core\Authorization\Voter\VoterInterface;
*/ */
class PersonVoterTest extends KernelTestCase class PersonVoterTest extends KernelTestCase
{ {
use PrepareUserTrait;
use PrepareCenterTrait; use PrepareCenterTrait;
use PrepareScopeTrait; use PrepareScopeTrait;
use PrepareUserTrait;
/** /**
* @var \Prophecy\Prophet * @var \Prophecy\Prophet

View File

@ -22,8 +22,7 @@ class AddAPersonWidget implements WidgetInterface
$place, $place,
array $context, array $context,
array $config array $config
) ) {
{
return $env->render('ChillPersonBundle:Widget:homepage_add_a_person.html.twig'); return $env->render('ChillPersonBundle:Widget:homepage_add_a_person.html.twig');
} }
} }

View File

@ -59,8 +59,7 @@ class LoadCustomFieldsGroup extends AbstractFixture implements OrderedFixtureInt
ObjectManager $manager, ObjectManager $manager,
array $name, array $name,
array $options = [] array $options = []
) ) {
{
echo $name['fr'] . " \n"; echo $name['fr'] . " \n";
$cFGroup = (new CustomFieldsGroup()) $cFGroup = (new CustomFieldsGroup())

View File

@ -38,19 +38,19 @@ class ChillReportExtension extends Extension implements PrependExtensionInterfac
$container->prependExtensionConfig( $container->prependExtensionConfig(
'chill_custom_fields', 'chill_custom_fields',
['customizables_entities' => [ ['customizables_entities' => [
[ [
'class' => 'Chill\ReportBundle\Entity\Report', 'class' => 'Chill\ReportBundle\Entity\Report',
'name' => 'ReportEntity', 'name' => 'ReportEntity',
'options' => [ 'options' => [
'summary_fields' => [ 'summary_fields' => [
'form_type' => LinkedCustomFieldsType::class, 'form_type' => LinkedCustomFieldsType::class,
'form_options' => [ 'form_options' => [
'multiple' => true, 'multiple' => true,
'expanded' => false, 'expanded' => false,
],
], ],
], ], ],
], ], ],
],
] ]
); );
} }

View File

@ -49,8 +49,7 @@ class ReportType extends AbstractType
TokenStorageInterface $tokenStorage, TokenStorageInterface $tokenStorage,
TranslatableStringHelper $translatableStringHelper, TranslatableStringHelper $translatableStringHelper,
ObjectManager $om ObjectManager $om
) ) {
{
$this->authorizationHelper = $helper; $this->authorizationHelper = $helper;
$this->user = $tokenStorage->getToken()->getUser(); $this->user = $tokenStorage->getToken()->getUser();
$this->translatableStringHelper = $translatableStringHelper; $this->translatableStringHelper = $translatableStringHelper;

View File

@ -46,8 +46,7 @@ class ReportSearch extends AbstractSearch implements ContainerAwareInterface
EntityManagerInterface $em, EntityManagerInterface $em,
AuthorizationHelper $helper, AuthorizationHelper $helper,
TokenStorageInterface $tokenStorage TokenStorageInterface $tokenStorage
) ) {
{
$this->em = $em; $this->em = $em;
$this->helper = $helper; $this->helper = $helper;
@ -99,9 +98,9 @@ class ReportSearch extends AbstractSearch implements ContainerAwareInterface
); );
$whereElement->add( $whereElement->add(
$qb->expr()->andX( $qb->expr()->andX(
$qb->expr()->eq('p.center', ':center_' . $i), $qb->expr()->eq('p.center', ':center_' . $i),
$qb->expr()->in('r.scope', ':reachable_scopes_' . $i) $qb->expr()->in('r.scope', ':reachable_scopes_' . $i)
) )
); );
$qb->setParameter('center_' . $i, $center); $qb->setParameter('center_' . $i, $center);
$qb->setParameter('reachable_scopes_' . $i, $reachableScopesId); $qb->setParameter('reachable_scopes_' . $i, $reachableScopesId);

View File

@ -66,8 +66,8 @@ class ReportControllerNextTest extends WebTestCase
$filteredCustomFieldsGroupHouse = array_filter( $filteredCustomFieldsGroupHouse = array_filter(
$customFieldsGroups, $customFieldsGroups,
function (CustomFieldsGroup $group) { function (CustomFieldsGroup $group) {
return in_array('Situation de logement', $group->getName()); return in_array('Situation de logement', $group->getName());
} }
); );
$this->group = $filteredCustomFieldsGroupHouse[0]; $this->group = $filteredCustomFieldsGroupHouse[0];
} }

View File

@ -83,8 +83,8 @@ class ReportControllerTest extends WebTestCase
$filteredCustomFieldsGroupHouse = array_filter( $filteredCustomFieldsGroupHouse = array_filter(
$customFieldsGroups, $customFieldsGroups,
function (CustomFieldsGroup $group) { function (CustomFieldsGroup $group) {
return in_array('Situation de logement', $group->getName()); return in_array('Situation de logement', $group->getName());
} }
); );
static::$group = $filteredCustomFieldsGroupHouse[0]; static::$group = $filteredCustomFieldsGroupHouse[0];
@ -136,7 +136,7 @@ class ReportControllerTest extends WebTestCase
$this->assertGreaterThan( $this->assertGreaterThan(
1, 1,
count($form->get(self::REPORT_NAME_FIELD) count($form->get(self::REPORT_NAME_FIELD)
->availableOptionValues()), ->availableOptionValues()),
'I can choose between report models' 'I can choose between report models'
); );
@ -253,9 +253,9 @@ class ReportControllerTest extends WebTestCase
); );
$this->assertContains( $this->assertContains(
sprintf( sprintf(
'/fr/person/%d/report/select/type/for/creation', '/fr/person/%d/report/select/type/for/creation',
static::$person->getId() static::$person->getId()
), ),
$link->getUri(), $link->getUri(),
'There is a "add a report" link in menu' 'There is a "add a report" link in menu'
); );
@ -334,10 +334,10 @@ class ReportControllerTest extends WebTestCase
$this->assertTrue($client->getResponse()->isRedirect( $this->assertTrue($client->getResponse()->isRedirect(
sprintf( sprintf(
'/fr/person/%s/report/%s/view', '/fr/person/%s/report/%s/view',
static::$person->getId(), static::$person->getId(),
$reportId $reportId
) )
)); ));
$this->assertEquals(new DateTime('yesterday'), static::$kernel->getContainer() $this->assertEquals(new DateTime('yesterday'), static::$kernel->getContainer()
@ -416,8 +416,7 @@ class ReportControllerTest extends WebTestCase
Person $person, Person $person,
CustomFieldsGroup $group, CustomFieldsGroup $group,
\Symfony\Component\BrowserKit\Client $client \Symfony\Component\BrowserKit\Client $client
) ) {
{
$url = sprintf( $url = sprintf(
'fr/person/%d/report/cfgroup/%d/new', 'fr/person/%d/report/cfgroup/%d/new',
$person->getId(), $person->getId(),

View File

@ -25,9 +25,9 @@ use Symfony\Component\Security\Core\Authorization\Voter\VoterInterface;
*/ */
class ReportVoterTest extends KernelTestCase class ReportVoterTest extends KernelTestCase
{ {
use PrepareUserTrait;
use PrepareCenterTrait; use PrepareCenterTrait;
use PrepareScopeTrait; use PrepareScopeTrait;
use PrepareUserTrait;
/** /**
* @var \Prophecy\Prophet * @var \Prophecy\Prophet
@ -131,8 +131,7 @@ class ReportVoterTest extends KernelTestCase
$action, $action,
$message, $message,
?User $user = null ?User $user = null
) ) {
{
$token = $this->prepareToken($user); $token = $this->prepareToken($user);
$result = $this->voter->vote($token, $report, [$action]); $result = $this->voter->vote($token, $report, [$action]);
$this->assertEquals($expectedResult, $result, $message); $this->assertEquals($expectedResult, $result, $message);

View File

@ -62,8 +62,8 @@ class TimelineProviderTest extends WebTestCase
$scopesSocial = array_filter( $scopesSocial = array_filter(
static::$em static::$em
->getRepository('ChillMainBundle:Scope') ->getRepository('ChillMainBundle:Scope')
->findAll(), ->findAll(),
function (Scope $scope) { return $scope->getName()['en'] === 'social'; } function (Scope $scope) { return $scope->getName()['en'] === 'social'; }
); );
@ -104,7 +104,7 @@ class TimelineProviderTest extends WebTestCase
$this->assertEquals( $this->assertEquals(
0, 0,
$crawler->filter('.report_entry .summary') $crawler->filter('.report_entry .summary')
->count(), ->count(),
'the page does not contains a .report .summary element' 'the page does not contains a .report .summary element'
); );
} }
@ -152,19 +152,19 @@ class TimelineProviderTest extends WebTestCase
$this->assertGreaterThan( $this->assertGreaterThan(
0, 0,
$crawler->filter('.report_entry .summary') $crawler->filter('.report_entry .summary')
->count(), ->count(),
'the page contains a .report .summary element' 'the page contains a .report .summary element'
); );
$this->assertContains( $this->assertContains(
'blah blah', 'blah blah',
$crawler->filter('.report_entry .summary') $crawler->filter('.report_entry .summary')
->text(), ->text(),
'the page contains the text "blah blah"' 'the page contains the text "blah blah"'
); );
$this->assertContains( $this->assertContains(
'Propriétaire', 'Propriétaire',
$crawler->filter('.report_entry .summary') $crawler->filter('.report_entry .summary')
->text(), ->text(),
'the page contains the mention "Propriétaire"' 'the page contains the mention "Propriétaire"'
); );
} }

View File

@ -92,8 +92,8 @@ class TaskController extends AbstractController
array_filter( array_filter(
$workflow->getEnabledTransitions($task), $workflow->getEnabledTransitions($task),
function (Transition $t) use ($transition) { function (Transition $t) use ($transition) {
return $t->getName() === $transition; return $t->getName() === $transition;
} }
))[0]; ))[0];
$form = $this->createTransitionForm($task); $form = $this->createTransitionForm($task);

View File

@ -31,8 +31,7 @@ class MenuBuilder implements LocalMenuBuilderInterface
public function __construct( public function __construct(
AuthorizationCheckerInterface $authorizationChecker, AuthorizationCheckerInterface $authorizationChecker,
TranslatorInterface $translator TranslatorInterface $translator
) ) {
{
$this->translator = $translator; $this->translator = $translator;
$this->authorizationChecker = $authorizationChecker; $this->authorizationChecker = $authorizationChecker;
} }

View File

@ -255,8 +255,8 @@ class SingleTaskRepository extends EntityRepository
return $qb->expr()->orX() return $qb->expr()->orX()
->add( ->add(
$qb->expr()->andX() $qb->expr()->andX()
->add($qb->expr()->isNotNull('st.endDate')) ->add($qb->expr()->isNotNull('st.endDate'))
->add($qb->expr()->gt('st.endDate', ':now')) ->add($qb->expr()->gt('st.endDate', ':now'))
) )
->add($qb->expr()->isNull('st.endDate')); ->add($qb->expr()->isNull('st.endDate'));
} }
@ -281,23 +281,23 @@ class SingleTaskRepository extends EntityRepository
return $qb->expr()->andX() return $qb->expr()->andX()
->add( ->add(
$qb->expr()->lte( $qb->expr()->lte(
$qb->expr()->diff('st.endDate', 'st.warningInterval'), $qb->expr()->diff('st.endDate', 'st.warningInterval'),
':now' ':now'
) )
); );
} }
return $qb->expr()->orX() return $qb->expr()->orX()
->add( ->add(
$qb->expr()->andX() $qb->expr()->andX()
->add($qb->expr()->isNotNull('st.endDate')) ->add($qb->expr()->isNotNull('st.endDate'))
->add($qb->expr()->isNotNull('st.warningInterval')) ->add($qb->expr()->isNotNull('st.warningInterval'))
->add( ->add(
$qb->expr()->gt( $qb->expr()->gt(
$qb->expr()->diff('st.endDate', 'st.warningInterval'), $qb->expr()->diff('st.endDate', 'st.warningInterval'),
':now' ':now'
) )
) )
) )
->add($qb->expr()->isNull('st.endDate')) ->add($qb->expr()->isNull('st.endDate'))
->add($qb->expr()->isNull('st.warningInterval')); ->add($qb->expr()->isNull('st.warningInterval'));

View File

@ -32,8 +32,6 @@ class ThirdPartyTypeManager
* Method used during the load of the manager by Dependency Injection * Method used during the load of the manager by Dependency Injection
* *
* @param \Chill\ThirdPartyBundle\ThirdPartyType\ThirdPartyTypeProviderInterface $provider * @param \Chill\ThirdPartyBundle\ThirdPartyType\ThirdPartyTypeProviderInterface $provider
*
* @return self
*/ */
public function addProvider(ThirdPartyTypeProviderInterface $provider): self public function addProvider(ThirdPartyTypeProviderInterface $provider): self
{ {