cs: Enable a couple of risky rules.

This commit is contained in:
Pol Dellaiera 2021-11-24 12:38:18 +01:00
parent acc4647346
commit f531cdc0ec
No known key found for this signature in database
GPG Key ID: D476DFE9C67467CA
51 changed files with 130 additions and 132 deletions

View File

@ -22,14 +22,14 @@ $rules = $config->getRules();
$riskyRules = [ $riskyRules = [
'final_internal_class' => false, 'final_internal_class' => false,
'no_useless_sprintf' => false, // 'no_useless_sprintf' => false,
'dir_constant' => false, 'dir_constant' => false,
'no_alias_functions' => false, // 'no_alias_functions' => false,
'implode_call' => false, // 'implode_call' => false,
'combine_nested_dirname' => false, 'combine_nested_dirname' => false,
'pow_to_exponentiation' => false, // 'pow_to_exponentiation' => false,
'comment_to_phpdoc' => false, 'comment_to_phpdoc' => false,
'no_unset_on_property' => false, // 'no_unset_on_property' => false,
'strict_param' => false, 'strict_param' => false,
'native_constant_invocation' => false, 'native_constant_invocation' => false,
'php_unit_test_annotation' => false, 'php_unit_test_annotation' => false,
@ -39,19 +39,19 @@ $riskyRules = [
'is_null' => false, 'is_null' => false,
'native_function_invocation' => false, 'native_function_invocation' => false,
'ternary_to_elvis_operator' => false, 'ternary_to_elvis_operator' => false,
'no_trailing_whitespace_in_string' => false, // 'no_trailing_whitespace_in_string' => false,
'no_unreachable_default_argument_value' => false, 'no_unreachable_default_argument_value' => false,
'php_unit_test_case_static_method_calls' => false, 'php_unit_test_case_static_method_calls' => false,
'strict_comparison' => false, 'strict_comparison' => false,
'array_push' => false, // 'array_push' => false,
'ereg_to_preg' => false, 'ereg_to_preg' => false,
'error_suppression' => false, 'error_suppression' => false,
'fopen_flag_order' => false, 'fopen_flag_order' => false,
'fopen_flags' => false, 'fopen_flags' => false,
'logical_operators' => false, // 'logical_operators' => false,
'modernize_types_casting' => false, 'modernize_types_casting' => false,
'no_homoglyph_names' => false, 'no_homoglyph_names' => false,
'no_unneeded_final_method' => false, // 'no_unneeded_final_method' => false,
'non_printable_character' => false, 'non_printable_character' => false,
'ordered_traits' => false, 'ordered_traits' => false,
'php_unit_mock_short_will_return' => false, 'php_unit_mock_short_will_return' => false,

View File

@ -9,6 +9,6 @@ parameters:
tasks.license.holder: Champs-Libres tasks.license.holder: Champs-Libres
tasks.license.date_from: 2001 tasks.license.date_from: 2001
tasks.phpcsfixer.allow_risky: false tasks.phpcsfixer.allow_risky: true
tasks.phpcsfixer.diff: true tasks.phpcsfixer.diff: true
tasks.phpstan.level: 1 tasks.phpstan.level: 1

View File

@ -72,7 +72,7 @@ class ActivityReasonAggregator implements AggregatorInterface, ExportElementVali
array_key_exists('activity', $join) array_key_exists('activity', $join)
&& !$this->checkJoinAlreadyDefined($join['activity'], 'reasons') && !$this->checkJoinAlreadyDefined($join['activity'], 'reasons')
) )
or (!array_key_exists('activity', $join)) || (!array_key_exists('activity', $join))
) { ) {
$qb->add( $qb->add(
'join', 'join',

View File

@ -152,7 +152,7 @@ class TimelineActivityProvider implements TimelineProviderInterface
$associationMapping = $metadataActivity->getAssociationMapping('person'); $associationMapping = $metadataActivity->getAssociationMapping('person');
$role = new Role('CHILL_ACTIVITY_SEE'); $role = new Role('CHILL_ACTIVITY_SEE');
$reachableScopes = $this->helper->getReachableScopes($this->user, $role->getRole(), $person->getCenter()); $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 = []; $scopes_ids = [];
// first parameter: activity.person_id // first parameter: activity.person_id

View File

@ -35,7 +35,7 @@ class Version20160222103457 extends AbstractMigration
// try to keep at least on activity reason... // try to keep at least on activity reason...
$this->addSql( $this->addSql(
'UPDATE activity 'UPDATE activity
SET reason_id=rid SET reason_id=rid
FROM ( FROM (
SELECT activity_id AS aid, MIN(activityreason_id) AS rid SELECT activity_id AS aid, MIN(activityreason_id) AS rid

View File

@ -111,7 +111,7 @@ abstract class AbstractElementController extends Controller
$form->handleRequest($request); $form->handleRequest($request);
if ($form->isSubmitted() and $form->isValid()) { if ($form->isSubmitted() && $form->isValid()) {
$em = $this->getDoctrine()->getManager(); $em = $this->getDoctrine()->getManager();
$em->flush(); $em->flush();
@ -146,7 +146,7 @@ abstract class AbstractElementController extends Controller
$form->handleRequest($request); $form->handleRequest($request);
if ($form->isSubmitted() and $form->isValid()) { if ($form->isSubmitted() && $form->isValid()) {
$em = $this->getDoctrine()->getManager(); $em = $this->getDoctrine()->getManager();
$em->persist($element); $em->persist($element);
$em->flush(); $em->flush();

View File

@ -63,7 +63,7 @@ class BudgetElementVoter extends AbstractChillVoter implements ProvideRoleHierar
protected function supports($attribute, $subject) protected function supports($attribute, $subject)
{ {
return (in_array($attribute, self::ROLES) && $subject instanceof AbstractElement) 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) protected function voteOnAttribute($attribute, $subject, \Symfony\Component\Security\Core\Authentication\Token\TokenInterface $token)

View File

@ -160,7 +160,7 @@ class CalendarController extends AbstractController
return $this->redirectToRoute('chill_calendar_calendar_list', $params); 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')); $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); 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')); $this->addFlash('error', $this->get('translator')->trans('This form contains errors'));
} }

View File

@ -24,7 +24,7 @@ class CalendarRangeAPIController extends ApiController
{ {
$em = $this->getDoctrine()->getManager(); $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)'; WHERE NOT EXISTS (SELECT cal.id FROM ChillCalendarBundle:Calendar cal WHERE cal.calendarRange = c.id)';
if ($request->query->has('user')) { if ($request->query->has('user')) {

View File

@ -197,7 +197,7 @@ class CreateFieldsOnGroupCommand extends Command
$em->persist($cf); $em->persist($cf);
$output->writeln('<info>Adding Custom Field of type ' $output->writeln('<info>Adding Custom Field of type '
. $cf->getType() . "\t with slug " . $cf->getSlug() . . $cf->getType() . "\t with slug " . $cf->getSlug() .
"\t and names : " . implode($names, ', ') . '</info>'); "\t and names : " . implode(', ', $names) . '</info>');
} else { } else {
throw new RuntimeException('Error in field ' . $slug); throw new RuntimeException('Error in field ' . $slug);
} }

View File

@ -15,6 +15,6 @@ abstract class AbstractCustomField implements CustomFieldInterface
{ {
public function isEmptyValue($value, CustomField $customField) public function isEmptyValue($value, CustomField $customField)
{ {
return empty($value) and false !== $value; return empty($value) && false !== $value;
} }
} }

View File

@ -191,7 +191,7 @@ class CustomFieldChoice extends AbstractCustomField
if ($this->allowOtherChoice($cf)) { if ($this->allowOtherChoice($cf)) {
$labels = $cf->getOptions()[self::OTHER_VALUE_LABEL]; $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'; $labels['back'] = 'other value';
} }
$choices['_other'] = $this->translatableStringHelper $choices['_other'] = $this->translatableStringHelper

View File

@ -59,7 +59,7 @@ class CustomFieldNumber extends AbstractCustomField
$options = $customField->getOptions(); $options = $customField->getOptions();
//select the type depending to the SCALE //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; IntegerType::class : NumberType::class;
//'integer' : 'number'; //'integer' : 'number';

View File

@ -63,7 +63,7 @@ class CustomFieldText extends AbstractCustomField
$attrArray = []; $attrArray = [];
if (array_key_exists(self::MULTIPLE_CF_INLINE, $options) 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'; $attrArray['class'] = 'multiple-cf-inline';
} }

View File

@ -104,7 +104,7 @@ class CustomFieldsGroup
foreach ($this->customFields as $cf) { foreach ($this->customFields as $cf) {
if ($cf->isActive()) { if ($cf->isActive()) {
array_push($this->activeCustomFields, $cf); $this->activeCustomFields[] = $cf;
} }
} }
} }

View File

@ -43,12 +43,10 @@ class CustomFieldsGroupToIdTransformer implements DataTransformerInterface
if ($id instanceof CustomFieldsGroup) { if ($id instanceof CustomFieldsGroup) {
throw new TransformationFailedException( 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,' . 'reverseTransform is an object of type int,'
. 'Chill\CustomFieldsBundle\Entity\CustomFieldsGroup, ' . 'Chill\CustomFieldsBundle\Entity\CustomFieldsGroup, '
. 'given' . 'given'
)
); );
} }

View File

@ -33,7 +33,7 @@ class HouseholdMemberSelectionContext implements DocGeneratorContextInterface
$persons = $entity->getAccompanyingPeriodWork()->getPersons(); $persons = $entity->getAccompanyingPeriodWork()->getPersons();
if (sizeof($persons) > 0) { if (count($persons) > 0) {
$firstPerson = $persons[0]; $firstPerson = $persons[0];
$datas['setValues'][] = [ $datas['setValues'][] = [

View File

@ -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')); $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()]); 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')); $this->addFlash('error', $this->translator->trans('This form contains errors'));
} }

View File

@ -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')); $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()]); 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')); $this->addFlash('error', $this->translator->trans('This form contains errors'));
} }

