mirror of
https://gitlab.com/Chill-Projet/chill-bundles.git
synced 2025-07-03 15:36:14 +00:00
cs: Enable a couple of risky rules.
This commit is contained in:
parent
acc4647346
commit
f531cdc0ec
@ -22,14 +22,14 @@ $rules = $config->getRules();
|
||||
|
||||
$riskyRules = [
|
||||
'final_internal_class' => false,
|
||||
'no_useless_sprintf' => false,
|
||||
// 'no_useless_sprintf' => false,
|
||||
'dir_constant' => false,
|
||||
'no_alias_functions' => false,
|
||||
'implode_call' => false,
|
||||
// 'no_alias_functions' => false,
|
||||
// 'implode_call' => false,
|
||||
'combine_nested_dirname' => false,
|
||||
'pow_to_exponentiation' => false,
|
||||
// 'pow_to_exponentiation' => false,
|
||||
'comment_to_phpdoc' => false,
|
||||
'no_unset_on_property' => false,
|
||||
// 'no_unset_on_property' => false,
|
||||
'strict_param' => false,
|
||||
'native_constant_invocation' => false,
|
||||
'php_unit_test_annotation' => false,
|
||||
@ -39,19 +39,19 @@ $riskyRules = [
|
||||
'is_null' => false,
|
||||
'native_function_invocation' => false,
|
||||
'ternary_to_elvis_operator' => false,
|
||||
'no_trailing_whitespace_in_string' => false,
|
||||
// 'no_trailing_whitespace_in_string' => false,
|
||||
'no_unreachable_default_argument_value' => false,
|
||||
'php_unit_test_case_static_method_calls' => false,
|
||||
'strict_comparison' => false,
|
||||
'array_push' => false,
|
||||
// 'array_push' => false,
|
||||
'ereg_to_preg' => false,
|
||||
'error_suppression' => false,
|
||||
'fopen_flag_order' => false,
|
||||
'fopen_flags' => false,
|
||||
'logical_operators' => false,
|
||||
// 'logical_operators' => false,
|
||||
'modernize_types_casting' => false,
|
||||
'no_homoglyph_names' => false,
|
||||
'no_unneeded_final_method' => false,
|
||||
// 'no_unneeded_final_method' => false,
|
||||
'non_printable_character' => false,
|
||||
'ordered_traits' => false,
|
||||
'php_unit_mock_short_will_return' => false,
|
||||
|
@ -9,6 +9,6 @@ parameters:
|
||||
tasks.license.holder: Champs-Libres
|
||||
tasks.license.date_from: 2001
|
||||
|
||||
tasks.phpcsfixer.allow_risky: false
|
||||
tasks.phpcsfixer.allow_risky: true
|
||||
tasks.phpcsfixer.diff: true
|
||||
tasks.phpstan.level: 1
|
||||
|
@ -72,7 +72,7 @@ class ActivityReasonAggregator implements AggregatorInterface, ExportElementVali
|
||||
array_key_exists('activity', $join)
|
||||
&& !$this->checkJoinAlreadyDefined($join['activity'], 'reasons')
|
||||
)
|
||||
or (!array_key_exists('activity', $join))
|
||||
|| (!array_key_exists('activity', $join))
|
||||
) {
|
||||
$qb->add(
|
||||
'join',
|
||||
|
@ -152,7 +152,7 @@ class TimelineActivityProvider implements TimelineProviderInterface
|
||||
$associationMapping = $metadataActivity->getAssociationMapping('person');
|
||||
$role = new Role('CHILL_ACTIVITY_SEE');
|
||||
$reachableScopes = $this->helper->getReachableScopes($this->user, $role->getRole(), $person->getCenter());
|
||||
$whereClause = sprintf(' {activity.person_id} = ? AND {activity.scope_id} IN ({scopes_ids}) ');
|
||||
$whereClause = ' {activity.person_id} = ? AND {activity.scope_id} IN ({scopes_ids}) ';
|
||||
$scopes_ids = [];
|
||||
|
||||
// first parameter: activity.person_id
|
||||
|
@ -35,7 +35,7 @@ class Version20160222103457 extends AbstractMigration
|
||||
|
||||
// try to keep at least on activity reason...
|
||||
$this->addSql(
|
||||
'UPDATE activity
|
||||
'UPDATE activity
|
||||
SET reason_id=rid
|
||||
FROM (
|
||||
SELECT activity_id AS aid, MIN(activityreason_id) AS rid
|
||||
|
@ -111,7 +111,7 @@ abstract class AbstractElementController extends Controller
|
||||
|
||||
$form->handleRequest($request);
|
||||
|
||||
if ($form->isSubmitted() and $form->isValid()) {
|
||||
if ($form->isSubmitted() && $form->isValid()) {
|
||||
$em = $this->getDoctrine()->getManager();
|
||||
$em->flush();
|
||||
|
||||
@ -146,7 +146,7 @@ abstract class AbstractElementController extends Controller
|
||||
|
||||
$form->handleRequest($request);
|
||||
|
||||
if ($form->isSubmitted() and $form->isValid()) {
|
||||
if ($form->isSubmitted() && $form->isValid()) {
|
||||
$em = $this->getDoctrine()->getManager();
|
||||
$em->persist($element);
|
||||
$em->flush();
|
||||
|
@ -63,7 +63,7 @@ class BudgetElementVoter extends AbstractChillVoter implements ProvideRoleHierar
|
||||
protected function supports($attribute, $subject)
|
||||
{
|
||||
return (in_array($attribute, self::ROLES) && $subject instanceof AbstractElement)
|
||||
or ($subject instanceof Person && in_array($attribute, [self::SHOW, self::CREATE]));
|
||||
|| ($subject instanceof Person && in_array($attribute, [self::SHOW, self::CREATE]));
|
||||
}
|
||||
|
||||
protected function voteOnAttribute($attribute, $subject, \Symfony\Component\Security\Core\Authentication\Token\TokenInterface $token)
|
||||
|
@ -160,7 +160,7 @@ class CalendarController extends AbstractController
|
||||
return $this->redirectToRoute('chill_calendar_calendar_list', $params);
|
||||
}
|
||||
|
||||
if ($form->isSubmitted() and !$form->isValid()) {
|
||||
if ($form->isSubmitted() && !$form->isValid()) {
|
||||
$this->addFlash('error', $this->get('translator')->trans('This form contains errors'));
|
||||
}
|
||||
|
||||
@ -272,7 +272,7 @@ class CalendarController extends AbstractController
|
||||
return $this->redirectToRoute('chill_calendar_calendar_list', $params);
|
||||
}
|
||||
|
||||
if ($form->isSubmitted() and !$form->isValid()) {
|
||||
if ($form->isSubmitted() && !$form->isValid()) {
|
||||
$this->addFlash('error', $this->get('translator')->trans('This form contains errors'));
|
||||
}
|
||||
|
||||
|
@ -24,7 +24,7 @@ class CalendarRangeAPIController extends ApiController
|
||||
{
|
||||
$em = $this->getDoctrine()->getManager();
|
||||
|
||||
$sql = 'SELECT c FROM ChillCalendarBundle:CalendarRange c
|
||||
$sql = 'SELECT c FROM ChillCalendarBundle:CalendarRange c
|
||||
WHERE NOT EXISTS (SELECT cal.id FROM ChillCalendarBundle:Calendar cal WHERE cal.calendarRange = c.id)';
|
||||
|
||||
if ($request->query->has('user')) {
|
||||
|
@ -197,7 +197,7 @@ class CreateFieldsOnGroupCommand extends Command
|
||||
$em->persist($cf);
|
||||
$output->writeln('<info>Adding Custom Field of type '
|
||||
. $cf->getType() . "\t with slug " . $cf->getSlug() .
|
||||
"\t and names : " . implode($names, ', ') . '</info>');
|
||||
"\t and names : " . implode(', ', $names) . '</info>');
|
||||
} else {
|
||||
throw new RuntimeException('Error in field ' . $slug);
|
||||
}
|
||||
|
@ -15,6 +15,6 @@ abstract class AbstractCustomField implements CustomFieldInterface
|
||||
{
|
||||
public function isEmptyValue($value, CustomField $customField)
|
||||
{
|
||||
return empty($value) and false !== $value;
|
||||
return empty($value) && false !== $value;
|
||||
}
|
||||
}
|
||||
|
@ -191,7 +191,7 @@ class CustomFieldChoice extends AbstractCustomField
|
||||
if ($this->allowOtherChoice($cf)) {
|
||||
$labels = $cf->getOptions()[self::OTHER_VALUE_LABEL];
|
||||
|
||||
if (!is_array($labels) or count($labels) === 0) {
|
||||
if (!is_array($labels) || count($labels) === 0) {
|
||||
$labels['back'] = 'other value';
|
||||
}
|
||||
$choices['_other'] = $this->translatableStringHelper
|
||||
|
@ -59,7 +59,7 @@ class CustomFieldNumber extends AbstractCustomField
|
||||
$options = $customField->getOptions();
|
||||
|
||||
//select the type depending to the SCALE
|
||||
$type = (0 === $options[self::SCALE] or null === $options[self::SCALE]) ?
|
||||
$type = (0 === $options[self::SCALE] || null === $options[self::SCALE]) ?
|
||||
IntegerType::class : NumberType::class;
|
||||
//'integer' : 'number';
|
||||
|
||||
|
@ -63,7 +63,7 @@ class CustomFieldText extends AbstractCustomField
|
||||
$attrArray = [];
|
||||
|
||||
if (array_key_exists(self::MULTIPLE_CF_INLINE, $options)
|
||||
and $options[self::MULTIPLE_CF_INLINE]) {
|
||||
&& $options[self::MULTIPLE_CF_INLINE]) {
|
||||
$attrArray['class'] = 'multiple-cf-inline';
|
||||
}
|
||||
|
||||
|
@ -104,7 +104,7 @@ class CustomFieldsGroup
|
||||
|
||||
foreach ($this->customFields as $cf) {
|
||||
if ($cf->isActive()) {
|
||||
array_push($this->activeCustomFields, $cf);
|
||||
$this->activeCustomFields[] = $cf;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -43,12 +43,10 @@ class CustomFieldsGroupToIdTransformer implements DataTransformerInterface
|
||||
|
||||
if ($id instanceof CustomFieldsGroup) {
|
||||
throw new TransformationFailedException(
|
||||
sprintf(
|
||||
'The transformation failed: the expected argument on '
|
||||
'The transformation failed: the expected argument on '
|
||||
. 'reverseTransform is an object of type int,'
|
||||
. 'Chill\CustomFieldsBundle\Entity\CustomFieldsGroup, '
|
||||
. 'given'
|
||||
)
|
||||
);
|
||||
}
|
||||
|
||||
|
@ -33,7 +33,7 @@ class HouseholdMemberSelectionContext implements DocGeneratorContextInterface
|
||||
|
||||
$persons = $entity->getAccompanyingPeriodWork()->getPersons();
|
||||
|
||||
if (sizeof($persons) > 0) {
|
||||
if (count($persons) > 0) {
|
||||
$firstPerson = $persons[0];
|
||||
|
||||
$datas['setValues'][] = [
|
||||
|
@ -101,7 +101,7 @@ class DocumentAccompanyingCourseController extends AbstractController
|
||||
);
|
||||
}
|
||||
|
||||
if ($form->isSubmitted() and !$form->isValid()) {
|
||||
if ($form->isSubmitted() && !$form->isValid()) {
|
||||
$this->addFlash('error', $this->translator->trans('This form contains errors'));
|
||||
}
|
||||
|
||||
@ -179,7 +179,7 @@ class DocumentAccompanyingCourseController extends AbstractController
|
||||
return $this->redirectToRoute('accompanying_course_document_index', ['course' => $course->getId()]);
|
||||
}
|
||||
|
||||
if ($form->isSubmitted() and !$form->isValid()) {
|
||||
if ($form->isSubmitted() && !$form->isValid()) {
|
||||
$this->addFlash('error', $this->translator->trans('This form contains errors'));
|
||||
}
|
||||
|
||||
|
@ -121,7 +121,7 @@ class DocumentPersonController extends AbstractController
|
||||
);
|
||||
}
|
||||
|
||||
if ($form->isSubmitted() and !$form->isValid()) {
|
||||
if ($form->isSubmitted() && !$form->isValid()) {
|
||||
$this->addFlash('error', $this->translator->trans('This form contains errors'));
|
||||
}
|
||||
|
||||
@ -222,7 +222,7 @@ class DocumentPersonController extends AbstractController
|
||||
return $this->redirectToRoute('person_document_index', ['person' => $person->getId()]);
|
||||
}
|
||||
|
||||
if ($form->isSubmitted() and !$form->isValid()) {
|
||||
if ($form->isSubmitted() && !$form->isValid()) {
|
||||
$this->addFlash('error', $this->translator->trans('This form contains errors'));
|
||||
}
|
||||
|
||||
|
@ -742,7 +742,7 @@ class ParticipationController extends AbstractController
|
||||
$single = $request->query->has('person_id');
|
||||
$multiple = $request->query->has('persons_ids');
|
||||
|
||||
if (true === $single and true === $multiple) {
|
||||
if (true === $single && true === $multiple) {
|
||||
// we are not allowed to have both person_id and persons_ids
|
||||
throw new RuntimeException("You are not allow to provide both 'person_id' and "
|
||||
. "'persons_ids' simulaneously");
|
||||
|
@ -135,7 +135,7 @@ class EventSearch extends AbstractSearch
|
||||
|
||||
public function supports($domain, $format)
|
||||
{
|
||||
return 'event' === $domain or 'events' === $domain;
|
||||
return 'event' === $domain || 'events' === $domain;
|
||||
}
|
||||
|
||||
protected function composeQuery(QueryBuilder &$qb, $terms)
|
||||
@ -171,8 +171,8 @@ class EventSearch extends AbstractSearch
|
||||
}
|
||||
|
||||
if (
|
||||
(isset($terms['name']) or isset($terms['_default']))
|
||||
and (!empty($terms['name']) or !empty($terms['_default']))) {
|
||||
(isset($terms['name']) || isset($terms['_default']))
|
||||
&& (!empty($terms['name']) || !empty($terms['_default']))) {
|
||||
// the form with name:"xyz" has precedence
|
||||
$name = $terms['name'] ?? $terms['_default'];
|
||||
|
||||
|
@ -63,7 +63,7 @@ class FamilyMemberVoter extends AbstractChillVoter implements ProvideRoleHierarc
|
||||
protected function supports($attribute, $subject)
|
||||
{
|
||||
return (in_array($attribute, self::ROLES) && $subject instanceof FamilyMember)
|
||||
or ($subject instanceof Person && in_array($attribute, [self::SHOW, self::CREATE]));
|
||||
|| ($subject instanceof Person && in_array($attribute, [self::SHOW, self::CREATE]));
|
||||
}
|
||||
|
||||
protected function voteOnAttribute($attribute, $subject, \Symfony\Component\Security\Core\Authentication\Token\TokenInterface $token)
|
||||
|
@ -99,11 +99,11 @@ class LoadAndUpdateLanguagesCommand extends Command
|
||||
$excludeCode = (
|
||||
(
|
||||
!$input->getOption(self::INCLUDE_REGIONAL_VERSION)
|
||||
and strpos($code, '_')
|
||||
and !in_array($code, $this->regionalVersionToInclude)
|
||||
) or (
|
||||
&& strpos($code, '_')
|
||||
&& !in_array($code, $this->regionalVersionToInclude)
|
||||
) || (
|
||||
!$input->getOption(self::INCLUDE_ANCIENT)
|
||||
and in_array($code, $this->ancientToExclude)
|
||||
&& in_array($code, $this->ancientToExclude)
|
||||
)
|
||||
);
|
||||
|
||||
|
@ -222,20 +222,20 @@ class ExportController extends AbstractController
|
||||
'csrf_protection' => $isGenerate ? false : true,
|
||||
]);
|
||||
|
||||
if ('centers' === $step or 'generate_centers' === $step) {
|
||||
if ('centers' === $step || 'generate_centers' === $step) {
|
||||
$builder->add('centers', PickCenterType::class, [
|
||||
'export_alias' => $alias,
|
||||
]);
|
||||
}
|
||||
|
||||
if ('export' === $step or 'generate_export' === $step) {
|
||||
if ('export' === $step || 'generate_export' === $step) {
|
||||
$builder->add('export', ExportType::class, [
|
||||
'export_alias' => $alias,
|
||||
'picked_centers' => $exportManager->getPickedCenters($data['centers']),
|
||||
]);
|
||||
}
|
||||
|
||||
if ('formatter' === $step or 'generate_formatter' === $step) {
|
||||
if ('formatter' === $step || 'generate_formatter' === $step) {
|
||||
$builder->add('formatter', FormatterType::class, [
|
||||
'formatter_alias' => $exportManager
|
||||
->getFormatterAlias($data['export']),
|
||||
@ -388,7 +388,7 @@ class ExportController extends AbstractController
|
||||
$dataFormatter = $this->session->get('formatter_step_raw', null);
|
||||
$dataExport = $this->session->get('export_step_raw', null);
|
||||
|
||||
if (null === $dataFormatter and $export instanceof \Chill\MainBundle\Export\ExportInterface) {
|
||||
if (null === $dataFormatter && $export instanceof \Chill\MainBundle\Export\ExportInterface) {
|
||||
return $this->redirectToRoute('chill_main_export_new', [
|
||||
'alias' => $alias, 'step' => $this->getNextStep('generate', $export, true),
|
||||
]);
|
||||
|
@ -57,7 +57,7 @@ class LoadPostalCodes extends AbstractFixture implements OrderedFixtureInterface
|
||||
1315,INCOURT,BE
|
||||
1315,INCOURT,BE
|
||||
1315,INCOURT,BE
|
||||
1320,BEAUVECHAIN,BE
|
||||
1320,BEAUVECHAIN,BE
|
||||
EOF;
|
||||
|
||||
private static $postalCodeFrance = <<<'EOF'
|
||||
@ -322,7 +322,7 @@ class LoadPostalCodes extends AbstractFixture implements OrderedFixtureInterface
|
||||
85770,L ILE D ELLE,FR,85111,46.3334258655,-0.919100677098,INSEE
|
||||
85800,ST GILLES CROIX DE VIE,FR,85222,46.6904708814,-1.91946363327,INSEE
|
||||
85800,LE FENOUILLER,FR,85088,46.7161264566,-1.89206667498,INSEE
|
||||
85800,GIVRAND,FR,85100,46.6822701061,-1.8787272243,INSEE
|
||||
85800,GIVRAND,FR,85100,46.6822701061,-1.8787272243,INSEE
|
||||
EOF;
|
||||
|
||||
public function getOrder()
|
||||
|
@ -353,8 +353,8 @@ class User implements AdvancedUserInterface
|
||||
public function removeGroupCenter(GroupCenter $groupCenter)
|
||||
{
|
||||
if ($this->groupCenters->removeElement($groupCenter) === false) {
|
||||
throw new RuntimeException(sprintf('The groupCenter could not be removed, '
|
||||
. 'it seems not to be associated with the user. Aborting.'));
|
||||
throw new RuntimeException('The groupCenter could not be removed, '
|
||||
. 'it seems not to be associated with the user. Aborting.');
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -346,7 +346,7 @@ class ExportManager
|
||||
|
||||
foreach ($this->exports as $export) {
|
||||
if (!in_array($export->getType(), $existingTypes)) {
|
||||
array_push($existingTypes, $export->getType());
|
||||
$existingTypes[] = $export->getType();
|
||||
}
|
||||
}
|
||||
|
||||
@ -675,7 +675,7 @@ class ExportManager
|
||||
|
||||
foreach ($this->retrieveUsedAggregators($data) as $alias => $aggregator) {
|
||||
if (!in_array($aggregator->applyOn(), $usedTypes)) {
|
||||
array_push($usedTypes, $aggregator->applyOn());
|
||||
$usedTypes[] = $aggregator->applyOn();
|
||||
}
|
||||
}
|
||||
|
||||
@ -718,7 +718,7 @@ class ExportManager
|
||||
$filter = $this->getFilter($alias);
|
||||
|
||||
if (!in_array($filter->applyOn(), $usedTypes)) {
|
||||
array_push($usedTypes, $filter->applyOn());
|
||||
$usedTypes[] = $filter->applyOn();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -210,7 +210,7 @@ class Paginator implements PaginatorInterface
|
||||
public function hasPage($number)
|
||||
{
|
||||
return 0 < $number
|
||||
and $this->countPages() >= $number;
|
||||
&& $this->countPages() >= $number;
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -42,7 +42,7 @@ class UserProvider implements UserProviderInterface
|
||||
->getSingleResult();
|
||||
} catch (NoResultException $e) {
|
||||
throw new UsernameNotFoundException(
|
||||
sprintf('Bad credentials.'),
|
||||
'Bad credentials.',
|
||||
0,
|
||||
$e
|
||||
);
|
||||
|
@ -57,7 +57,7 @@ class DiscriminatedObjectDenormalizer implements ContextAwareDenormalizerInterfa
|
||||
}
|
||||
|
||||
if (0 === count($context[self::ALLOWED_TYPES] ?? [])) {
|
||||
throw new LogicException('The context should contains a list of
|
||||
throw new LogicException('The context should contains a list of
|
||||
allowed types');
|
||||
}
|
||||
|
||||
|
@ -109,7 +109,7 @@ abstract class AbstractAggregatorTest extends KernelTestCase
|
||||
$this->assertGreaterThanOrEqual(
|
||||
$nbOfFrom,
|
||||
$query->getDQLPart('from') !== null ? count($query->getDQLPart('from')) : 0,
|
||||
"Test that there are equal or more 'from' clause after that the filter has
|
||||
"Test that there are equal or more 'from' clause after that the filter has
|
||||
altered the query"
|
||||
);
|
||||
$this->assertGreaterThanOrEqual(
|
||||
|
@ -99,7 +99,7 @@ abstract class AbstractFilterTest extends KernelTestCase
|
||||
$this->assertGreaterThanOrEqual(
|
||||
$nbOfFrom,
|
||||
$query->getDQLPart('from') !== null ? count($query->getDQLPart('from')) : 0,
|
||||
"Test that there are equal or more 'from' clause after that the filter has
|
||||
"Test that there are equal or more 'from' clause after that the filter has
|
||||
altered the query"
|
||||
);
|
||||
$this->assertGreaterThanOrEqual(
|
||||
|
@ -68,7 +68,7 @@ final class Version20180709181423 extends AbstractMigration
|
||||
CREATE TRIGGER canonicalize_user_on_update
|
||||
AFTER UPDATE
|
||||
ON users
|
||||
FOR EACH ROW
|
||||
FOR EACH ROW
|
||||
EXECUTE PROCEDURE canonicalize_user_on_update();
|
||||
SQL
|
||||
);
|
||||
@ -91,7 +91,7 @@ final class Version20180709181423 extends AbstractMigration
|
||||
CREATE TRIGGER canonicalize_user_on_insert
|
||||
AFTER INSERT
|
||||
ON users
|
||||
FOR EACH ROW
|
||||
FOR EACH ROW
|
||||
EXECUTE PROCEDURE canonicalize_user_on_insert();
|
||||
SQL
|
||||
);
|
||||
|
@ -28,7 +28,7 @@ final class Version20180911093642 extends AbstractMigration
|
||||
CREATE TRIGGER canonicalize_user_on_update
|
||||
AFTER UPDATE
|
||||
ON users
|
||||
FOR EACH ROW
|
||||
FOR EACH ROW
|
||||
EXECUTE PROCEDURE canonicalize_user_on_update();
|
||||
SQL
|
||||
);
|
||||
@ -43,7 +43,7 @@ final class Version20180911093642 extends AbstractMigration
|
||||
CREATE TRIGGER canonicalize_user_on_update
|
||||
AFTER UPDATE
|
||||
ON users
|
||||
FOR EACH ROW
|
||||
FOR EACH ROW
|
||||
WHEN (pg_trigger_depth() = 0)
|
||||
EXECUTE PROCEDURE canonicalize_user_on_update();
|
||||
SQL
|
||||
|
@ -141,7 +141,7 @@ class HouseholdApiController extends ApiController
|
||||
|
||||
foreach ($allHouseholds as $h) {
|
||||
if ($h !== $currentHouseholdPerson) {
|
||||
array_push($households, $h);
|
||||
$households[] = $h;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -192,7 +192,7 @@ class HouseholdController extends AbstractController
|
||||
|
||||
$form->handleRequest($request);
|
||||
|
||||
if ($form->isSubmitted() and $form->isValid()) {
|
||||
if ($form->isSubmitted() && $form->isValid()) {
|
||||
$this->getDoctrine()->getManager()->flush();
|
||||
|
||||
$this->addFlash('success', $this->translator->trans('household.data_saved'));
|
||||
|
@ -190,7 +190,7 @@ class PersonAddressController extends AbstractController
|
||||
$form = $this->createEditForm($person, $address);
|
||||
$form->handleRequest($request);
|
||||
|
||||
if ($form->isSubmitted() and $form->isValid()) {
|
||||
if ($form->isSubmitted() && $form->isValid()) {
|
||||
$validatePersonErrors = $this->validatePerson($person);
|
||||
|
||||
if (count($validatePersonErrors) !== 0) {
|
||||
|
@ -599,7 +599,7 @@ class Person implements HasCenterInterface, TrackCreationInterface, TrackUpdateI
|
||||
public function checkAccompanyingPeriodsAreNotCollapsing()
|
||||
{
|
||||
$periods = $this->getAccompanyingPeriodsOrdered();
|
||||
$periodsNbr = sizeof($periods);
|
||||
$periodsNbr = count($periods);
|
||||
$i = 0;
|
||||
|
||||
while ($periodsNbr - 1 > $i) {
|
||||
|
@ -310,7 +310,7 @@ class ListPerson implements ListInterface, ExportElementValidatedInterface
|
||||
foreach ($this->getCustomFields() as $cf) {
|
||||
$cfType = $this->customFieldProvider->getCustomFieldByType($cf->getType());
|
||||
|
||||
if ($cfType instanceof CustomFieldChoice and $cfType->isMultiple($cf)) {
|
||||
if ($cfType instanceof CustomFieldChoice && $cfType->isMultiple($cf)) {
|
||||
foreach ($cfType->getChoices($cf) as $choiceSlug => $label) {
|
||||
$slug = $this->slugToDQL($cf->getSlug(), 'choice', ['choiceSlug' => $choiceSlug]);
|
||||
$qb->addSelect(
|
||||
@ -426,7 +426,7 @@ class ListPerson implements ListInterface, ExportElementValidatedInterface
|
||||
->render(json_decode($value, true), $cf, 'csv');
|
||||
};
|
||||
|
||||
if ($cfType instanceof CustomFieldChoice and $cfType->isMultiple($cf)) {
|
||||
if ($cfType instanceof CustomFieldChoice && $cfType->isMultiple($cf)) {
|
||||
return function ($value) use ($cf, $cfType, $key) {
|
||||
$slugChoice = $this->extractInfosFromSlug($key)['additionnalInfos']['choiceSlug'];
|
||||
$decoded = \json_decode($value, true);
|
||||
@ -438,7 +438,7 @@ class ListPerson implements ListInterface, ExportElementValidatedInterface
|
||||
. ' | ' . $label;
|
||||
}
|
||||
|
||||
if ('_other' === $slugChoice and $cfType->isChecked($cf, $choiceSlug, $decoded)) {
|
||||
if ('_other' === $slugChoice && $cfType->isChecked($cf, $choiceSlug, $decoded)) {
|
||||
return $cfType->extractOtherValue($cf, $decoded);
|
||||
}
|
||||
|
||||
|
@ -167,23 +167,23 @@ class ListPersonDuplicate implements DirectExportInterface, ExportElementValidat
|
||||
SIMILARITY(p.fullnamecanonical, p2.fullnamecanonical) AS "similarity nom + prenom",
|
||||
SIMILARITY(p.lastname, p2.lastname) AS "similarity nom",
|
||||
SIMILARITY(p.firstname, p2.firstname) AS "similarity prenom"
|
||||
FROM chill_person_person AS p
|
||||
JOIN chill_person_person AS p2
|
||||
ON p.id != p2.id
|
||||
AND (SIMILARITY(p.fullnamecanonical, p2.fullnamecanonical) > :precision
|
||||
FROM chill_person_person AS p
|
||||
JOIN chill_person_person AS p2
|
||||
ON p.id != p2.id
|
||||
AND (SIMILARITY(p.fullnamecanonical, p2.fullnamecanonical) > :precision
|
||||
AND p.id < p2.id)
|
||||
OR (UNACCENT(LOWER(p.firstname)) = UNACCENT(LOWER(p2.lastname))
|
||||
AND UNACCENT(LOWER(p.lastname)) = UNACCENT(LOWER(p2.firstname)))
|
||||
JOIN centers AS p1center
|
||||
JOIN centers AS p1center
|
||||
ON p1center.id = p.center_id
|
||||
JOIN centers AS p2center
|
||||
JOIN centers AS p2center
|
||||
ON p2center.id = p2.center_id
|
||||
WHERE NOT EXISTS (
|
||||
SELECT id
|
||||
FROM chill_person_not_duplicate as pnd
|
||||
WHERE (pnd.person1_id = p.id
|
||||
SELECT id
|
||||
FROM chill_person_not_duplicate as pnd
|
||||
WHERE (pnd.person1_id = p.id
|
||||
AND pnd.person2_id = p2.id)
|
||||
OR (pnd.person2_id = p.id
|
||||
OR (pnd.person2_id = p.id
|
||||
AND pnd.person1_id = p2.id)
|
||||
)
|
||||
ORDER BY p.fullnamecanonical, p.id, p2.id';
|
||||
|
@ -64,8 +64,8 @@ class AccompanyingPeriodType extends AbstractType
|
||||
|
||||
if (
|
||||
('close' === $options['period_action'])
|
||||
or ('create' === $options['period_action'])
|
||||
or ('update' === $options['period_action'] and !$accompanyingPeriod->isOpen())
|
||||
|| ('create' === $options['period_action'])
|
||||
|| ('update' === $options['period_action'] && !$accompanyingPeriod->isOpen())
|
||||
) {
|
||||
$builder->add('closingDate', DateType::class, [
|
||||
'required' => true,
|
||||
|
@ -25,10 +25,10 @@ final class HouseholdRepository implements ObjectRepository
|
||||
FROM chill_person_accompanying_period_participation AS part
|
||||
WHERE person_id = ?),
|
||||
other_participants AS (
|
||||
SELECT person_id, startDate, endDate
|
||||
SELECT person_id, startDate, endDate
|
||||
FROM chill_person_accompanying_period_participation
|
||||
JOIN participations USING (accompanyingperiod_id)
|
||||
WHERE person_id != ?
|
||||
WHERE person_id != ?
|
||||
),
|
||||
households AS (SELECT DISTINCT household.*
|
||||
FROM chill_person_household_members AS hmembers
|
||||
|
@ -226,8 +226,8 @@ class PersonControllerUpdateTest extends WebTestCase
|
||||
'a element .success is shown'
|
||||
);
|
||||
|
||||
if ('birthdate' == $field or 'memo' == $field or 'countryOfBirth' == $field or 'nationality' == $field
|
||||
or 'gender' == $field) {
|
||||
if ('birthdate' == $field || 'memo' == $field || 'countryOfBirth' == $field || 'nationality' == $field
|
||||
|| 'gender' == $field) {
|
||||
// we do not perform test on the web page contents.
|
||||
} else {
|
||||
$this->assertGreaterThan(0, $crawler->filter('html:contains("' . $value . '")')->count());
|
||||
|
@ -160,8 +160,8 @@ class PersonControllerUpdateWithHiddenFieldsTest extends WebTestCase
|
||||
'a element .success is shown'
|
||||
);
|
||||
|
||||
if ('birthdate' == $field or 'memo' == $field or 'countryOfBirth' == $field or 'nationality' == $field
|
||||
or 'gender' == $field) {
|
||||
if ('birthdate' == $field || 'memo' == $field || 'countryOfBirth' == $field || 'nationality' == $field
|
||||
|| 'gender' == $field) {
|
||||
// we do not perform test on the web page contents.
|
||||
} else {
|
||||
$this->assertGreaterThan(0, $crawler->filter('html:contains("' . $value . '")')->count());
|
||||
@ -216,7 +216,7 @@ class PersonControllerUpdateWithHiddenFieldsTest extends WebTestCase
|
||||
private function getVeryLongText()
|
||||
{
|
||||
return <<<'EOT'
|
||||
Lorem ipsum dolor sit amet, consectetur adipiscing elit. Suspendisse molestie at enim id auctor. Vivamus malesuada elit ipsum, ac mollis ex facilisis sit amet. Phasellus accumsan, quam ut aliquet accumsan, augue ligula consequat erat, condimentum iaculis orci magna egestas eros. In vel blandit sapien. Duis ut dui vitae tortor iaculis malesuada vitae vitae lorem. Morbi efficitur dolor orci, a rhoncus urna blandit quis. Aenean at placerat dui, ut tincidunt nulla. In ultricies tempus ligula ac rutrum. Vestibulum ante ipsum primis in faucibus orci luctus et ultrices posuere cubilia Curae; Fusce urna nibh, placerat vel auctor sed, maximus quis magna. Vivamus quam ante, consectetur vel feugiat quis, aliquet id ante. Integer gravida erat dignissim ante commodo mollis. Donec imperdiet mauris elit, nec blandit dolor feugiat ut. Proin iaculis enim ut tortor pretium commodo. Etiam aliquet hendrerit dolor sed fringilla. Vestibulum facilisis nibh tincidunt dui egestas, vitae congue mi imperdiet. Duis vulputate ultricies lectus id cursus. Fusce bibendum sem dignissim, bibendum purus quis, mollis ex. Cras ac est justo. Duis congue mattis ipsum, vitae sagittis justo dictum sit amet. Duis aliquam pharetra sem, non laoreet ante laoreet ac. Mauris ornare mi tempus rutrum consequat.
|
||||
Lorem ipsum dolor sit amet, consectetur adipiscing elit. Suspendisse molestie at enim id auctor. Vivamus malesuada elit ipsum, ac mollis ex facilisis sit amet. Phasellus accumsan, quam ut aliquet accumsan, augue ligula consequat erat, condimentum iaculis orci magna egestas eros. In vel blandit sapien. Duis ut dui vitae tortor iaculis malesuada vitae vitae lorem. Morbi efficitur dolor orci, a rhoncus urna blandit quis. Aenean at placerat dui, ut tincidunt nulla. In ultricies tempus ligula ac rutrum. Vestibulum ante ipsum primis in faucibus orci luctus et ultrices posuere cubilia Curae; Fusce urna nibh, placerat vel auctor sed, maximus quis magna. Vivamus quam ante, consectetur vel feugiat quis, aliquet id ante. Integer gravida erat dignissim ante commodo mollis. Donec imperdiet mauris elit, nec blandit dolor feugiat ut. Proin iaculis enim ut tortor pretium commodo. Etiam aliquet hendrerit dolor sed fringilla. Vestibulum facilisis nibh tincidunt dui egestas, vitae congue mi imperdiet. Duis vulputate ultricies lectus id cursus. Fusce bibendum sem dignissim, bibendum purus quis, mollis ex. Cras ac est justo. Duis congue mattis ipsum, vitae sagittis justo dictum sit amet. Duis aliquam pharetra sem, non laoreet ante laoreet ac. Mauris ornare mi tempus rutrum consequat.
|
||||
EOT;
|
||||
}
|
||||
}
|
||||
|
@ -36,7 +36,7 @@ class Version20160422000000 extends AbstractMigration
|
||||
}
|
||||
|
||||
$this->abortIf(
|
||||
sizeof($personWithTwoAddressWithSameValidFrom) != 0,
|
||||
count($personWithTwoAddressWithSameValidFrom) != 0,
|
||||
'There exists some person with multiple adress with the same validFrom'
|
||||
);
|
||||
}
|
||||
|
@ -62,19 +62,19 @@ class Version20170117131924 extends AbstractMigration
|
||||
before_date date)
|
||||
RETURNS TABLE(
|
||||
person_id integer,
|
||||
address_id integer,
|
||||
streetaddress1 varchar(255),
|
||||
address_id integer,
|
||||
streetaddress1 varchar(255),
|
||||
streetaddress2 varchar(255),
|
||||
validfrom date,
|
||||
postcode_label varchar(255),
|
||||
postcode_code varchar(100),
|
||||
postcode_id integer,
|
||||
country_name json,
|
||||
country_code varchar(3),
|
||||
validfrom date,
|
||||
postcode_label varchar(255),
|
||||
postcode_code varchar(100),
|
||||
postcode_id integer,
|
||||
country_name json,
|
||||
country_code varchar(3),
|
||||
country_id integer)
|
||||
AS
|
||||
$BODY$
|
||||
SELECT
|
||||
SELECT
|
||||
pid AS person_id,
|
||||
chill_main_address.id AS address_id,
|
||||
chill_main_address.streetaddress1,
|
||||
@ -88,11 +88,11 @@ class Version20170117131924 extends AbstractMigration
|
||||
country.id AS country_id
|
||||
FROM chill_main_address
|
||||
JOIN (
|
||||
SELECT
|
||||
SELECT
|
||||
chill_main_address.id AS address_id,
|
||||
validfrom,
|
||||
rank() OVER (PARTITION BY person_id ORDER BY validfrom DESC) as pos
|
||||
FROM chill_person_persons_to_addresses
|
||||
FROM chill_person_persons_to_addresses
|
||||
JOIN chill_main_address ON chill_person_persons_to_addresses.address_id = chill_main_address.id
|
||||
WHERE person_id = pid
|
||||
AND chill_main_address.validfrom <= before_date
|
||||
|
@ -30,19 +30,19 @@ final class Version20200422125935 extends AbstractMigration
|
||||
before_date date)
|
||||
RETURNS TABLE(
|
||||
person_id integer,
|
||||
address_id integer,
|
||||
streetaddress1 varchar(255),
|
||||
address_id integer,
|
||||
streetaddress1 varchar(255),
|
||||
streetaddress2 varchar(255),
|
||||
validfrom date,
|
||||
postcode_label varchar(255),
|
||||
postcode_code varchar(100),
|
||||
postcode_id integer,
|
||||
country_name json,
|
||||
country_code varchar(3),
|
||||
validfrom date,
|
||||
postcode_label varchar(255),
|
||||
postcode_code varchar(100),
|
||||
postcode_id integer,
|
||||
country_name json,
|
||||
country_code varchar(3),
|
||||
country_id integer)
|
||||
AS
|
||||
$BODY$
|
||||
SELECT
|
||||
SELECT
|
||||
pid AS person_id,
|
||||
chill_main_address.id AS address_id,
|
||||
chill_main_address.streetaddress1,
|
||||
@ -56,11 +56,11 @@ final class Version20200422125935 extends AbstractMigration
|
||||
country.id AS country_id
|
||||
FROM chill_main_address
|
||||
JOIN (
|
||||
SELECT
|
||||
SELECT
|
||||
chill_main_address.id AS address_id,
|
||||
validfrom,
|
||||
rank() OVER (PARTITION BY person_id ORDER BY validfrom DESC) as pos
|
||||
FROM chill_person_persons_to_addresses
|
||||
FROM chill_person_persons_to_addresses
|
||||
JOIN chill_main_address ON chill_person_persons_to_addresses.address_id = chill_main_address.id
|
||||
WHERE person_id = pid
|
||||
AND chill_main_address.validfrom <= before_date
|
||||
@ -85,20 +85,20 @@ final class Version20200422125935 extends AbstractMigration
|
||||
before_date date)
|
||||
RETURNS TABLE(
|
||||
person_id integer,
|
||||
address_id integer,
|
||||
streetaddress1 varchar(255),
|
||||
address_id integer,
|
||||
streetaddress1 varchar(255),
|
||||
streetaddress2 varchar(255),
|
||||
validfrom date,
|
||||
postcode_label varchar(255),
|
||||
postcode_code varchar(100),
|
||||
validfrom date,
|
||||
postcode_label varchar(255),
|
||||
postcode_code varchar(100),
|
||||
postcode_id integer,
|
||||
isnoaddress boolean,
|
||||
country_name json,
|
||||
country_code varchar(3),
|
||||
country_name json,
|
||||
country_code varchar(3),
|
||||
country_id integer)
|
||||
AS
|
||||
$BODY$
|
||||
SELECT
|
||||
SELECT
|
||||
pid AS person_id,
|
||||
chill_main_address.id AS address_id,
|
||||
chill_main_address.streetaddress1,
|
||||
@ -113,11 +113,11 @@ final class Version20200422125935 extends AbstractMigration
|
||||
country.id AS country_id
|
||||
FROM chill_main_address
|
||||
JOIN (
|
||||
SELECT
|
||||
SELECT
|
||||
chill_main_address.id AS address_id,
|
||||
validfrom,
|
||||
rank() OVER (PARTITION BY person_id ORDER BY validfrom DESC) as pos
|
||||
FROM chill_person_persons_to_addresses
|
||||
FROM chill_person_persons_to_addresses
|
||||
JOIN chill_main_address ON chill_person_persons_to_addresses.address_id = chill_main_address.id
|
||||
WHERE person_id = pid
|
||||
AND chill_main_address.validfrom <= before_date
|
||||
|
@ -64,7 +64,7 @@ class LoadCustomField extends AbstractFixture implements OrderedFixtureInterface
|
||||
];
|
||||
|
||||
for ($i = 0; 25 >= $i; ++$i) {
|
||||
$cFType = $cFTypes[rand(0, sizeof($cFTypes) - 1)];
|
||||
$cFType = $cFTypes[rand(0, count($cFTypes) - 1)];
|
||||
|
||||
$customField = (new CustomField())
|
||||
->setSlug("cf_report_{$i}")
|
||||
|
@ -417,7 +417,7 @@ class ReportList implements ListInterface, ExportElementValidatedInterface
|
||||
$cfType = $this->customFieldProvider->getCustomFieldByType($cf->getType());
|
||||
|
||||
// if is multiple, split into multiple columns
|
||||
if ($cfType instanceof CustomFieldChoice and $cfType->isMultiple($cf)) {
|
||||
if ($cfType instanceof CustomFieldChoice && $cfType->isMultiple($cf)) {
|
||||
foreach ($cfType->getChoices($cf) as $choiceSlug => $label) {
|
||||
$slug = $this->slugToDQL($cf->getSlug(), 'choice', ['choiceSlug' => $choiceSlug]);
|
||||
$qb->addSelect(
|
||||
@ -525,7 +525,7 @@ class ReportList implements ListInterface, ExportElementValidatedInterface
|
||||
->render(json_decode($value, true), $cf, 'csv');
|
||||
};
|
||||
|
||||
if ($cfType instanceof CustomFieldChoice and $cfType->isMultiple($cf)) {
|
||||
if ($cfType instanceof CustomFieldChoice && $cfType->isMultiple($cf)) {
|
||||
return function ($value) use ($cf, $cfType, $key) {
|
||||
$slugChoice = $this->extractInfosFromSlug($key)['additionnalInfos']['choiceSlug'];
|
||||
$decoded = \json_decode($value, true);
|
||||
@ -537,7 +537,7 @@ class ReportList implements ListInterface, ExportElementValidatedInterface
|
||||
. ' | ' . $label;
|
||||
}
|
||||
|
||||
if ('_other' === $slugChoice and $cfType->isChecked($cf, $choiceSlug, $decoded)) {
|
||||
if ('_other' === $slugChoice && $cfType->isChecked($cf, $choiceSlug, $decoded)) {
|
||||
return $cfType->extractOtherValue($cf, $decoded);
|
||||
}
|
||||
|
||||
|
@ -187,7 +187,7 @@ class SingleTaskRepository extends EntityRepository
|
||||
$this->buildACLQuery($qb, $currentUser);
|
||||
}
|
||||
|
||||
if (array_key_exists('person', $params) and !empty($params['person'])) {
|
||||
if (array_key_exists('person', $params) && !empty($params['person'])) {
|
||||
$qb->andWhere($qb->expr()->eq('st.person', ':person'));
|
||||
$qb->setParameter('person', $params['person']);
|
||||
} elseif (array_key_exists('center', $params)) {
|
||||
@ -200,8 +200,8 @@ class SingleTaskRepository extends EntityRepository
|
||||
}
|
||||
}
|
||||
|
||||
if (array_key_exists('unassigned', $params) and true === $params['unassigned']) {
|
||||
if (array_key_exists('user', $params) and !empty($params['user'])) {
|
||||
if (array_key_exists('unassigned', $params) && true === $params['unassigned']) {
|
||||
if (array_key_exists('user', $params) && !empty($params['user'])) {
|
||||
throw new UnexpectedValueException('You should not require for '
|
||||
. 'unassigned tasks and tasks assigned to some user.');
|
||||
}
|
||||
@ -209,12 +209,12 @@ class SingleTaskRepository extends EntityRepository
|
||||
$qb->andWhere($qb->expr()->isNull('st.assignee'));
|
||||
}
|
||||
|
||||
if (array_key_exists('user', $params) and !empty($params['user'])) {
|
||||
if (array_key_exists('user', $params) && !empty($params['user'])) {
|
||||
$qb->andWhere($qb->expr()->eq('st.assignee', ':user'));
|
||||
$qb->setParameter('user', $params['user']);
|
||||
}
|
||||
|
||||
if (array_key_exists('scope', $params) and !empty($params['scope'])) {
|
||||
if (array_key_exists('scope', $params) && !empty($params['scope'])) {
|
||||
$qb->andWhere($qb->expr()->eq('st.circle', ':scope'));
|
||||
$qb->setParameter('scope', $params['scope']);
|
||||
}
|
||||
@ -226,7 +226,7 @@ class SingleTaskRepository extends EntityRepository
|
||||
}
|
||||
}
|
||||
|
||||
if (array_key_exists('date_status', $params) and !empty($params['date_status'])) {
|
||||
if (array_key_exists('date_status', $params) && !empty($params['date_status'])) {
|
||||
$this->addTypeFilter($qb, $params);
|
||||
}
|
||||
|
||||
|
@ -97,7 +97,7 @@ class ThirdPartySearch implements SearchInterface
|
||||
|
||||
public function supports($domain, $format): bool
|
||||
{
|
||||
return self::NAME === $domain and 'json' === $format;
|
||||
return self::NAME === $domain && 'json' === $format;
|
||||
}
|
||||
|
||||
protected function count($centers, $terms): int
|
||||
|
Loading…
x
Reference in New Issue
Block a user