From f531cdc0ec98e1595a077a8f8f27a0e6519a5eb5 Mon Sep 17 00:00:00 2001 From: Pol Dellaiera Date: Wed, 24 Nov 2021 12:38:18 +0100 Subject: [PATCH] cs: Enable a couple of risky rules. --- .php_cs.dist.php | 18 ++++---- grumphp.yml | 2 +- .../Aggregator/ActivityReasonAggregator.php | 2 +- .../Timeline/TimelineActivityProvider.php | 2 +- .../migrations/Version20160222103457.php | 2 +- .../Controller/AbstractElementController.php | 4 +- .../Authorization/BudgetElementVoter.php | 2 +- .../Controller/CalendarController.php | 4 +- .../Controller/CalendarRangeAPIController.php | 2 +- .../Command/CreateFieldsOnGroupCommand.php | 2 +- .../CustomFields/AbstractCustomField.php | 2 +- .../CustomFields/CustomFieldChoice.php | 2 +- .../CustomFields/CustomFieldNumber.php | 2 +- .../CustomFields/CustomFieldText.php | 2 +- .../Entity/CustomFieldsGroup.php | 2 +- .../CustomFieldsGroupToIdTransformer.php | 4 +- .../HouseholdMemberSelectionContext.php | 2 +- .../DocumentAccompanyingCourseController.php | 4 +- .../Controller/DocumentPersonController.php | 4 +- .../Controller/ParticipationController.php | 2 +- .../ChillEventBundle/Search/EventSearch.php | 6 +-- .../Security/Voter/FamilyMemberVoter.php | 2 +- .../Command/LoadAndUpdateLanguagesCommand.php | 8 ++-- .../Controller/ExportController.php | 8 ++-- .../DataFixtures/ORM/LoadPostalCodes.php | 4 +- src/Bundle/ChillMainBundle/Entity/User.php | 4 +- .../ChillMainBundle/Export/ExportManager.php | 6 +-- .../ChillMainBundle/Pagination/Paginator.php | 2 +- .../Security/UserProvider/UserProvider.php | 2 +- .../DiscriminatedObjectDenormalizer.php | 2 +- .../Test/Export/AbstractAggregatorTest.php | 2 +- .../Test/Export/AbstractFilterTest.php | 2 +- .../migrations/Version20180709181423.php | 4 +- .../migrations/Version20180911093642.php | 4 +- .../Controller/HouseholdApiController.php | 2 +- .../Controller/HouseholdController.php | 2 +- .../Controller/PersonAddressController.php | 2 +- .../ChillPersonBundle/Entity/Person.php | 2 +- .../Export/Export/ListPerson.php | 6 +-- .../Export/Export/ListPersonDuplicate.php | 20 ++++----- .../Form/AccompanyingPeriodType.php | 4 +- .../Household/HouseholdRepository.php | 4 +- .../Controller/PersonControllerUpdateTest.php | 4 +- ...onControllerUpdateWithHiddenFieldsTest.php | 6 +-- .../migrations/Version20160422000000.php | 2 +- .../migrations/Version20170117131924.php | 22 +++++----- .../migrations/Version20200422125935.php | 42 +++++++++---------- .../DataFixtures/ORM/LoadCustomField.php | 2 +- .../Export/Export/ReportList.php | 6 +-- .../Repository/SingleTaskRepository.php | 12 +++--- .../Search/ThirdPartySearch.php | 2 +- 51 files changed, 130 insertions(+), 132 deletions(-) diff --git a/.php_cs.dist.php b/.php_cs.dist.php index c9cd4d06d..6f791684f 100644 --- a/.php_cs.dist.php +++ b/.php_cs.dist.php @@ -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, diff --git a/grumphp.yml b/grumphp.yml index fd2bfea8b..d25cc01ba 100644 --- a/grumphp.yml +++ b/grumphp.yml @@ -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 diff --git a/src/Bundle/ChillActivityBundle/Export/Aggregator/ActivityReasonAggregator.php b/src/Bundle/ChillActivityBundle/Export/Aggregator/ActivityReasonAggregator.php index 0a5b4904e..f48645c38 100644 --- a/src/Bundle/ChillActivityBundle/Export/Aggregator/ActivityReasonAggregator.php +++ b/src/Bundle/ChillActivityBundle/Export/Aggregator/ActivityReasonAggregator.php @@ -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', diff --git a/src/Bundle/ChillActivityBundle/Timeline/TimelineActivityProvider.php b/src/Bundle/ChillActivityBundle/Timeline/TimelineActivityProvider.php index c0dab8abd..4cc176a00 100644 --- a/src/Bundle/ChillActivityBundle/Timeline/TimelineActivityProvider.php +++ b/src/Bundle/ChillActivityBundle/Timeline/TimelineActivityProvider.php @@ -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 diff --git a/src/Bundle/ChillActivityBundle/migrations/Version20160222103457.php b/src/Bundle/ChillActivityBundle/migrations/Version20160222103457.php index 6aa355cae..193b6bffe 100644 --- a/src/Bundle/ChillActivityBundle/migrations/Version20160222103457.php +++ b/src/Bundle/ChillActivityBundle/migrations/Version20160222103457.php @@ -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 diff --git a/src/Bundle/ChillBudgetBundle/Controller/AbstractElementController.php b/src/Bundle/ChillBudgetBundle/Controller/AbstractElementController.php index fd4f77f93..55a2cc165 100644 --- a/src/Bundle/ChillBudgetBundle/Controller/AbstractElementController.php +++ b/src/Bundle/ChillBudgetBundle/Controller/AbstractElementController.php @@ -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(); diff --git a/src/Bundle/ChillBudgetBundle/Security/Authorization/BudgetElementVoter.php b/src/Bundle/ChillBudgetBundle/Security/Authorization/BudgetElementVoter.php index 3c2a41226..4dda9f8f2 100644 --- a/src/Bundle/ChillBudgetBundle/Security/Authorization/BudgetElementVoter.php +++ b/src/Bundle/ChillBudgetBundle/Security/Authorization/BudgetElementVoter.php @@ -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) diff --git a/src/Bundle/ChillCalendarBundle/Controller/CalendarController.php b/src/Bundle/ChillCalendarBundle/Controller/CalendarController.php index 6e6bce842..cde6bc7b4 100644 --- a/src/Bundle/ChillCalendarBundle/Controller/CalendarController.php +++ b/src/Bundle/ChillCalendarBundle/Controller/CalendarController.php @@ -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')); } diff --git a/src/Bundle/ChillCalendarBundle/Controller/CalendarRangeAPIController.php b/src/Bundle/ChillCalendarBundle/Controller/CalendarRangeAPIController.php index 4334667dd..fe33777aa 100644 --- a/src/Bundle/ChillCalendarBundle/Controller/CalendarRangeAPIController.php +++ b/src/Bundle/ChillCalendarBundle/Controller/CalendarRangeAPIController.php @@ -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')) { diff --git a/src/Bundle/ChillCustomFieldsBundle/Command/CreateFieldsOnGroupCommand.php b/src/Bundle/ChillCustomFieldsBundle/Command/CreateFieldsOnGroupCommand.php index bf2772b8d..13bdaba74 100644 --- a/src/Bundle/ChillCustomFieldsBundle/Command/CreateFieldsOnGroupCommand.php +++ b/src/Bundle/ChillCustomFieldsBundle/Command/CreateFieldsOnGroupCommand.php @@ -197,7 +197,7 @@ class CreateFieldsOnGroupCommand extends Command $em->persist($cf); $output->writeln('Adding Custom Field of type ' . $cf->getType() . "\t with slug " . $cf->getSlug() . - "\t and names : " . implode($names, ', ') . ''); + "\t and names : " . implode(', ', $names) . ''); } else { throw new RuntimeException('Error in field ' . $slug); } diff --git a/src/Bundle/ChillCustomFieldsBundle/CustomFields/AbstractCustomField.php b/src/Bundle/ChillCustomFieldsBundle/CustomFields/AbstractCustomField.php index 3d551cde5..d46446018 100644 --- a/src/Bundle/ChillCustomFieldsBundle/CustomFields/AbstractCustomField.php +++ b/src/Bundle/ChillCustomFieldsBundle/CustomFields/AbstractCustomField.php @@ -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; } } diff --git a/src/Bundle/ChillCustomFieldsBundle/CustomFields/CustomFieldChoice.php b/src/Bundle/ChillCustomFieldsBundle/CustomFields/CustomFieldChoice.php index 856ac8ae9..595dd594b 100644 --- a/src/Bundle/ChillCustomFieldsBundle/CustomFields/CustomFieldChoice.php +++ b/src/Bundle/ChillCustomFieldsBundle/CustomFields/CustomFieldChoice.php @@ -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 diff --git a/src/Bundle/ChillCustomFieldsBundle/CustomFields/CustomFieldNumber.php b/src/Bundle/ChillCustomFieldsBundle/CustomFields/CustomFieldNumber.php index e66a512d9..80d676d5e 100644 --- a/src/Bundle/ChillCustomFieldsBundle/CustomFields/CustomFieldNumber.php +++ b/src/Bundle/ChillCustomFieldsBundle/CustomFields/CustomFieldNumber.php @@ -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'; diff --git a/src/Bundle/ChillCustomFieldsBundle/CustomFields/CustomFieldText.php b/src/Bundle/ChillCustomFieldsBundle/CustomFields/CustomFieldText.php index 8e2e9a80f..897fbd353 100644 --- a/src/Bundle/ChillCustomFieldsBundle/CustomFields/CustomFieldText.php +++ b/src/Bundle/ChillCustomFieldsBundle/CustomFields/CustomFieldText.php @@ -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'; } diff --git a/src/Bundle/ChillCustomFieldsBundle/Entity/CustomFieldsGroup.php b/src/Bundle/ChillCustomFieldsBundle/Entity/CustomFieldsGroup.php index 3c61a70f1..9a0633e09 100644 --- a/src/Bundle/ChillCustomFieldsBundle/Entity/CustomFieldsGroup.php +++ b/src/Bundle/ChillCustomFieldsBundle/Entity/CustomFieldsGroup.php @@ -104,7 +104,7 @@ class CustomFieldsGroup foreach ($this->customFields as $cf) { if ($cf->isActive()) { - array_push($this->activeCustomFields, $cf); + $this->activeCustomFields[] = $cf; } } } diff --git a/src/Bundle/ChillCustomFieldsBundle/Form/DataTransformer/CustomFieldsGroupToIdTransformer.php b/src/Bundle/ChillCustomFieldsBundle/Form/DataTransformer/CustomFieldsGroupToIdTransformer.php index 0600264f5..b09427e54 100644 --- a/src/Bundle/ChillCustomFieldsBundle/Form/DataTransformer/CustomFieldsGroupToIdTransformer.php +++ b/src/Bundle/ChillCustomFieldsBundle/Form/DataTransformer/CustomFieldsGroupToIdTransformer.php @@ -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' - ) ); } diff --git a/src/Bundle/ChillDocGeneratorBundle/Context/HouseholdMemberSelectionContext.php b/src/Bundle/ChillDocGeneratorBundle/Context/HouseholdMemberSelectionContext.php index e5752c5ca..41d56c3e1 100644 --- a/src/Bundle/ChillDocGeneratorBundle/Context/HouseholdMemberSelectionContext.php +++ b/src/Bundle/ChillDocGeneratorBundle/Context/HouseholdMemberSelectionContext.php @@ -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'][] = [ diff --git a/src/Bundle/ChillDocStoreBundle/Controller/DocumentAccompanyingCourseController.php b/src/Bundle/ChillDocStoreBundle/Controller/DocumentAccompanyingCourseController.php index c355c9e97..84a1f8edc 100644 --- a/src/Bundle/ChillDocStoreBundle/Controller/DocumentAccompanyingCourseController.php +++ b/src/Bundle/ChillDocStoreBundle/Controller/DocumentAccompanyingCourseController.php @@ -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')); } diff --git a/src/Bundle/ChillDocStoreBundle/Controller/DocumentPersonController.php b/src/Bundle/ChillDocStoreBundle/Controller/DocumentPersonController.php index c0ceed681..1a5fe3ad8 100644 --- a/src/Bundle/ChillDocStoreBundle/Controller/DocumentPersonController.php +++ b/src/Bundle/ChillDocStoreBundle/Controller/DocumentPersonController.php @@ -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')); } diff --git a/src/Bundle/ChillEventBundle/Controller/ParticipationController.php b/src/Bundle/ChillEventBundle/Controller/ParticipationController.php index fc0abada1..e719ba91e 100644 --- a/src/Bundle/ChillEventBundle/Controller/ParticipationController.php +++ b/src/Bundle/ChillEventBundle/Controller/ParticipationController.php @@ -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"); diff --git a/src/Bundle/ChillEventBundle/Search/EventSearch.php b/src/Bundle/ChillEventBundle/Search/EventSearch.php index 3b16f346e..7bd1e8731 100644 --- a/src/Bundle/ChillEventBundle/Search/EventSearch.php +++ b/src/Bundle/ChillEventBundle/Search/EventSearch.php @@ -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']; diff --git a/src/Bundle/ChillFamilyMembersBundle/Security/Voter/FamilyMemberVoter.php b/src/Bundle/ChillFamilyMembersBundle/Security/Voter/FamilyMemberVoter.php index fba5e0c37..d37906da5 100644 --- a/src/Bundle/ChillFamilyMembersBundle/Security/Voter/FamilyMemberVoter.php +++ b/src/Bundle/ChillFamilyMembersBundle/Security/Voter/FamilyMemberVoter.php @@ -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) diff --git a/src/Bundle/ChillMainBundle/Command/LoadAndUpdateLanguagesCommand.php b/src/Bundle/ChillMainBundle/Command/LoadAndUpdateLanguagesCommand.php index 4f816cf6d..4b1f541a5 100644 --- a/src/Bundle/ChillMainBundle/Command/LoadAndUpdateLanguagesCommand.php +++ b/src/Bundle/ChillMainBundle/Command/LoadAndUpdateLanguagesCommand.php @@ -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) ) ); diff --git a/src/Bundle/ChillMainBundle/Controller/ExportController.php b/src/Bundle/ChillMainBundle/Controller/ExportController.php index eab491c52..ae5adb94f 100644 --- a/src/Bundle/ChillMainBundle/Controller/ExportController.php +++ b/src/Bundle/ChillMainBundle/Controller/ExportController.php @@ -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), ]); diff --git a/src/Bundle/ChillMainBundle/DataFixtures/ORM/LoadPostalCodes.php b/src/Bundle/ChillMainBundle/DataFixtures/ORM/LoadPostalCodes.php index 17728d14d..e32c40cdb 100644 --- a/src/Bundle/ChillMainBundle/DataFixtures/ORM/LoadPostalCodes.php +++ b/src/Bundle/ChillMainBundle/DataFixtures/ORM/LoadPostalCodes.php @@ -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() diff --git a/src/Bundle/ChillMainBundle/Entity/User.php b/src/Bundle/ChillMainBundle/Entity/User.php index d0ff644c1..a1d4b72c7 100644 --- a/src/Bundle/ChillMainBundle/Entity/User.php +++ b/src/Bundle/ChillMainBundle/Entity/User.php @@ -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.'); } } diff --git a/src/Bundle/ChillMainBundle/Export/ExportManager.php b/src/Bundle/ChillMainBundle/Export/ExportManager.php index e80dd154c..954658b81 100644 --- a/src/Bundle/ChillMainBundle/Export/ExportManager.php +++ b/src/Bundle/ChillMainBundle/Export/ExportManager.php @@ -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(); } } } diff --git a/src/Bundle/ChillMainBundle/Pagination/Paginator.php b/src/Bundle/ChillMainBundle/Pagination/Paginator.php index 9105b1dde..d0342a7d5 100644 --- a/src/Bundle/ChillMainBundle/Pagination/Paginator.php +++ b/src/Bundle/ChillMainBundle/Pagination/Paginator.php @@ -210,7 +210,7 @@ class Paginator implements PaginatorInterface public function hasPage($number) { return 0 < $number - and $this->countPages() >= $number; + && $this->countPages() >= $number; } /** diff --git a/src/Bundle/ChillMainBundle/Security/UserProvider/UserProvider.php b/src/Bundle/ChillMainBundle/Security/UserProvider/UserProvider.php index db9e4c2de..b25c513fd 100644 --- a/src/Bundle/ChillMainBundle/Security/UserProvider/UserProvider.php +++ b/src/Bundle/ChillMainBundle/Security/UserProvider/UserProvider.php @@ -42,7 +42,7 @@ class UserProvider implements UserProviderInterface ->getSingleResult(); } catch (NoResultException $e) { throw new UsernameNotFoundException( - sprintf('Bad credentials.'), + 'Bad credentials.', 0, $e ); diff --git a/src/Bundle/ChillMainBundle/Serializer/Normalizer/DiscriminatedObjectDenormalizer.php b/src/Bundle/ChillMainBundle/Serializer/Normalizer/DiscriminatedObjectDenormalizer.php index 018f99b46..dbd158229 100644 --- a/src/Bundle/ChillMainBundle/Serializer/Normalizer/DiscriminatedObjectDenormalizer.php +++ b/src/Bundle/ChillMainBundle/Serializer/Normalizer/DiscriminatedObjectDenormalizer.php @@ -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'); } diff --git a/src/Bundle/ChillMainBundle/Test/Export/AbstractAggregatorTest.php b/src/Bundle/ChillMainBundle/Test/Export/AbstractAggregatorTest.php index eb445faf5..89db24e88 100644 --- a/src/Bundle/ChillMainBundle/Test/Export/AbstractAggregatorTest.php +++ b/src/Bundle/ChillMainBundle/Test/Export/AbstractAggregatorTest.php @@ -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( diff --git a/src/Bundle/ChillMainBundle/Test/Export/AbstractFilterTest.php b/src/Bundle/ChillMainBundle/Test/Export/AbstractFilterTest.php index 2c12b89df..c86ec285a 100644 --- a/src/Bundle/ChillMainBundle/Test/Export/AbstractFilterTest.php +++ b/src/Bundle/ChillMainBundle/Test/Export/AbstractFilterTest.php @@ -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( diff --git a/src/Bundle/ChillMainBundle/migrations/Version20180709181423.php b/src/Bundle/ChillMainBundle/migrations/Version20180709181423.php index fe1b65a30..7771756a7 100644 --- a/src/Bundle/ChillMainBundle/migrations/Version20180709181423.php +++ b/src/Bundle/ChillMainBundle/migrations/Version20180709181423.php @@ -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 ); diff --git a/src/Bundle/ChillMainBundle/migrations/Version20180911093642.php b/src/Bundle/ChillMainBundle/migrations/Version20180911093642.php index 7582acdf5..86e5585e3 100644 --- a/src/Bundle/ChillMainBundle/migrations/Version20180911093642.php +++ b/src/Bundle/ChillMainBundle/migrations/Version20180911093642.php @@ -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 diff --git a/src/Bundle/ChillPersonBundle/Controller/HouseholdApiController.php b/src/Bundle/ChillPersonBundle/Controller/HouseholdApiController.php index fcad908a5..9e50cda17 100644 --- a/src/Bundle/ChillPersonBundle/Controller/HouseholdApiController.php +++ b/src/Bundle/ChillPersonBundle/Controller/HouseholdApiController.php @@ -141,7 +141,7 @@ class HouseholdApiController extends ApiController foreach ($allHouseholds as $h) { if ($h !== $currentHouseholdPerson) { - array_push($households, $h); + $households[] = $h; } } diff --git a/src/Bundle/ChillPersonBundle/Controller/HouseholdController.php b/src/Bundle/ChillPersonBundle/Controller/HouseholdController.php index 6bba9223d..d743061c0 100644 --- a/src/Bundle/ChillPersonBundle/Controller/HouseholdController.php +++ b/src/Bundle/ChillPersonBundle/Controller/HouseholdController.php @@ -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')); diff --git a/src/Bundle/ChillPersonBundle/Controller/PersonAddressController.php b/src/Bundle/ChillPersonBundle/Controller/PersonAddressController.php index 684a04b0d..e7d75af77 100644 --- a/src/Bundle/ChillPersonBundle/Controller/PersonAddressController.php +++ b/src/Bundle/ChillPersonBundle/Controller/PersonAddressController.php @@ -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) { diff --git a/src/Bundle/ChillPersonBundle/Entity/Person.php b/src/Bundle/ChillPersonBundle/Entity/Person.php index 130e1ec10..14ee92cf2 100644 --- a/src/Bundle/ChillPersonBundle/Entity/Person.php +++ b/src/Bundle/ChillPersonBundle/Entity/Person.php @@ -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) { diff --git a/src/Bundle/ChillPersonBundle/Export/Export/ListPerson.php b/src/Bundle/ChillPersonBundle/Export/Export/ListPerson.php index b949c5ebc..8e0b5ac21 100644 --- a/src/Bundle/ChillPersonBundle/Export/Export/ListPerson.php +++ b/src/Bundle/ChillPersonBundle/Export/Export/ListPerson.php @@ -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); } diff --git a/src/Bundle/ChillPersonBundle/Export/Export/ListPersonDuplicate.php b/src/Bundle/ChillPersonBundle/Export/Export/ListPersonDuplicate.php index f1852da88..cbe472433 100644 --- a/src/Bundle/ChillPersonBundle/Export/Export/ListPersonDuplicate.php +++ b/src/Bundle/ChillPersonBundle/Export/Export/ListPersonDuplicate.php @@ -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'; diff --git a/src/Bundle/ChillPersonBundle/Form/AccompanyingPeriodType.php b/src/Bundle/ChillPersonBundle/Form/AccompanyingPeriodType.php index 6b2b3e171..d88277751 100644 --- a/src/Bundle/ChillPersonBundle/Form/AccompanyingPeriodType.php +++ b/src/Bundle/ChillPersonBundle/Form/AccompanyingPeriodType.php @@ -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, diff --git a/src/Bundle/ChillPersonBundle/Repository/Household/HouseholdRepository.php b/src/Bundle/ChillPersonBundle/Repository/Household/HouseholdRepository.php index e03e232f0..e4bc03357 100644 --- a/src/Bundle/ChillPersonBundle/Repository/Household/HouseholdRepository.php +++ b/src/Bundle/ChillPersonBundle/Repository/Household/HouseholdRepository.php @@ -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 diff --git a/src/Bundle/ChillPersonBundle/Tests/Controller/PersonControllerUpdateTest.php b/src/Bundle/ChillPersonBundle/Tests/Controller/PersonControllerUpdateTest.php index 9dd309be7..5ee30c6a6 100644 --- a/src/Bundle/ChillPersonBundle/Tests/Controller/PersonControllerUpdateTest.php +++ b/src/Bundle/ChillPersonBundle/Tests/Controller/PersonControllerUpdateTest.php @@ -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()); diff --git a/src/Bundle/ChillPersonBundle/Tests/Controller/PersonControllerUpdateWithHiddenFieldsTest.php b/src/Bundle/ChillPersonBundle/Tests/Controller/PersonControllerUpdateWithHiddenFieldsTest.php index 23a808908..907883362 100644 --- a/src/Bundle/ChillPersonBundle/Tests/Controller/PersonControllerUpdateWithHiddenFieldsTest.php +++ b/src/Bundle/ChillPersonBundle/Tests/Controller/PersonControllerUpdateWithHiddenFieldsTest.php @@ -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; } } diff --git a/src/Bundle/ChillPersonBundle/migrations/Version20160422000000.php b/src/Bundle/ChillPersonBundle/migrations/Version20160422000000.php index c38ab92c0..808dfa652 100644 --- a/src/Bundle/ChillPersonBundle/migrations/Version20160422000000.php +++ b/src/Bundle/ChillPersonBundle/migrations/Version20160422000000.php @@ -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' ); } diff --git a/src/Bundle/ChillPersonBundle/migrations/Version20170117131924.php b/src/Bundle/ChillPersonBundle/migrations/Version20170117131924.php index 91157be03..706bd3e6d 100644 --- a/src/Bundle/ChillPersonBundle/migrations/Version20170117131924.php +++ b/src/Bundle/ChillPersonBundle/migrations/Version20170117131924.php @@ -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 diff --git a/src/Bundle/ChillPersonBundle/migrations/Version20200422125935.php b/src/Bundle/ChillPersonBundle/migrations/Version20200422125935.php index 5ac4b96fb..8d9da0e48 100644 --- a/src/Bundle/ChillPersonBundle/migrations/Version20200422125935.php +++ b/src/Bundle/ChillPersonBundle/migrations/Version20200422125935.php @@ -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 diff --git a/src/Bundle/ChillReportBundle/DataFixtures/ORM/LoadCustomField.php b/src/Bundle/ChillReportBundle/DataFixtures/ORM/LoadCustomField.php index 5b2d975b9..9ceedb160 100644 --- a/src/Bundle/ChillReportBundle/DataFixtures/ORM/LoadCustomField.php +++ b/src/Bundle/ChillReportBundle/DataFixtures/ORM/LoadCustomField.php @@ -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}") diff --git a/src/Bundle/ChillReportBundle/Export/Export/ReportList.php b/src/Bundle/ChillReportBundle/Export/Export/ReportList.php index a9edd8aa6..b6e2d2756 100644 --- a/src/Bundle/ChillReportBundle/Export/Export/ReportList.php +++ b/src/Bundle/ChillReportBundle/Export/Export/ReportList.php @@ -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); } diff --git a/src/Bundle/ChillTaskBundle/Repository/SingleTaskRepository.php b/src/Bundle/ChillTaskBundle/Repository/SingleTaskRepository.php index 83f95c41c..7014d68a2 100644 --- a/src/Bundle/ChillTaskBundle/Repository/SingleTaskRepository.php +++ b/src/Bundle/ChillTaskBundle/Repository/SingleTaskRepository.php @@ -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); } diff --git a/src/Bundle/ChillThirdPartyBundle/Search/ThirdPartySearch.php b/src/Bundle/ChillThirdPartyBundle/Search/ThirdPartySearch.php index 88e7d0639..fbed5854c 100644 --- a/src/Bundle/ChillThirdPartyBundle/Search/ThirdPartySearch.php +++ b/src/Bundle/ChillThirdPartyBundle/Search/ThirdPartySearch.php @@ -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