View File

@ -742,7 +742,7 @@ class ParticipationController extends AbstractController
$single = $request->query->has('person_id'); $single = $request->query->has('person_id');
$multiple = $request->query->has('persons_ids'); $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 // 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 " throw new RuntimeException("You are not allow to provide both 'person_id' and "
. "'persons_ids' simulaneously"); . "'persons_ids' simulaneously");

View File

@ -135,7 +135,7 @@ class EventSearch extends AbstractSearch
public function supports($domain, $format) public function supports($domain, $format)
{ {
return 'event' === $domain or 'events' === $domain; return 'event' === $domain || 'events' === $domain;
} }
protected function composeQuery(QueryBuilder &$qb, $terms) protected function composeQuery(QueryBuilder &$qb, $terms)
@ -171,8 +171,8 @@ class EventSearch extends AbstractSearch
} }
if ( if (
(isset($terms['name']) or isset($terms['_default'])) (isset($terms['name']) || isset($terms['_default']))
and (!empty($terms['name']) or !empty($terms['_default']))) { && (!empty($terms['name']) || !empty($terms['_default']))) {
// the form with name:"xyz" has precedence // the form with name:"xyz" has precedence
$name = $terms['name'] ?? $terms['_default']; $name = $terms['name'] ?? $terms['_default'];

View File

@ -63,7 +63,7 @@ class FamilyMemberVoter extends AbstractChillVoter implements ProvideRoleHierarc
protected function supports($attribute, $subject) protected function supports($attribute, $subject)
{ {
return (in_array($attribute, self::ROLES) && $subject instanceof FamilyMember) 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) protected function voteOnAttribute($attribute, $subject, \Symfony\Component\Security\Core\Authentication\Token\TokenInterface $token)

View File

@ -99,11 +99,11 @@ class LoadAndUpdateLanguagesCommand extends Command
$excludeCode = ( $excludeCode = (
( (
!$input->getOption(self::INCLUDE_REGIONAL_VERSION) !$input->getOption(self::INCLUDE_REGIONAL_VERSION)
and strpos($code, '_') && strpos($code, '_')
and !in_array($code, $this->regionalVersionToInclude) && !in_array($code, $this->regionalVersionToInclude)
) or ( ) || (
!$input->getOption(self::INCLUDE_ANCIENT) !$input->getOption(self::INCLUDE_ANCIENT)
and in_array($code, $this->ancientToExclude) && in_array($code, $this->ancientToExclude)
) )
); );

View File

@ -222,20 +222,20 @@ class ExportController extends AbstractController
'csrf_protection' => $isGenerate ? false : true, 'csrf_protection' => $isGenerate ? false : true,
]); ]);
if ('centers' === $step or 'generate_centers' === $step) { if ('centers' === $step || 'generate_centers' === $step) {
$builder->add('centers', PickCenterType::class, [ $builder->add('centers', PickCenterType::class, [
'export_alias' => $alias, 'export_alias' => $alias,
]); ]);
} }
if ('export' === $step or 'generate_export' === $step) { if ('export' === $step || 'generate_export' === $step) {
$builder->add('export', ExportType::class, [ $builder->add('export', ExportType::class, [
'export_alias' => $alias, 'export_alias' => $alias,
'picked_centers' => $exportManager->getPickedCenters($data['centers']), 'picked_centers' => $exportManager->getPickedCenters($data['centers']),
]); ]);
} }
if ('formatter' === $step or 'generate_formatter' === $step) { if ('formatter' === $step || 'generate_formatter' === $step) {
$builder->add('formatter', FormatterType::class, [ $builder->add('formatter', FormatterType::class, [
'formatter_alias' => $exportManager 'formatter_alias' => $exportManager
->getFormatterAlias($data['export']), ->getFormatterAlias($data['export']),
@ -388,7 +388,7 @@ class ExportController extends AbstractController
$dataFormatter = $this->session->get('formatter_step_raw', null); $dataFormatter = $this->session->get('formatter_step_raw', null);
$dataExport = $this->session->get('export_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', [ return $this->redirectToRoute('chill_main_export_new', [
'alias' => $alias, 'step' => $this->getNextStep('generate', $export, true), 'alias' => $alias, 'step' => $this->getNextStep('generate', $export, true),
]); ]);

View File

@ -57,7 +57,7 @@ class LoadPostalCodes extends AbstractFixture implements OrderedFixtureInterface
1315,INCOURT,BE 1315,INCOURT,BE
1315,INCOURT,BE 1315,INCOURT,BE
1315,INCOURT,BE 1315,INCOURT,BE
1320,BEAUVECHAIN,BE 1320,BEAUVECHAIN,BE
EOF; EOF;
private static $postalCodeFrance = <<<'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 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,ST GILLES CROIX DE VIE,FR,85222,46.6904708814,-1.91946363327,INSEE
85800,LE FENOUILLER,FR,85088,46.7161264566,-1.89206667498,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; EOF;
public function getOrder() public function getOrder()

View File

@ -353,8 +353,8 @@ class User implements AdvancedUserInterface
public function removeGroupCenter(GroupCenter $groupCenter) public function removeGroupCenter(GroupCenter $groupCenter)
{ {
if ($this->groupCenters->removeElement($groupCenter) === false) { if ($this->groupCenters->removeElement($groupCenter) === false) {
throw new RuntimeException(sprintf('The groupCenter could not be removed, ' throw new RuntimeException('The groupCenter could not be removed, '
. 'it seems not to be associated with the user. Aborting.')); . 'it seems not to be associated with the user. Aborting.');
} }
} }

View File

@ -346,7 +346,7 @@ class ExportManager
foreach ($this->exports as $export) { foreach ($this->exports as $export) {
if (!in_array($export->getType(), $existingTypes)) { 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) { foreach ($this->retrieveUsedAggregators($data) as $alias => $aggregator) {
if (!in_array($aggregator->applyOn(), $usedTypes)) { if (!in_array($aggregator->applyOn(), $usedTypes)) {
array_push($usedTypes, $aggregator->applyOn()); $usedTypes[] = $aggregator->applyOn();
} }
} }
@ -718,7 +718,7 @@ class ExportManager
$filter = $this->getFilter($alias); $filter = $this->getFilter($alias);
if (!in_array($filter->applyOn(), $usedTypes)) { if (!in_array($filter->applyOn(), $usedTypes)) {
array_push($usedTypes, $filter->applyOn()); $usedTypes[] = $filter->applyOn();
} }
} }
} }

View File

@ -210,7 +210,7 @@ class Paginator implements PaginatorInterface
public function hasPage($number) public function hasPage($number)
{ {
return 0 < $number return 0 < $number
and $this->countPages() >= $number; && $this->countPages() >= $number;
} }
/** /**

View File

@ -42,7 +42,7 @@ class UserProvider implements UserProviderInterface
->getSingleResult(); ->getSingleResult();
} catch (NoResultException $e) { } catch (NoResultException $e) {
throw new UsernameNotFoundException( throw new UsernameNotFoundException(
sprintf('Bad credentials.'), 'Bad credentials.',
0, 0,
$e $e
); );

View File

@ -57,7 +57,7 @@ class DiscriminatedObjectDenormalizer implements ContextAwareDenormalizerInterfa
} }
if (0 === count($context[self::ALLOWED_TYPES] ?? [])) { 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'); allowed types');
} }

View File

@ -109,7 +109,7 @@ abstract class AbstractAggregatorTest extends KernelTestCase
$this->assertGreaterThanOrEqual( $this->assertGreaterThanOrEqual(
$nbOfFrom, $nbOfFrom,
$query->getDQLPart('from') !== null ? count($query->getDQLPart('from')) : 0, $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" altered the query"
); );
$this->assertGreaterThanOrEqual( $this->assertGreaterThanOrEqual(

View File

@ -99,7 +99,7 @@ abstract class AbstractFilterTest extends KernelTestCase
$this->assertGreaterThanOrEqual( $this->assertGreaterThanOrEqual(
$nbOfFrom, $nbOfFrom,
$query->getDQLPart('from') !== null ? count($query->getDQLPart('from')) : 0, $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" altered the query"
); );
$this->assertGreaterThanOrEqual( $this->assertGreaterThanOrEqual(

View File

@ -68,7 +68,7 @@ final class Version20180709181423 extends AbstractMigration
CREATE TRIGGER canonicalize_user_on_update CREATE TRIGGER canonicalize_user_on_update
AFTER UPDATE AFTER UPDATE
ON users ON users
FOR EACH ROW FOR EACH ROW
EXECUTE PROCEDURE canonicalize_user_on_update(); EXECUTE PROCEDURE canonicalize_user_on_update();
SQL SQL
); );
@ -91,7 +91,7 @@ final class Version20180709181423 extends AbstractMigration
CREATE TRIGGER canonicalize_user_on_insert CREATE TRIGGER canonicalize_user_on_insert
AFTER INSERT AFTER INSERT
ON users ON users
FOR EACH ROW FOR EACH ROW
EXECUTE PROCEDURE canonicalize_user_on_insert(); EXECUTE PROCEDURE canonicalize_user_on_insert();
SQL SQL
); );

View File

@ -28,7 +28,7 @@ final class Version20180911093642 extends AbstractMigration
CREATE TRIGGER canonicalize_user_on_update CREATE TRIGGER canonicalize_user_on_update
AFTER UPDATE AFTER UPDATE
ON users ON users
FOR EACH ROW FOR EACH ROW
EXECUTE PROCEDURE canonicalize_user_on_update(); EXECUTE PROCEDURE canonicalize_user_on_update();
SQL SQL
); );
@ -43,7 +43,7 @@ final class Version20180911093642 extends AbstractMigration
CREATE TRIGGER canonicalize_user_on_update CREATE TRIGGER canonicalize_user_on_update
AFTER UPDATE AFTER UPDATE
ON users ON users
FOR EACH ROW FOR EACH ROW
WHEN (pg_trigger_depth() = 0) WHEN (pg_trigger_depth() = 0)
EXECUTE PROCEDURE canonicalize_user_on_update(); EXECUTE PROCEDURE canonicalize_user_on_update();
SQL SQL

View File

@ -141,7 +141,7 @@ class HouseholdApiController extends ApiController
foreach ($allHouseholds as $h) { foreach ($allHouseholds as $h) {
if ($h !== $currentHouseholdPerson) { if ($h !== $currentHouseholdPerson) {
array_push($households, $h); $households[] = $h;
} }
} }

View File

@ -192,7 +192,7 @@ class HouseholdController extends AbstractController
$form->handleRequest($request); $form->handleRequest($request);
if ($form->isSubmitted() and $form->isValid()) { if ($form->isSubmitted() && $form->isValid()) {
$this->getDoctrine()->getManager()->flush(); $this->getDoctrine()->getManager()->flush();
$this->addFlash('success', $this->translator->trans('household.data_saved')); $this->addFlash('success', $this->translator->trans('household.data_saved'));

View File

@ -190,7 +190,7 @@ class PersonAddressController extends AbstractController
$form = $this->createEditForm($person, $address); $form = $this->createEditForm($person, $address);
$form->handleRequest($request); $form->handleRequest($request);
if ($form->isSubmitted() and $form->isValid()) { if ($form->isSubmitted() && $form->isValid()) {
$validatePersonErrors = $this->validatePerson($person); $validatePersonErrors = $this->validatePerson($person);
if (count($validatePersonErrors) !== 0) { if (count($validatePersonErrors) !== 0) {

View File

@ -599,7 +599,7 @@ class Person implements HasCenterInterface, TrackCreationInterface, TrackUpdateI
public function checkAccompanyingPeriodsAreNotCollapsing() public function checkAccompanyingPeriodsAreNotCollapsing()
{ {
$periods = $this->getAccompanyingPeriodsOrdered(); $periods = $this->getAccompanyingPeriodsOrdered();
$periodsNbr = sizeof($periods); $periodsNbr = count($periods);
$i = 0; $i = 0;
while ($periodsNbr - 1 > $i) { while ($periodsNbr - 1 > $i) {

View File

@ -310,7 +310,7 @@ class ListPerson implements ListInterface, ExportElementValidatedInterface
foreach ($this->getCustomFields() as $cf) { foreach ($this->getCustomFields() as $cf) {
$cfType = $this->customFieldProvider->getCustomFieldByType($cf->getType()); $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) { foreach ($cfType->getChoices($cf) as $choiceSlug => $label) {
$slug = $this->slugToDQL($cf->getSlug(), 'choice', ['choiceSlug' => $choiceSlug]); $slug = $this->slugToDQL($cf->getSlug(), 'choice', ['choiceSlug' => $choiceSlug]);
$qb->addSelect( $qb->addSelect(
@ -426,7 +426,7 @@ class ListPerson implements ListInterface, ExportElementValidatedInterface
->render(json_decode($value, true), $cf, 'csv'); ->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) { return function ($value) use ($cf, $cfType, $key) {
$slugChoice = $this->extractInfosFromSlug($key)['additionnalInfos']['choiceSlug']; $slugChoice = $this->extractInfosFromSlug($key)['additionnalInfos']['choiceSlug'];
$decoded = \json_decode($value, true); $decoded = \json_decode($value, true);
@ -438,7 +438,7 @@ class ListPerson implements ListInterface, ExportElementValidatedInterface
. ' | ' . $label; . ' | ' . $label;
} }
if ('_other' === $slugChoice and $cfType->isChecked($cf, $choiceSlug, $decoded)) { if ('_other' === $slugChoice && $cfType->isChecked($cf, $choiceSlug, $decoded)) {
return $cfType->extractOtherValue($cf, $decoded); return $cfType->extractOtherValue($cf, $decoded);
} }

View File

@ -167,23 +167,23 @@ class ListPersonDuplicate implements DirectExportInterface, ExportElementValidat
SIMILARITY(p.fullnamecanonical, p2.fullnamecanonical) AS "similarity nom + prenom", SIMILARITY(p.fullnamecanonical, p2.fullnamecanonical) AS "similarity nom + prenom",
SIMILARITY(p.lastname, p2.lastname) AS "similarity nom", SIMILARITY(p.lastname, p2.lastname) AS "similarity nom",
SIMILARITY(p.firstname, p2.firstname) AS "similarity prenom" SIMILARITY(p.firstname, p2.firstname) AS "similarity prenom"
FROM chill_person_person AS p FROM chill_person_person AS p
JOIN chill_person_person AS p2 JOIN chill_person_person AS p2
ON p.id != p2.id ON p.id != p2.id
AND (SIMILARITY(p.fullnamecanonical, p2.fullnamecanonical) > :precision AND (SIMILARITY(p.fullnamecanonical, p2.fullnamecanonical) > :precision
AND p.id < p2.id) AND p.id < p2.id)
OR (UNACCENT(LOWER(p.firstname)) = UNACCENT(LOWER(p2.lastname)) OR (UNACCENT(LOWER(p.firstname)) = UNACCENT(LOWER(p2.lastname))
AND UNACCENT(LOWER(p.lastname)) = UNACCENT(LOWER(p2.firstname))) AND UNACCENT(LOWER(p.lastname)) = UNACCENT(LOWER(p2.firstname)))
JOIN centers AS p1center JOIN centers AS p1center
ON p1center.id = p.center_id ON p1center.id = p.center_id
JOIN centers AS p2center JOIN centers AS p2center
ON p2center.id = p2.center_id ON p2center.id = p2.center_id
WHERE NOT EXISTS ( WHERE NOT EXISTS (
SELECT id SELECT id
FROM chill_person_not_duplicate as pnd FROM chill_person_not_duplicate as pnd
WHERE (pnd.person1_id = p.id WHERE (pnd.person1_id = p.id
AND pnd.person2_id = p2.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) AND pnd.person1_id = p2.id)
) )
ORDER BY p.fullnamecanonical, p.id, p2.id'; ORDER BY p.fullnamecanonical, p.id, p2.id';

View File

@ -64,8 +64,8 @@ class AccompanyingPeriodType extends AbstractType
if ( if (
('close' === $options['period_action']) ('close' === $options['period_action'])
or ('create' === $options['period_action']) || ('create' === $options['period_action'])
or ('update' === $options['period_action'] and !$accompanyingPeriod->isOpen()) || ('update' === $options['period_action'] && !$accompanyingPeriod->isOpen())
) { ) {
$builder->add('closingDate', DateType::class, [ $builder->add('closingDate', DateType::class, [
'required' => true, 'required' => true,

View File

@ -25,10 +25,10 @@ final class HouseholdRepository implements ObjectRepository
FROM chill_person_accompanying_period_participation AS part FROM chill_person_accompanying_period_participation AS part
WHERE person_id = ?), WHERE person_id = ?),
other_participants AS ( other_participants AS (
SELECT person_id, startDate, endDate SELECT person_id, startDate, endDate
FROM chill_person_accompanying_period_participation FROM chill_person_accompanying_period_participation
JOIN participations USING (accompanyingperiod_id) JOIN participations USING (accompanyingperiod_id)
WHERE person_id != ? WHERE person_id != ?
), ),
households AS (SELECT DISTINCT household.* households AS (SELECT DISTINCT household.*
FROM chill_person_household_members AS hmembers FROM chill_person_household_members AS hmembers

View File

@ -226,8 +226,8 @@ class PersonControllerUpdateTest extends WebTestCase
'a element .success is shown' 'a element .success is shown'
); );
if ('birthdate' == $field or 'memo' == $field or 'countryOfBirth' == $field or 'nationality' == $field if ('birthdate' == $field || 'memo' == $field || 'countryOfBirth' == $field || 'nationality' == $field
or 'gender' == $field) { || 'gender' == $field) {
// we do not perform test on the web page contents. // we do not perform test on the web page contents.
} else { } else {
$this->assertGreaterThan(0, $crawler->filter('html:contains("' . $value . '")')->count()); $this->assertGreaterThan(0, $crawler->filter('html:contains("' . $value . '")')->count());

View File

@ -160,8 +160,8 @@ class PersonControllerUpdateWithHiddenFieldsTest extends WebTestCase
'a element .success is shown' 'a element .success is shown'
); );
if ('birthdate' == $field or 'memo' == $field or 'countryOfBirth' == $field or 'nationality' == $field if ('birthdate' == $field || 'memo' == $field || 'countryOfBirth' == $field || 'nationality' == $field
or 'gender' == $field) { || 'gender' == $field) {
// we do not perform test on the web page contents. // we do not perform test on the web page contents.
} else { } else {
$this->assertGreaterThan(0, $crawler->filter('html:contains("' . $value . '")')->count()); $this->assertGreaterThan(0, $crawler->filter('html:contains("' . $value . '")')->count());
@ -216,7 +216,7 @@ class PersonControllerUpdateWithHiddenFieldsTest extends WebTestCase
private function getVeryLongText() private function getVeryLongText()
{ {
return <<<'EOT' 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; EOT;
} }
} }

View File

@ -36,7 +36,7 @@ class Version20160422000000 extends AbstractMigration
} }
$this->abortIf( $this->abortIf(
sizeof($personWithTwoAddressWithSameValidFrom) != 0, count($personWithTwoAddressWithSameValidFrom) != 0,
'There exists some person with multiple adress with the same validFrom' 'There exists some person with multiple adress with the same validFrom'
); );
} }

View File

@ -62,19 +62,19 @@ class Version20170117131924 extends AbstractMigration
before_date date) before_date date)
RETURNS TABLE( RETURNS TABLE(
person_id integer, person_id integer,
address_id integer, address_id integer,
streetaddress1 varchar(255), streetaddress1 varchar(255),
streetaddress2 varchar(255), streetaddress2 varchar(255),
validfrom date, validfrom date,
postcode_label varchar(255), postcode_label varchar(255),
postcode_code varchar(100), postcode_code varchar(100),
postcode_id integer, postcode_id integer,
country_name json, country_name json,
country_code varchar(3), country_code varchar(3),
country_id integer) country_id integer)
AS AS
$BODY$ $BODY$
SELECT SELECT
pid AS person_id, pid AS person_id,
chill_main_address.id AS address_id, chill_main_address.id AS address_id,
chill_main_address.streetaddress1, chill_main_address.streetaddress1,
@ -88,11 +88,11 @@ class Version20170117131924 extends AbstractMigration
country.id AS country_id country.id AS country_id
FROM chill_main_address FROM chill_main_address
JOIN ( JOIN (
SELECT SELECT
chill_main_address.id AS address_id, chill_main_address.id AS address_id,
validfrom, validfrom,
rank() OVER (PARTITION BY person_id ORDER BY validfrom DESC) as pos 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 JOIN chill_main_address ON chill_person_persons_to_addresses.address_id = chill_main_address.id
WHERE person_id = pid WHERE person_id = pid
AND chill_main_address.validfrom <= before_date AND chill_main_address.validfrom <= before_date

View File

@ -30,19 +30,19 @@ final class Version20200422125935 extends AbstractMigration
before_date date) before_date date)
RETURNS TABLE( RETURNS TABLE(
person_id integer, person_id integer,
address_id integer, address_id integer,
streetaddress1 varchar(255), streetaddress1 varchar(255),
streetaddress2 varchar(255), streetaddress2 varchar(255),
validfrom date, validfrom date,
postcode_label varchar(255), postcode_label varchar(255),
postcode_code varchar(100), postcode_code varchar(100),
postcode_id integer, postcode_id integer,
country_name json, country_name json,
country_code varchar(3), country_code varchar(3),
country_id integer) country_id integer)
AS AS
$BODY$ $BODY$
SELECT SELECT
pid AS person_id, pid AS person_id,
chill_main_address.id AS address_id, chill_main_address.id AS address_id,
chill_main_address.streetaddress1, chill_main_address.streetaddress1,
@ -56,11 +56,11 @@ final class Version20200422125935 extends AbstractMigration
country.id AS country_id country.id AS country_id
FROM chill_main_address FROM chill_main_address
JOIN ( JOIN (
SELECT SELECT
chill_main_address.id AS address_id, chill_main_address.id AS address_id,
validfrom, validfrom,
rank() OVER (PARTITION BY person_id ORDER BY validfrom DESC) as pos 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 JOIN chill_main_address ON chill_person_persons_to_addresses.address_id = chill_main_address.id
WHERE person_id = pid WHERE person_id = pid
AND chill_main_address.validfrom <= before_date AND chill_main_address.validfrom <= before_date
@ -85,20 +85,20 @@ final class Version20200422125935 extends AbstractMigration
before_date date) before_date date)
RETURNS TABLE( RETURNS TABLE(
person_id integer, person_id integer,
address_id integer, address_id integer,
streetaddress1 varchar(255), streetaddress1 varchar(255),
streetaddress2 varchar(255), streetaddress2 varchar(255),
validfrom date, validfrom date,
postcode_label varchar(255), postcode_label varchar(255),
postcode_code varchar(100), postcode_code varchar(100),
postcode_id integer, postcode_id integer,
isnoaddress boolean, isnoaddress boolean,
country_name json, country_name json,
country_code varchar(3), country_code varchar(3),
country_id integer) country_id integer)
AS AS
$BODY$ $BODY$
SELECT SELECT
pid AS person_id, pid AS person_id,
chill_main_address.id AS address_id, chill_main_address.id AS address_id,
chill_main_address.streetaddress1, chill_main_address.streetaddress1,
@ -113,11 +113,11 @@ final class Version20200422125935 extends AbstractMigration
country.id AS country_id country.id AS country_id
FROM chill_main_address FROM chill_main_address
JOIN ( JOIN (
SELECT SELECT
chill_main_address.id AS address_id, chill_main_address.id AS address_id,
validfrom, validfrom,
rank() OVER (PARTITION BY person_id ORDER BY validfrom DESC) as pos 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 JOIN chill_main_address ON chill_person_persons_to_addresses.address_id = chill_main_address.id
WHERE person_id = pid WHERE person_id = pid
AND chill_main_address.validfrom <= before_date AND chill_main_address.validfrom <= before_date

View File

@ -64,7 +64,7 @@ class LoadCustomField extends AbstractFixture implements OrderedFixtureInterface
]; ];
for ($i = 0; 25 >= $i; ++$i) { for ($i = 0; 25 >= $i; ++$i) {
$cFType = $cFTypes[rand(0, sizeof($cFTypes) - 1)]; $cFType = $cFTypes[rand(0, count($cFTypes) - 1)];
$customField = (new CustomField()) $customField = (new CustomField())
->setSlug("cf_report_{$i}") ->setSlug("cf_report_{$i}")

View File

@ -417,7 +417,7 @@ class ReportList implements ListInterface, ExportElementValidatedInterface
$cfType = $this->customFieldProvider->getCustomFieldByType($cf->getType()); $cfType = $this->customFieldProvider->getCustomFieldByType($cf->getType());
// if is multiple, split into multiple columns // 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) { foreach ($cfType->getChoices($cf) as $choiceSlug => $label) {
$slug = $this->slugToDQL($cf->getSlug(), 'choice', ['choiceSlug' => $choiceSlug]); $slug = $this->slugToDQL($cf->getSlug(), 'choice', ['choiceSlug' => $choiceSlug]);
$qb->addSelect( $qb->addSelect(
@ -525,7 +525,7 @@ class ReportList implements ListInterface, ExportElementValidatedInterface
->render(json_decode($value, true), $cf, 'csv'); ->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) { return function ($value) use ($cf, $cfType, $key) {
$slugChoice = $this->extractInfosFromSlug($key)['additionnalInfos']['choiceSlug']; $slugChoice = $this->extractInfosFromSlug($key)['additionnalInfos']['choiceSlug'];
$decoded = \json_decode($value, true); $decoded = \json_decode($value, true);
@ -537,7 +537,7 @@ class ReportList implements ListInterface, ExportElementValidatedInterface
. ' | ' . $label; . ' | ' . $label;
} }
if ('_other' === $slugChoice and $cfType->isChecked($cf, $choiceSlug, $decoded)) { if ('_other' === $slugChoice && $cfType->isChecked($cf, $choiceSlug, $decoded)) {
return $cfType->extractOtherValue($cf, $decoded); return $cfType->extractOtherValue($cf, $decoded);
} }

View File

@ -187,7 +187,7 @@ class SingleTaskRepository extends EntityRepository
$this->buildACLQuery($qb, $currentUser); $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->andWhere($qb->expr()->eq('st.person', ':person'));
$qb->setParameter('person', $params['person']); $qb->setParameter('person', $params['person']);
} elseif (array_key_exists('center', $params)) { } 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('unassigned', $params) && true === $params['unassigned']) {
if (array_key_exists('user', $params) and !empty($params['user'])) { if (array_key_exists('user', $params) && !empty($params['user'])) {
throw new UnexpectedValueException('You should not require for ' throw new UnexpectedValueException('You should not require for '
. 'unassigned tasks and tasks assigned to some user.'); . 'unassigned tasks and tasks assigned to some user.');
} }
@ -209,12 +209,12 @@ class SingleTaskRepository extends EntityRepository
$qb->andWhere($qb->expr()->isNull('st.assignee')); $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->andWhere($qb->expr()->eq('st.assignee', ':user'));
$qb->setParameter('user', $params['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->andWhere($qb->expr()->eq('st.circle', ':scope'));
$qb->setParameter('scope', $params['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); $this->addTypeFilter($qb, $params);
} }

View File

@ -97,7 +97,7 @@ class ThirdPartySearch implements SearchInterface
public function supports($domain, $format): bool 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 protected function count($centers, $terms): int