Merge remote-tracking branch 'origin/master' into features/docgen-widget-generate-template

This commit is contained in:
2021-11-30 16:38:36 +01:00
1055 changed files with 5050 additions and 2165 deletions

View File

@@ -7,6 +7,8 @@
* the LICENSE file that was distributed with this source code.
*/
declare(strict_types=1);
namespace Chill\PersonBundle\AccompanyingPeriod\SocialIssueConsistency;
use Chill\PersonBundle\Entity\AccompanyingPeriod;

View File

@@ -7,6 +7,8 @@
* the LICENSE file that was distributed with this source code.
*/
declare(strict_types=1);
namespace Chill\PersonBundle\AccompanyingPeriod\SocialIssueConsistency;
use Chill\PersonBundle\Entity\AccompanyingPeriod;

View File

@@ -7,6 +7,8 @@
* the LICENSE file that was distributed with this source code.
*/
declare(strict_types=1);
namespace Chill\PersonBundle\AccompanyingPeriod\Suggestion;
use Chill\MainBundle\Entity\User;

View File

@@ -7,6 +7,8 @@
* the LICENSE file that was distributed with this source code.
*/
declare(strict_types=1);
namespace Chill\PersonBundle\AccompanyingPeriod\Suggestion;
use Chill\MainBundle\Entity\User;

View File

@@ -7,6 +7,8 @@
* the LICENSE file that was distributed with this source code.
*/
declare(strict_types=1);
namespace Chill\PersonBundle\Actions;
use Symfony\Component\EventDispatcher\Event;

View File

