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
72 changed files with 326 additions and 365 deletions

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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