@@ -7,6 +7,8 @@
* the LICENSE file that was distributed with this source code.
*/
declare(strict_types=1);
namespace Chill\PersonBundle\Actions\Remove;
use Chill\PersonBundle\Actions\ActionEvent;
@@ -82,7 +84,7 @@ class PersonMove
foreach ($metadata->getAssociationMappings() as $field => $mapping) {
if (Person::class === $mapping['targetEntity']) {
if (in_array($metadata->getName(), $toDelete)) {
if (in_array($metadata->getName(), $toDelete, true)) {
$sql = $this->createDeleteSQL($metadata, $from, $field);
$event = new ActionEvent(
$from->getId(),
@@ -127,7 +129,7 @@ class PersonMove
$conditions[] = sprintf('%s = %d', $columns['name'], $from->getId());
}
return \sprintf(
return sprintf(
'DELETE FROM %s WHERE %s',
$this->getTableName($metadata),
implode(' AND ', $conditions)
@@ -151,7 +153,7 @@ class PersonMove
$conditions[] = sprintf('%s = %d', $columns['name'], $from->getId());
}
return \sprintf(
return sprintf(
'UPDATE %s SET %s WHERE %s',
$this->getTableName($metadata),
implode(' ', $sets),

View File

@@ -7,6 +7,8 @@
* the LICENSE file that was distributed with this source code.
*/
declare(strict_types=1);
namespace Chill\PersonBundle\CRUD\Controller;
use Chill\MainBundle\CRUD\Controller\CRUDController;

View File

@@ -7,6 +7,8 @@
* the LICENSE file that was distributed with this source code.
*/
declare(strict_types=1);
namespace Chill\PersonBundle;
use Chill\PersonBundle\DependencyInjection\CompilerPass\AccompanyingPeriodTimelineCompilerPass;

View File

@@ -7,6 +7,8 @@
* the LICENSE file that was distributed with this source code.
*/
declare(strict_types=1);
namespace Chill\PersonBundle\Command;
use Chill\PersonBundle\Actions\Remove\PersonMove;

View File

@@ -7,6 +7,8 @@
* the LICENSE file that was distributed with this source code.
*/
declare(strict_types=1);
namespace Chill\PersonBundle\Command;
use Chill\CustomFieldsBundle\Service\CustomFieldProvider;
@@ -38,8 +40,14 @@ use Symfony\Component\Filesystem\Filesystem;
use Symfony\Component\Form\FormFactory;
use Symfony\Component\Form\FormFactoryInterface;
use function array_key_exists;
use function count;
use function file_get_contents;
use function get_class;
use function in_array;
use function is_array;
use function json_decode;
use const JSON_PRETTY_PRINT;
use const LC_TIME;
final class ImportPeopleFromCSVCommand extends Command
{
@@ -267,7 +275,7 @@ final class ImportPeopleFromCSVCommand extends Command
protected function createPerson(array $row, array $headers): Person
{
// trying to get the opening date
$openingDateString = trim($row[array_search('opening_date', $headers)]);
$openingDateString = trim($row[array_search('opening_date', $headers, true)]);
$openingDate = $this->processDate($openingDateString, $this->input->getOption('opening_date_format'));
// @TODO: Fix the constructor parameter, $openingDate does not exists.
@@ -352,7 +360,7 @@ final class ImportPeopleFromCSVCommand extends Command
}
// handle address
if (\in_array('postalcode', $headers)) {
if (in_array('postalcode', $headers, true)) {
if (!empty($postalCodeValue)) {
$address = new Address();
$postalCode = $this->guessPostalCode($postalCodeValue, $localityValue ?? '');
@@ -363,7 +371,7 @@ final class ImportPeopleFromCSVCommand extends Command
$address->setPostcode($postalCode);
if (\in_array('street1', $headers)) {
if (in_array('street1', $headers, true)) {
$address->setStreetAddress1($street1Value);
}
$address->setValidFrom(new DateTime('today'));
@@ -475,7 +483,7 @@ final class ImportPeopleFromCSVCommand extends Command
return $this->em->getRepository(Center::class)->find($this->input->getOption('force-center'));
}
$columnCenter = array_search('center', $headers);
$columnCenter = array_search('center', $headers, true);
$centerName = trim($row[$columnCenter]);
try {
@@ -516,13 +524,13 @@ final class ImportPeopleFromCSVCommand extends Command
->getResult();
if (count($centers) > 1) {
if (\strtolower($centers[0]->getName()) === \strtolower($centerName)) {
if (strtolower($centers[0]->getName()) === strtolower($centerName)) {
return $centers[0];
}
}
$centersByName = [];
$names = \array_map(function (Center $c) use (&$centersByName) {
$names = array_map(static function (Center $c) use (&$centersByName) {
$n = $c->getName();
$centersByName[$n] = $c;
@@ -605,7 +613,7 @@ final class ImportPeopleFromCSVCommand extends Command
}
$postalCodeByName = [];
$names = \array_map(function (PostalCode $pc) use (&$postalCodeByName) {
$names = array_map(static function (PostalCode $pc) use (&$postalCodeByName) {
$n = $pc->getName();
$postalCodeByName[$n] = $pc;
@@ -693,7 +701,7 @@ final class ImportPeopleFromCSVCommand extends Command
protected function matchColumnToCustomField($row)
{
$cfMappingsOptions = $this->input->getOption('custom-field');
/* @var $em \Doctrine\Persistence\ObjectManager */
/** @var \Doctrine\Persistence\ObjectManager $em */
$em = $this->em;
foreach ($cfMappingsOptions as $cfMappingStringOption) {
@@ -767,9 +775,9 @@ final class ImportPeopleFromCSVCommand extends Command
. 'have the right to read it.');
}
$resource = fopen($filename, 'r');
$resource = fopen($filename, 'rb');
if (false == $resource) {
if (false === $resource) {
throw new RuntimeException("The file '{$filename}' could not be opened.");
}
@@ -855,7 +863,7 @@ final class ImportPeopleFromCSVCommand extends Command
if (!isset($this->cacheAnswersMapping[$cf->getSlug()][$value])) {
// try to find the answer (with array_keys and a search value
$values = array_keys(
array_map(function ($label) { return trim(strtolower($label)); }, $answers),
array_map(static function ($label) { return trim(strtolower($label)); }, $answers),
trim(strtolower($value)),
true
);
@@ -864,7 +872,7 @@ final class ImportPeopleFromCSVCommand extends Command
// we could guess an answer !
$this->logger->info('This question accept multiple answers');
$this->cacheAnswersMapping[$cf->getSlug()][$value] =
false == $view->vars['multiple'] ? $values[0] : [$values[0]];
false === $view->vars['multiple'] ? $values[0] : [$values[0]];
$this->logger->info(sprintf(
"Guessed that value '%s' match with key '%s' "
. 'because the CSV and the label are equals.',
@@ -877,7 +885,7 @@ final class ImportPeopleFromCSVCommand extends Command
$this->output->writeln($this->helper->localize($cf->getName()));
// printing the possible answers
/* @var $table \Symfony\Component\Console\Helper\Table */
/** @var \Symfony\Component\Console\Helper\Table $table */
$table = new Table($this->output);
$table->setHeaders(['#', 'label', 'value']);
$i = 0;
@@ -954,7 +962,7 @@ final class ImportPeopleFromCSVCommand extends Command
}
// we skip if the opening date is now (or after yesterday)
/* @var $period \Chill\PersonBundle\Entity\AccompanyingPeriod */
/** @var \Chill\PersonBundle\Entity\AccompanyingPeriod $period */
$period = $person->getCurrentAccompanyingPeriod();
if ($period->getOpeningDate() > new DateTime('yesterday')) {
@@ -1037,11 +1045,11 @@ final class ImportPeopleFromCSVCommand extends Command
*/
protected function processingCustomFields(Person $person, $row)
{
/* @var $cfProvider \Chill\CustomFieldsBundle\Service\CustomFieldProvider */
/** @var \Chill\CustomFieldsBundle\Service\CustomFieldProvider $cfProvider */
$cfProvider = $this->customFieldProvider;
$cfData = [];
/* @var $$customField \Chill\CustomFieldsBundle\Entity\CustomField */
/** @var \Chill\CustomFieldsBundle\Entity\CustomField $$customField */
foreach ($this->customFieldMapping as $rowNumber => $customField) {
$builder = $this->formFactory->createBuilder();
$cfProvider->getCustomFieldByType($customField->getType())
@@ -1091,8 +1099,8 @@ final class ImportPeopleFromCSVCommand extends Command
foreach ($firstRow as $key => $content) {
$content = trim($content);
if (in_array($content, $matchedColumnHeaders)) {
$information = array_search($content, $matchedColumnHeaders);
if (in_array($content, $matchedColumnHeaders, true)) {
$information = array_search($content, $matchedColumnHeaders, true);
$headers[$key] = $information;
$this->logger->notice("Matched {$information} on column {$key} (displayed in the file as '{$content}')");
} else {
@@ -1139,7 +1147,7 @@ final class ImportPeopleFromCSVCommand extends Command
{
$answers = [];
/* @var $choice \Symfony\Component\Form\ChoiceList\View\ChoiceView */
/** @var \Symfony\Component\Form\ChoiceList\View\ChoiceView $choice */
foreach ($choices as $choice) {
if ($choice instanceof \Symfony\Component\Form\ChoiceList\View\ChoiceView) {
$answers[$choice->value] = $choice->label;

View File

@@ -7,8 +7,12 @@
* the LICENSE file that was distributed with this source code.
*/
declare(strict_types=1);
namespace Chill\PersonBundle\Config;
use function count;
/**
* Give help to interact with the config for alt names.
*/

View File

@@ -7,6 +7,8 @@
* the LICENSE file that was distributed with this source code.
*/
declare(strict_types=1);
namespace Chill\PersonBundle\Controller;
use Chill\MainBundle\CRUD\Controller\ApiController;
@@ -35,6 +37,7 @@ use Symfony\Component\Serializer\Normalizer\AbstractNormalizer;
use Symfony\Component\Validator\Validator\ValidatorInterface;
use Symfony\Component\Workflow\Registry;
use function array_values;
use function count;
final class AccompanyingCourseApiController extends ApiController
{
@@ -249,6 +252,22 @@ final class AccompanyingCourseApiController extends ApiController
);
}
/**
* @Route("/api/1.0/person/accompanying-course/{id}/confidential.json", name="chill_api_person_accompanying_period_confidential")
* @ParamConverter("accompanyingCourse", options={"id": "id"})
*/
public function toggleConfidentialApi(AccompanyingPeriod $accompanyingCourse, Request $request)
{
if ($request->getMethod() === 'POST') {
$this->denyAccessUnlessGranted(AccompanyingPeriodVoter::TOGGLE_CONFIDENTIAL, $accompanyingCourse);
$accompanyingCourse->setConfidential(!$accompanyingCourse->isConfidential());
$this->getDoctrine()->getManager()->flush();
}
return $this->json($accompanyingCourse->isConfidential(), Response::HTTP_OK, [], ['groups' => ['read']]);
}
public function workApi($id, Request $request, string $_format): Response
{
return $this->addRemoveSomething(

View File

@@ -7,6 +7,8 @@
* the LICENSE file that was distributed with this source code.
*/
declare(strict_types=1);
namespace Chill\PersonBundle\Controller;
use Chill\ActivityBundle\Entity\Activity;

View File

@@ -7,6 +7,8 @@
* the LICENSE file that was distributed with this source code.
*/
declare(strict_types=1);
namespace Chill\PersonBundle\Controller;
use Chill\MainBundle\CRUD\Controller\ApiController;

View File

@@ -7,6 +7,8 @@
* the LICENSE file that was distributed with this source code.
*/
declare(strict_types=1);
namespace Chill\PersonBundle\Controller;
use Chill\MainBundle\Pagination\PaginatorFactory;

View File

@@ -7,6 +7,8 @@
* the LICENSE file that was distributed with this source code.
*/
declare(strict_types=1);
namespace Chill\PersonBundle\Controller;
use Chill\PersonBundle\Entity\AccompanyingPeriod;
@@ -26,6 +28,7 @@ use Symfony\Component\HttpFoundation\Response;
use Symfony\Component\Validator\ConstraintViolationListInterface;
use Symfony\Component\Validator\Validator\ValidatorInterface;
use function array_filter;
use function count;
/**
* Class AccompanyingPeriodController.
@@ -318,10 +321,10 @@ class AccompanyingPeriodController extends AbstractController
/** @var Person $person */
$person = $this->_getPerson($person_id);
/* @var $period AccompanyingPeriod */
/** @var AccompanyingPeriod $period */
$period = array_filter(
$person->getAccompanyingPeriods(),
function (AccompanyingPeriod $p) use ($period_id) {
static function (AccompanyingPeriod $p) use ($period_id) {
return $p->getId() === ($period_id);
}
)[0] ?? null;

View File

@@ -7,6 +7,8 @@
* the LICENSE file that was distributed with this source code.
*/
declare(strict_types=1);
namespace Chill\PersonBundle\Controller;
use Chill\MainBundle\CRUD\Controller\CRUDController;

View File

@@ -7,6 +7,8 @@
* the LICENSE file that was distributed with this source code.
*/
declare(strict_types=1);
namespace Chill\PersonBundle\Controller;
use Symfony\Bundle\FrameworkBundle\Controller\AbstractController;

View File

@@ -7,6 +7,8 @@
* the LICENSE file that was distributed with this source code.
*/
declare(strict_types=1);
namespace Chill\PersonBundle\Controller;
use Chill\MainBundle\CRUD\Controller\CRUDController;

View File

@@ -7,6 +7,8 @@
* the LICENSE file that was distributed with this source code.
*/
declare(strict_types=1);
namespace Chill\PersonBundle\Controller;
use Chill\MainBundle\CRUD\Controller\ApiController;
@@ -106,7 +108,7 @@ class HouseholdApiController extends ApiController
$actual = $household->getCurrentAddress();
if (null !== $actual) {
$addresses = array_filter($addresses, fn ($a) => $a !== $actual);
$addresses = array_filter($addresses, static fn ($a) => $a !== $actual);
}
return $this->json(
@@ -141,7 +143,7 @@ class HouseholdApiController extends ApiController
foreach ($allHouseholds as $h) {
if ($h !== $currentHouseholdPerson) {
array_push($households, $h);
$households[] = $h;
}
}

View File

@@ -7,6 +7,8 @@
* the LICENSE file that was distributed with this source code.
*/
declare(strict_types=1);
namespace Chill\PersonBundle\Controller;
use Chill\MainBundle\Entity\Address;
@@ -23,6 +25,8 @@ use Symfony\Component\Security\Core\Security;
use Symfony\Component\Serializer\Normalizer\AbstractNormalizer;
use Symfony\Component\Serializer\SerializerInterface;
use Symfony\Component\Translation\TranslatorInterface;
use function array_key_exists;
use function count;
/**
* @Route("/{_locale}/person/household")
@@ -144,7 +148,7 @@ class HouseholdController extends AbstractController
$cond = true;
for ($i = 0; count($addresses) - 1 > $i; ++$i) {
if ($addresses[$i]->getValidFrom() != $addresses[$i + 1]->getValidTo()) {
if ($addresses[$i]->getValidFrom() !== $addresses[$i + 1]->getValidTo()) {
$cond = false;
}
}
@@ -192,7 +196,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'));

View File

@@ -7,6 +7,8 @@
* the LICENSE file that was distributed with this source code.
*/
declare(strict_types=1);
namespace Chill\PersonBundle\Controller;
use Chill\MainBundle\CRUD\Controller\ApiController;
@@ -25,6 +27,7 @@ use Symfony\Component\Routing\Annotation\Route;
use Symfony\Component\Routing\Generator\UrlGeneratorInterface;
use Symfony\Component\Serializer\Exception;
use Symfony\Component\Translation\TranslatorInterface;
use function count;
class HouseholdMemberController extends ApiController
{
@@ -183,7 +186,7 @@ class HouseholdMemberController extends ApiController
$_format,
['groups' => ['read']]
);
} catch (Exception\InvalidArgumentException | Exception\UnexpectedValueException $e) {
} catch (Exception\InvalidArgumentException|Exception\UnexpectedValueException $e) {
throw new BadRequestException("Deserialization error: {$e->getMessage()}", 45896, $e);
}

View File

@@ -7,6 +7,8 @@
* the LICENSE file that was distributed with this source code.
*/
declare(strict_types=1);
namespace Chill\PersonBundle\Controller;
use Chill\MainBundle\CRUD\Controller\ApiController;

View File

@@ -7,6 +7,8 @@
* the LICENSE file that was distributed with this source code.
*/
declare(strict_types=1);
namespace Chill\PersonBundle\Controller;
use Chill\MainBundle\Entity\Address;
@@ -16,6 +18,7 @@ use Symfony\Bundle\FrameworkBundle\Controller\AbstractController;
use Symfony\Component\Form\Extension\Core\Type\SubmitType;
use Symfony\Component\HttpFoundation\Request;
use Symfony\Component\Validator\Validator\ValidatorInterface;
use function count;
/**
* Class PersonAddressController
@@ -190,7 +193,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) {

View File

@@ -7,6 +7,8 @@
* the LICENSE file that was distributed with this source code.
*/
declare(strict_types=1);
namespace Chill\PersonBundle\Controller;
use Chill\MainBundle\CRUD\Controller\ApiController;
@@ -62,7 +64,7 @@ class PersonApiController extends ApiController
$actual = $person->getCurrentHouseholdAddress();
if (null !== $actual) {
$addresses = array_filter($addresses, fn ($a) => $a !== $actual);
$addresses = array_filter($addresses, static fn ($a) => $a !== $actual);
}
return $this->json(array_values($addresses), Response::HTTP_OK, [], ['groups' => ['read']]);

View File

@@ -7,6 +7,8 @@
* the LICENSE file that was distributed with this source code.
*/
declare(strict_types=1);
namespace Chill\PersonBundle\Controller;
use Chill\PersonBundle\Config\ConfigPersonAltNamesHelper;
@@ -30,6 +32,7 @@ use Symfony\Component\Routing\Annotation\Route;
use Symfony\Component\Security\Core\Security;
use Symfony\Component\Translation\TranslatorInterface;
use Symfony\Component\Validator\Validator\ValidatorInterface;
use function count;
use function hash;
use function implode;
use function in_array;
@@ -360,7 +363,7 @@ final class PersonController extends AbstractController
$ignoredFields = ['form_status', '_token'];
foreach ($request->request->all()[$form->getName()] as $field => $value) {
if (in_array($field, $ignoredFields)) {
if (in_array($field, $ignoredFields, true)) {
continue;
}
$fields[$field] = is_array($value) ?

View File

@@ -7,6 +7,8 @@
* the LICENSE file that was distributed with this source code.
*/
declare(strict_types=1);
namespace Chill\PersonBundle\Controller;
use Chill\ActivityBundle\Entity\Activity;
@@ -27,6 +29,7 @@ use Symfony\Bundle\FrameworkBundle\Controller\Controller;
use Symfony\Component\EventDispatcher\EventDispatcherInterface;
use Symfony\Component\HttpFoundation\Request;
use Symfony\Component\Translation\TranslatorInterface;
use function count;
class PersonDuplicateController extends Controller
{

View File

@@ -7,6 +7,8 @@
* the LICENSE file that was distributed with this source code.
*/
declare(strict_types=1);
namespace Chill\PersonBundle\Controller;
use Chill\MainBundle\CRUD\Controller\ApiController;

View File

@@ -7,6 +7,8 @@
* the LICENSE file that was distributed with this source code.
*/
declare(strict_types=1);
namespace Chill\PersonBundle\Controller\SocialWork;
use Chill\MainBundle\CRUD\Controller\CRUDController;

View File

@@ -7,6 +7,8 @@
* the LICENSE file that was distributed with this source code.
*/
declare(strict_types=1);
namespace Chill\PersonBundle\Controller\SocialWork;
use Chill\MainBundle\CRUD\Controller\CRUDController;

View File

@@ -7,6 +7,8 @@
* the LICENSE file that was distributed with this source code.
*/
declare(strict_types=1);
namespace Chill\PersonBundle\Controller\SocialWork;
use Chill\MainBundle\CRUD\Controller\CRUDController;

View File

@@ -7,6 +7,8 @@
* the LICENSE file that was distributed with this source code.
*/
declare(strict_types=1);
namespace Chill\PersonBundle\Controller\SocialWork;
use Chill\MainBundle\CRUD\Controller\CRUDController;

View File

@@ -7,6 +7,8 @@
* the LICENSE file that was distributed with this source code.
*/
declare(strict_types=1);
namespace Chill\PersonBundle\Controller\SocialWork;
use Chill\MainBundle\CRUD\Controller\CRUDController;

View File

@@ -7,6 +7,8 @@
* the LICENSE file that was distributed with this source code.
*/
declare(strict_types=1);
namespace Chill\PersonBundle\Controller;
use Chill\MainBundle\Pagination\PaginatorFactory;

View File

@@ -7,6 +7,8 @@
* the LICENSE file that was distributed with this source code.
*/
declare(strict_types=1);
namespace Chill\PersonBundle\Controller;
use Chill\MainBundle\CRUD\Controller\ApiController;

View File

@@ -7,6 +7,8 @@
* the LICENSE file that was distributed with this source code.
*/
declare(strict_types=1);
namespace Chill\PersonBundle\Controller;
use Chill\MainBundle\CRUD\Controller\ApiController;

View File

@@ -7,6 +7,8 @@
* the LICENSE file that was distributed with this source code.
*/
declare(strict_types=1);
namespace Chill\PersonBundle\Controller;
use Chill\MainBundle\CRUD\Controller\ApiController;
@@ -15,6 +17,7 @@ use Chill\MainBundle\Serializer\Model\Collection;
use Chill\PersonBundle\Repository\SocialWork\SocialIssueRepository;
use Symfony\Component\HttpFoundation\JsonResponse;
use Symfony\Component\HttpFoundation\Request;
use function count;
class SocialWorkSocialActionApiController extends ApiController
{

View File

@@ -7,6 +7,8 @@
* the LICENSE file that was distributed with this source code.
*/
declare(strict_types=1);
namespace Chill\PersonBundle\DataFixtures\Helper;
use Chill\PersonBundle\Entity\Person;

View File

@@ -7,6 +7,8 @@
* the LICENSE file that was distributed with this source code.
*/
declare(strict_types=1);
namespace Chill\PersonBundle\DataFixtures\Helper;
use Chill\PersonBundle\Entity\Person;

View File

@@ -7,6 +7,8 @@
* the LICENSE file that was distributed with this source code.
*/
declare(strict_types=1);
namespace Chill\PersonBundle\DataFixtures\ORM;
use Chill\PersonBundle\Entity\AccompanyingPeriod\ClosingMotive;

View File

@@ -7,6 +7,8 @@
* the LICENSE file that was distributed with this source code.
*/
declare(strict_types=1);
namespace Chill\PersonBundle\DataFixtures\ORM;
use Chill\MainBundle\DataFixtures\ORM\LoadAbstractNotificationsTrait;

View File

@@ -7,6 +7,8 @@
* the LICENSE file that was distributed with this source code.
*/
declare(strict_types=1);
namespace Chill\PersonBundle\DataFixtures\ORM;
use Chill\PersonBundle\Entity\AccompanyingPeriod\Origin;

View File

@@ -7,6 +7,8 @@
* the LICENSE file that was distributed with this source code.
*/
declare(strict_types=1);
namespace Chill\PersonBundle\DataFixtures\ORM;
use Chill\PersonBundle\Entity\AccompanyingPeriod;
@@ -19,6 +21,7 @@ use DateTimeImmutable;
use Doctrine\Persistence\ObjectManager;
use function array_pop;
use function array_rand;
use function count;
class LoadAccompanyingPeriodWork extends \Doctrine\Bundle\FixturesBundle\Fixture implements \Doctrine\Common\DataFixtures\DependentFixtureInterface
{

View File

@@ -7,6 +7,8 @@
* the LICENSE file that was distributed with this source code.
*/
declare(strict_types=1);
namespace Chill\PersonBundle\DataFixtures\ORM;
use Chill\CustomFieldsBundle\CustomFields\CustomFieldChoice;
@@ -26,8 +28,8 @@ use Symfony\Component\DependencyInjection\ContainerInterface;
use Symfony\Contracts\Translation\TranslatorInterface;
class LoadCustomFields extends AbstractFixture implements
OrderedFixtureInterface,
ContainerAwareInterface
ContainerAwareInterface,
OrderedFixtureInterface
{
/**
* @var ContainerInterface
@@ -113,7 +115,7 @@ class LoadCustomFields extends AbstractFixture implements
// get possible values for cfGroup
$choices = array_map(
function ($a) { return $a['slug']; },
static function ($a) { return $a['slug']; },
$this->customFieldChoice->getOptions()['choices']
);
// create faker
@@ -121,12 +123,12 @@ class LoadCustomFields extends AbstractFixture implements
// select a set of people and add data
foreach ($personIds as $id) {
// add info on 1 person on 2
if (rand(0, 1) === 1) {
/* @var $person Person */
if (mt_rand(0, 1) === 1) {
/** @var Person $person */
$person = $manager->getRepository(Person::class)->find($id);
$person->setCFData([
'remarques' => $this->createCustomFieldText()
->serialize($faker->text(rand(150, 250)), $this->customFieldText),
->serialize($faker->text(mt_rand(150, 250)), $this->customFieldText),
'document-d-identite' => $this->createCustomFieldChoice()
->serialize([$choices[array_rand($choices)]], $this->customFieldChoice),
]);

View File

@@ -7,6 +7,8 @@
* the LICENSE file that was distributed with this source code.
*/
declare(strict_types=1);
namespace Chill\PersonBundle\DataFixtures\ORM;
use Chill\PersonBundle\Entity\Household\Position;

View File

@@ -7,6 +7,8 @@
* the LICENSE file that was distributed with this source code.
*/
declare(strict_types=1);
namespace Chill\PersonBundle\DataFixtures\ORM;
use Chill\PersonBundle\Entity\MaritalStatus;

View File

@@ -7,6 +7,8 @@
* the LICENSE file that was distributed with this source code.
*/
declare(strict_types=1);
namespace Chill\PersonBundle\DataFixtures\ORM;
use Chill\MainBundle\DataFixtures\ORM\LoadPostalCodes;
@@ -40,13 +42,14 @@ use Nelmio\Alice\Loader\NativeLoader;
use Nelmio\Alice\ObjectSet;
use Symfony\Component\DependencyInjection\ContainerAwareInterface;
use Symfony\Component\Workflow\Registry;
use function count;
use function random_int;
use function ucfirst;
/**
* Load people into database.
*/
class LoadPeople extends AbstractFixture implements OrderedFixtureInterface, ContainerAwareInterface
class LoadPeople extends AbstractFixture implements ContainerAwareInterface, OrderedFixtureInterface
{
use \Symfony\Component\DependencyInjection\ContainerAwareTrait;
@@ -273,7 +276,7 @@ class LoadPeople extends AbstractFixture implements OrderedFixtureInterface, Con
$this->cacheCenters = $this->centerRepository->findAll();
}
return $this->cacheCenters[\array_rand($this->cacheCenters)];
return $this->cacheCenters[array_rand($this->cacheCenters)];
}
/**
@@ -291,7 +294,7 @@ class LoadPeople extends AbstractFixture implements OrderedFixtureInterface, Con
return null;
}
return $this->cacheCountries[\array_rand($this->cacheCountries)];
return $this->cacheCountries[array_rand($this->cacheCountries)];
}
/**
@@ -475,7 +478,7 @@ class LoadPeople extends AbstractFixture implements OrderedFixtureInterface, Con
private function getPostalCode(): PostalCode
{
$ref = LoadPostalCodes::$refs[\array_rand(LoadPostalCodes::$refs)];
$ref = LoadPostalCodes::$refs[array_rand(LoadPostalCodes::$refs)];
return $this->getReference($ref);
}
@@ -490,10 +493,10 @@ class LoadPeople extends AbstractFixture implements OrderedFixtureInterface, Con
return (new Address())
->setStreetAddress1($this->faker->streetAddress)
->setStreetAddress2(
rand(0, 9) > 5 ? $this->faker->streetAddress : ''
mt_rand(0, 9) > 5 ? $this->faker->streetAddress : ''
)
->setPoint(
rand(0, 9) > 5 ? $this->getRandomPoint() : null
mt_rand(0, 9) > 5 ? $this->getRandomPoint() : null
)
->setPostcode($this->getReference(
LoadPostalCodes::$refs[array_rand(LoadPostalCodes::$refs)]
@@ -510,8 +513,8 @@ class LoadPeople extends AbstractFixture implements OrderedFixtureInterface, Con
{
$lonBrussels = 4.35243;
$latBrussels = 50.84676;
$lon = $lonBrussels + 0.01 * rand(-5, 5);
$lat = $latBrussels + 0.01 * rand(-5, 5);
$lon = $lonBrussels + 0.01 * mt_rand(-5, 5);
$lat = $latBrussels + 0.01 * mt_rand(-5, 5);
return Point::fromLonLat($lon, $lat);
}
@@ -522,7 +525,7 @@ class LoadPeople extends AbstractFixture implements OrderedFixtureInterface, Con
$this->cacheSocialIssues = $this->socialIssueRepository->findAll();
}
return $this->cacheSocialIssues[\array_rand($this->cacheSocialIssues)];
return $this->cacheSocialIssues[array_rand($this->cacheSocialIssues)];
}
private function getRandomUser(): User
@@ -531,7 +534,7 @@ class LoadPeople extends AbstractFixture implements OrderedFixtureInterface, Con
$this->cacheUsers = $this->userRepository->findAll();
}
return $this->cacheUsers[\array_rand($this->cacheUsers)];
return $this->cacheUsers[array_rand($this->cacheUsers)];
}
/*

View File

@@ -7,6 +7,8 @@
* the LICENSE file that was distributed with this source code.
*/
declare(strict_types=1);
namespace Chill\PersonBundle\DataFixtures\ORM;
use Chill\MainBundle\DataFixtures\ORM\LoadPermissionsGroup;

View File

@@ -20,6 +20,7 @@ use Doctrine\Bundle\FixturesBundle\Fixture;
use Doctrine\Common\DataFixtures\DependentFixtureInterface;
use Doctrine\ORM\EntityManagerInterface;
use Doctrine\Persistence\ObjectManager;
use function count;
class LoadRelationships extends Fixture implements DependentFixtureInterface
{
@@ -49,7 +50,7 @@ class LoadRelationships extends Fixture implements DependentFixtureInterface
->setFromPerson($this->getRandomPerson($this->em))
->setToPerson($this->getRandomPerson($this->em))
->setRelation($this->getReference(LoadRelations::RELATION_KEY .
\random_int(0, count(LoadRelations::RELATIONS) - 1)))
random_int(0, count(LoadRelations::RELATIONS) - 1)))
->setReverse((bool) random_int(0, 1))
->setCreatedBy($user)
->setUpdatedBy($user)

View File

@@ -7,6 +7,8 @@
* the LICENSE file that was distributed with this source code.
*/
declare(strict_types=1);
namespace Chill\PersonBundle\DependencyInjection;
use Chill\MainBundle\DependencyInjection\MissingBundleException;
@@ -21,6 +23,7 @@ use Symfony\Component\DependencyInjection\Extension\PrependExtensionInterface;
use Symfony\Component\DependencyInjection\Loader;
use Symfony\Component\HttpFoundation\Request;
use Symfony\Component\HttpKernel\DependencyInjection\Extension;
use function array_key_exists;
/**
* Class ChillPersonExtension
@@ -378,7 +381,6 @@ class ChillPersonExtension extends Extension implements PrependExtensionInterfac
Request::METHOD_DELETE => 'ALWAYS_FAILS',
],
],
'confirm' => [
'methods' => [
Request::METHOD_POST => true,
@@ -389,6 +391,16 @@ class ChillPersonExtension extends Extension implements PrependExtensionInterfac
Request::METHOD_POST => \Chill\PersonBundle\Security\Authorization\AccompanyingPeriodVoter::SEE,
],
],
'confidential' => [
'methods' => [
Request::METHOD_POST => true,
Request::METHOD_GET => true,
],
'controller_action' => 'toggleConfidentialApi',
'roles' => [
Request::METHOD_POST => \Chill\PersonBundle\Security\Authorization\AccompanyingPeriodVoter::TOGGLE_CONFIDENTIAL,
],
],
'findAccompanyingPeriodsByPerson' => [
'path' => '/by-person/{person_id}.{_format}',
'controller_action' => 'getAccompanyingPeriodsByPerson',

View File

@@ -7,6 +7,8 @@
* the LICENSE file that was distributed with this source code.
*/
declare(strict_types=1);
namespace Chill\PersonBundle\DependencyInjection\CompilerPass;
use Symfony\Component\DependencyInjection\Compiler\CompilerPassInterface;
@@ -49,7 +51,7 @@ class AccompanyingPeriodTimelineCompilerPass implements CompilerPassInterface
$definition->removeMethodCall('addProvider');
if (false === in_array($arguments[1], $definitions)) {
if (false === in_array($arguments[1], $definitions, true)) {
$definition->addMethodCall($method, $arguments);
}
}

View File

@@ -7,6 +7,8 @@
* the LICENSE file that was distributed with this source code.
*/
declare(strict_types=1);
namespace Chill\PersonBundle\DependencyInjection;
use DateInterval;
@@ -44,7 +46,7 @@ class Configuration implements ConfigurationInterface
->info($this->validationBirthdateNotAfterInfos)
->defaultValue('P1D')
->validate()
->ifTrue(function ($period) {
->ifTrue(static function ($period) {
try {
$interval = new DateInterval($period);
} catch (Exception $ex) {

View File

@@ -7,6 +7,8 @@
* the LICENSE file that was distributed with this source code.
*/
declare(strict_types=1);
namespace Chill\PersonBundle\Doctrine\DQL;
use Doctrine\ORM\Query\AST\Functions\FunctionNode;

View File

@@ -7,6 +7,8 @@
* the LICENSE file that was distributed with this source code.
*/
declare(strict_types=1);
namespace Chill\PersonBundle\Doctrine\DQL\AddressPart;
use Chill\PersonBundle\Doctrine\DQL\AddressPart;

View File

@@ -7,6 +7,8 @@
* the LICENSE file that was distributed with this source code.
*/
declare(strict_types=1);
namespace Chill\PersonBundle\Doctrine\DQL\AddressPart;
use Chill\PersonBundle\Doctrine\DQL\AddressPart;

View File

@@ -7,6 +7,8 @@
* the LICENSE file that was distributed with this source code.
*/
declare(strict_types=1);
namespace Chill\PersonBundle\Doctrine\DQL\AddressPart;
use Chill\PersonBundle\Doctrine\DQL\AddressPart;

View File

@@ -7,6 +7,8 @@
* the LICENSE file that was distributed with this source code.
*/
declare(strict_types=1);
namespace Chill\PersonBundle\Doctrine\DQL\AddressPart;
use Chill\PersonBundle\Doctrine\DQL\AddressPart;

View File

@@ -7,6 +7,8 @@
* the LICENSE file that was distributed with this source code.
*/
declare(strict_types=1);
namespace Chill\PersonBundle\Doctrine\DQL\AddressPart;
use Chill\PersonBundle\Doctrine\DQL\AddressPart;

View File

@@ -7,6 +7,8 @@
* the LICENSE file that was distributed with this source code.
*/
declare(strict_types=1);
namespace Chill\PersonBundle\Doctrine\DQL\AddressPart;
use Chill\PersonBundle\Doctrine\DQL\AddressPart;

View File

@@ -7,6 +7,8 @@
* the LICENSE file that was distributed with this source code.
*/
declare(strict_types=1);
namespace Chill\PersonBundle\Doctrine\DQL\AddressPart;
use Chill\PersonBundle\Doctrine\DQL\AddressPart;

View File

@@ -7,6 +7,8 @@
* the LICENSE file that was distributed with this source code.
*/
declare(strict_types=1);
namespace Chill\PersonBundle\Doctrine\DQL\AddressPart;
use Chill\PersonBundle\Doctrine\DQL\AddressPart;

View File

@@ -7,6 +7,8 @@
* the LICENSE file that was distributed with this source code.
*/
declare(strict_types=1);
namespace Chill\PersonBundle\Doctrine\DQL\AddressPart;
use Chill\PersonBundle\Doctrine\DQL\AddressPart;

View File

@@ -7,6 +7,8 @@
* the LICENSE file that was distributed with this source code.
*/
declare(strict_types=1);
namespace Chill\PersonBundle\Doctrine\DQL\AddressPart;
use Chill\PersonBundle\Doctrine\DQL\AddressPart;

View File

@@ -7,6 +7,8 @@
* the LICENSE file that was distributed with this source code.
*/
declare(strict_types=1);
namespace Chill\PersonBundle\Doctrine\DQL\AddressPart;
use Chill\PersonBundle\Doctrine\DQL\AddressPart;

View File

@@ -7,6 +7,8 @@
* the LICENSE file that was distributed with this source code.
*/
declare(strict_types=1);
namespace Chill\PersonBundle\Entity;
use Chill\MainBundle\Doctrine\Model\TrackCreationInterface;
@@ -39,6 +41,9 @@ use Symfony\Component\Validator\Constraints as Assert;
use Symfony\Component\Validator\Context\ExecutionContextInterface;
use Symfony\Component\Validator\GroupSequenceProviderInterface;
use UnexpectedValueException;
use function count;
use function in_array;
use const SORT_REGULAR;
/**
* AccompanyingPeriod Class.
@@ -49,13 +54,17 @@ use UnexpectedValueException;
* "accompanying_period": AccompanyingPeriod::class
* })
* @Assert\GroupSequenceProvider
* @Assert\Expression(
* "this.isConfidential and this.getUser === NULL",
* message="If the accompanying course is confirmed and confidential, a referrer must remain assigned."
* )
*/
class AccompanyingPeriod implements
TrackCreationInterface,
TrackUpdateInterface,
HasScopesInterface,
GroupSequenceProviderInterface,
HasCentersInterface,
GroupSequenceProviderInterface
HasScopesInterface,
TrackCreationInterface,
TrackUpdateInterface
{
public const INTENSITIES = [self::INTENSITY_OCCASIONAL, self::INTENSITY_REGULAR];
@@ -514,10 +523,10 @@ class AccompanyingPeriod implements
public function getAvailablePersonLocation(): Collection
{
return $this->getOpenParticipations()
->filter(function (AccompanyingPeriodParticipation $p) {
->filter(static function (AccompanyingPeriodParticipation $p) {
return $p->getPerson()->hasCurrentHouseholdAddress();
})
->map(function (AccompanyingPeriodParticipation $p) {
->map(static function (AccompanyingPeriodParticipation $p) {
return $p->getPerson();
});
}
@@ -534,7 +543,7 @@ class AccompanyingPeriod implements
public function getCenters(): ?iterable
{
foreach ($this->getPersons() as $person) {
if (!in_array($person->getCenter(), $centers ?? [])
if (!in_array($person->getCenter(), $centers ?? [], true)
&& null !== $person->getCenter()) {
$centers[] = $person->getCenter();
}
@@ -580,11 +589,11 @@ class AccompanyingPeriod implements
public function getGroupSequence()
{
if ($this->getStep() == self::STEP_DRAFT) {
if ($this->getStep() === self::STEP_DRAFT) {
return [[self::STEP_DRAFT]];
}
if ($this->getStep() == self::STEP_CONFIRMED) {
if ($this->getStep() === self::STEP_CONFIRMED) {
return [[self::STEP_DRAFT, self::STEP_CONFIRMED]];
}

View File

@@ -7,6 +7,8 @@
* the LICENSE file that was distributed with this source code.
*/
declare(strict_types=1);
namespace Chill\PersonBundle\Entity\AccompanyingPeriod;
use Chill\MainBundle\Doctrine\Model\TrackCreationInterface;

View File

@@ -7,6 +7,8 @@
* the LICENSE file that was distributed with this source code.
*/
declare(strict_types=1);
namespace Chill\PersonBundle\Entity\AccompanyingPeriod;
use Chill\MainBundle\Doctrine\Model\TrackCreationInterface;
@@ -30,7 +32,7 @@ use Symfony\Component\Serializer\Annotation as Serializer;
* "accompanying_period_work_evaluation": AccompanyingPeriodWorkEvaluation::class,
* })
*/
class AccompanyingPeriodWorkEvaluation implements TrackUpdateInterface, TrackCreationInterface
class AccompanyingPeriodWorkEvaluation implements TrackCreationInterface, TrackUpdateInterface
{
/**
* @ORM\ManyToOne(

View File

@@ -7,6 +7,8 @@
* the LICENSE file that was distributed with this source code.
*/
declare(strict_types=1);
namespace Chill\PersonBundle\Entity\AccompanyingPeriod;
use Chill\DocGeneratorBundle\Entity\DocGeneratorTemplate;

View File

@@ -7,6 +7,8 @@
* the LICENSE file that was distributed with this source code.
*/
declare(strict_types=1);
namespace Chill\PersonBundle\Entity\AccompanyingPeriod;
use Chill\PersonBundle\Entity\SocialWork\Goal;

View File

@@ -7,6 +7,8 @@
* the LICENSE file that was distributed with this source code.
*/
declare(strict_types=1);
namespace Chill\PersonBundle\Entity\AccompanyingPeriod;
use Doctrine\Common\Collections\ArrayCollection;

View File

@@ -7,6 +7,8 @@
* the LICENSE file that was distributed with this source code.
*/
declare(strict_types=1);
namespace Chill\PersonBundle\Entity\AccompanyingPeriod;
use Chill\MainBundle\Doctrine\Model\TrackCreationInterface;

View File

@@ -7,6 +7,8 @@
* the LICENSE file that was distributed with this source code.
*/
declare(strict_types=1);
namespace Chill\PersonBundle\Entity\AccompanyingPeriod;
use DateTimeImmutable;

View File

@@ -7,6 +7,8 @@
* the LICENSE file that was distributed with this source code.
*/
declare(strict_types=1);
namespace Chill\PersonBundle\Entity\AccompanyingPeriod;
use Chill\PersonBundle\Entity\AccompanyingPeriod;

View File

@@ -7,6 +7,8 @@
* the LICENSE file that was distributed with this source code.
*/
declare(strict_types=1);
namespace Chill\PersonBundle\Entity;
use DateTimeImmutable;
@@ -123,7 +125,7 @@ class AccompanyingPeriodParticipation
private function checkSameStartEnd()
{
if ($this->endDate == $this->startDate) {
if ($this->endDate === $this->startDate) {
$this->accompanyingPeriod->removeParticipation($this);
}
}

View File

@@ -7,6 +7,8 @@
* the LICENSE file that was distributed with this source code.
*/
declare(strict_types=1);
namespace Chill\PersonBundle\Entity;
/**

View File

@@ -7,6 +7,8 @@
* the LICENSE file that was distributed with this source code.
*/
declare(strict_types=1);
namespace Chill\PersonBundle\Entity\Household;
use Chill\MainBundle\Entity\Address;
@@ -22,6 +24,7 @@ use Doctrine\ORM\Mapping as ORM;
use Symfony\Component\Serializer\Annotation as Serializer;
use Symfony\Component\Validator\Constraints as Assert;
use Symfony\Component\Validator\Context\ExecutionContextInterface;
use function count;
/**
* @ORM\Entity
@@ -92,7 +95,7 @@ class Household
public function addAddress(Address $address)
{
foreach ($this->getAddresses() as $a) {
if ($a->getValidFrom() < $address->getValidFrom() && $a->getValidTo() === null) {
if ($a->getValidFrom() <= $address->getValidFrom() && $a->getValidTo() === null) {
$a->setValidTo($address->getValidFrom());
}
}
@@ -138,7 +141,7 @@ class Household
{
$at = null === $at ? new DateTime('today') : $at;
$addrs = $this->getAddresses()->filter(function (Address $a) use ($at) {
$addrs = $this->getAddresses()->filter(static function (Address $a) use ($at) {
return $a->getValidFrom() <= $at && (
null === $a->getValidTo() || $a->getValidTo() > $at
);
@@ -177,7 +180,7 @@ class Household
public function getCurrentMembersIds(?DateTimeImmutable $now = null): Collection
{
return $this->getCurrentMembers($now)->map(
fn (HouseholdMember $m) => $m->getId()
static fn (HouseholdMember $m) => $m->getId()
);
}
@@ -190,7 +193,7 @@ class Household
$members->getIterator()
->uasort(
function (HouseholdMember $a, HouseholdMember $b) {
static function (HouseholdMember $a, HouseholdMember $b) {
if ($a->getPosition() === null) {
if ($b->getPosition() === null) {
return 0;
@@ -246,7 +249,7 @@ class Household
public function getCurrentPersons(?DateTimeImmutable $now = null): Collection
{
return $this->getCurrentMembers($now)
->map(function (HouseholdMember $m) { return $m->getPerson(); });
->map(static function (HouseholdMember $m) { return $m->getPerson(); });
}
public function getId(): ?int
@@ -268,7 +271,7 @@ class Household
$membership->getStartDate(),
$membership->getEndDate()
)->filter(
function (HouseholdMember $m) use ($membership) {
static function (HouseholdMember $m) use ($membership) {
return $m !== $membership;
}
);
@@ -418,7 +421,7 @@ class Household
$cond = true;
for ($i = 0; count($addresses) - 1 > $i; ++$i) {
if ($addresses[$i]->getValidFrom() != $addresses[$i + 1]->getValidTo()) {
if ($addresses[$i]->getValidFrom() !== $addresses[$i + 1]->getValidTo()) {
$cond = false;
$context->buildViolation('The address are not sequentials. The validFrom date of one address should be equal to the validTo date of the previous address.')
->atPath('addresses')

View File

@@ -7,6 +7,8 @@
* the LICENSE file that was distributed with this source code.
*/
declare(strict_types=1);
namespace Chill\PersonBundle\Entity\Household;
use Chill\PersonBundle\Entity\Person;

View File

@@ -7,6 +7,8 @@
* the LICENSE file that was distributed with this source code.
*/
declare(strict_types=1);
namespace Chill\PersonBundle\Entity\Household;
use Chill\MainBundle\Entity\Address;

View File

@@ -7,6 +7,8 @@
* the LICENSE file that was distributed with this source code.
*/
declare(strict_types=1);
namespace Chill\PersonBundle\Entity\Household;
use Doctrine\ORM\Mapping as ORM;

View File

@@ -7,6 +7,8 @@
* the LICENSE file that was distributed with this source code.
*/
declare(strict_types=1);
namespace Chill\PersonBundle\Entity;
use Doctrine\ORM\Mapping as ORM;

View File

@@ -40,6 +40,8 @@ use Exception;
use Symfony\Component\Serializer\Annotation\DiscriminatorMap;
use Symfony\Component\Validator\Constraints as Assert;
use Symfony\Component\Validator\Context\ExecutionContextInterface;
use function count;
use function in_array;
/**
* Person Class.
@@ -599,7 +601,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) {
@@ -772,15 +774,15 @@ class Person implements HasCenterInterface, TrackCreationInterface, TrackUpdateI
$periods = $this->getAccompanyingPeriods();
//order by date :
usort($periods, function ($a, $b) {
usort($periods, static function ($a, $b) {
$dateA = $a->getOpeningDate();
$dateB = $b->getOpeningDate();
if ($dateA == $dateB) {
if ($dateA === $dateB) {
$dateEA = $a->getClosingDate();
$dateEB = $b->getClosingDate();
if ($dateEA == $dateEB) {
if ($dateEA === $dateEB) {
return 0;
}
@@ -1294,7 +1296,7 @@ class Person implements HasCenterInterface, TrackCreationInterface, TrackUpdateI
return $this->getAccompanyingPeriodParticipations()
->matching($criteria)
->filter(function (AccompanyingPeriodParticipation $app) {
->filter(static function (AccompanyingPeriodParticipation $app) {
return AccompanyingPeriod::STEP_CLOSED !== $app->getAccompanyingPeriod()->getStep();
});
}
@@ -1358,7 +1360,7 @@ class Person implements HasCenterInterface, TrackCreationInterface, TrackUpdateI
foreach ($this->addresses as $ad) {
$validDate = $ad->getValidFrom()->format('Y-m-d');
if (in_array($validDate, $validYMDDates)) {
if (in_array($validDate, $validYMDDates, true)) {
return true;
}
$validYMDDates[] = $validDate;

View File

@@ -7,6 +7,8 @@
* the LICENSE file that was distributed with this source code.
*/
declare(strict_types=1);
namespace Chill\PersonBundle\Entity\Person;
use Chill\MainBundle\Entity\Address;

View File

@@ -7,6 +7,8 @@
* the LICENSE file that was distributed with this source code.
*/
declare(strict_types=1);
namespace Chill\PersonBundle\Entity;
use Doctrine\ORM\Mapping as ORM;

View File

@@ -7,6 +7,8 @@
* the LICENSE file that was distributed with this source code.
*/
declare(strict_types=1);
namespace Chill\PersonBundle\Entity;
use Chill\MainBundle\Entity\User;

View File

@@ -7,6 +7,8 @@
* the LICENSE file that was distributed with this source code.
*/
declare(strict_types=1);
namespace Chill\PersonBundle\Entity;
use DateTime;

View File

@@ -7,6 +7,8 @@
* the LICENSE file that was distributed with this source code.
*/
declare(strict_types=1);
namespace Chill\PersonBundle\Entity\Relationships;
use Doctrine\ORM\Mapping as ORM;

View File

@@ -7,6 +7,8 @@
* the LICENSE file that was distributed with this source code.
*/
declare(strict_types=1);
namespace Chill\PersonBundle\Entity\Relationships;
use Chill\MainBundle\Doctrine\Model\TrackCreationInterface;

View File

@@ -7,6 +7,8 @@
* the LICENSE file that was distributed with this source code.
*/
declare(strict_types=1);
namespace Chill\PersonBundle\Entity\SocialWork;
use DateInterval;

View File

@@ -7,6 +7,8 @@
* the LICENSE file that was distributed with this source code.
*/
declare(strict_types=1);
namespace Chill\PersonBundle\Entity\SocialWork;
use DateTimeInterface;

View File

@@ -7,6 +7,8 @@
* the LICENSE file that was distributed with this source code.
*/
declare(strict_types=1);
namespace Chill\PersonBundle\Entity\SocialWork;
use Chill\PersonBundle\Entity\AccompanyingPeriod\AccompanyingPeriodWork;

View File

@@ -7,6 +7,8 @@
* the LICENSE file that was distributed with this source code.
*/
declare(strict_types=1);
namespace Chill\PersonBundle\Entity\SocialWork;
use DateInterval;

View File

@@ -7,6 +7,8 @@
* the LICENSE file that was distributed with this source code.
*/
declare(strict_types=1);
namespace Chill\PersonBundle\Entity\SocialWork;
use DateTimeInterface;

View File

@@ -13,6 +13,7 @@ namespace Chill\PersonBundle\EventListener;
use Chill\PersonBundle\Entity\Person;
use Chill\PersonBundle\Entity\PersonAltName;
use const MB_CASE_TITLE;
class PersonEventListener
{

View File

@@ -7,6 +7,8 @@
* the LICENSE file that was distributed with this source code.
*/
declare(strict_types=1);
namespace Chill\PersonBundle\Export;
use Doctrine\ORM\QueryBuilder;
@@ -23,7 +25,7 @@ class AbstractAccompanyingPeriodExportElement
protected function addJoinAccompanyingPeriod(QueryBuilder $query): void
{
if (false === $this->havingAccompanyingPeriodInJoin($query)) {
if (false === in_array('person', $query->getAllAliases())) {
if (false === in_array('person', $query->getAllAliases(), true)) {
throw new LogicException("the alias 'person' does not exists in "
. 'query builder');
}
@@ -39,6 +41,6 @@ class AbstractAccompanyingPeriodExportElement
{
$joins = $query->getDQLPart('join') ?? [];
return in_array('accompanying_period', $query->getAllAliases());
return in_array('accompanying_period', $query->getAllAliases(), true);
}
}

View File

@@ -7,6 +7,8 @@
* the LICENSE file that was distributed with this source code.
*/
declare(strict_types=1);
namespace Chill\PersonBundle\Export\Aggregator;
use Chill\MainBundle\Export\AggregatorInterface;

View File

@@ -7,6 +7,8 @@
* the LICENSE file that was distributed with this source code.
*/
declare(strict_types=1);
namespace Chill\PersonBundle\Export\Aggregator;
use Chill\MainBundle\Export\AggregatorInterface;
@@ -147,7 +149,7 @@ final class CountryOfBirthAggregator implements AggregatorInterface, ExportEleme
];
}
return function (string $value) use ($labels): string {
return static function (string $value) use ($labels): string {
return $labels[$value];
};
}

View File

@@ -7,6 +7,8 @@
* the LICENSE file that was distributed with this source code.
*/
declare(strict_types=1);
namespace Chill\PersonBundle\Export\Aggregator;
use Chill\MainBundle\Export\AggregatorInterface;

View File

@@ -7,6 +7,8 @@
* the LICENSE file that was distributed with this source code.
*/
declare(strict_types=1);
namespace Chill\PersonBundle\Export\Aggregator;
use Chill\MainBundle\Export\AggregatorInterface;
@@ -147,7 +149,7 @@ final class NationalityAggregator implements AggregatorInterface, ExportElementV
];
}
return function (string $value) use ($labels): string {
return static function (string $value) use ($labels): string {
return $labels[$value];
};
}

View File

@@ -7,6 +7,8 @@
* the LICENSE file that was distributed with this source code.
*/
declare(strict_types=1);
namespace Chill\PersonBundle\Export;
/**

View File

@@ -7,6 +7,8 @@
* the LICENSE file that was distributed with this source code.
*/
declare(strict_types=1);
namespace Chill\PersonBundle\Export\Export;
use Chill\MainBundle\Export\ExportInterface;
@@ -56,7 +58,7 @@ class CountPerson implements ExportInterface
$labels = array_combine($values, $values);
$labels['_header'] = $this->getTitle();
return function ($value) use ($labels) {
return static function ($value) use ($labels) {
return $labels[$value];
};
}
@@ -88,7 +90,7 @@ class CountPerson implements ExportInterface
*/
public function initiateQuery(array $requiredModifiers, array $acl, array $data = [])
{
$centers = array_map(function ($el) { return $el['center']; }, $acl);
$centers = array_map(static function ($el) { return $el['center']; }, $acl);
$qb = $this->entityManager->createQueryBuilder();

Some files were not shown because too many files have changed in this diff Show More