diff --git a/src/Bundle/ChillActivityBundle/DataFixtures/ORM/LoadActivity.php b/src/Bundle/ChillActivityBundle/DataFixtures/ORM/LoadActivity.php
index 8c53ca2d9..82949d635 100644
--- a/src/Bundle/ChillActivityBundle/DataFixtures/ORM/LoadActivity.php
+++ b/src/Bundle/ChillActivityBundle/DataFixtures/ORM/LoadActivity.php
@@ -50,7 +50,7 @@ class LoadActivity extends AbstractFixture implements OrderedFixtureInterface
->findAll();
foreach ($persons as $person) {
- $activityNbr = mt_rand(0, 3);
+ $activityNbr = random_int(0, 3);
for ($i = 0; $i < $activityNbr; ++$i) {
$activity = $this->newRandomActivity($person);
@@ -75,7 +75,7 @@ class LoadActivity extends AbstractFixture implements OrderedFixtureInterface
// ->setAttendee($this->faker->boolean())
- for ($i = 0; mt_rand(0, 4) > $i; ++$i) {
+ for ($i = 0; random_int(0, 4) > $i; ++$i) {
$reason = $this->getRandomActivityReason();
if (null !== $reason) {
diff --git a/src/Bundle/ChillActivityBundle/DependencyInjection/Configuration.php b/src/Bundle/ChillActivityBundle/DependencyInjection/Configuration.php
index e22f6242c..c6b3189cc 100644
--- a/src/Bundle/ChillActivityBundle/DependencyInjection/Configuration.php
+++ b/src/Bundle/ChillActivityBundle/DependencyInjection/Configuration.php
@@ -26,7 +26,7 @@ class Configuration implements ConfigurationInterface
public function getConfigTreeBuilder()
{
$treeBuilder = new TreeBuilder('chill_activity');
- $rootNode = $treeBuilder->getRootNode('chill_activity');
+ $rootNode = $treeBuilder->getRootNode();
$rootNode
->children()
diff --git a/src/Bundle/ChillActivityBundle/Form/ActivityReasonCategoryType.php b/src/Bundle/ChillActivityBundle/Form/ActivityReasonCategoryType.php
index b8e03d2c7..3a0f2a318 100644
--- a/src/Bundle/ChillActivityBundle/Form/ActivityReasonCategoryType.php
+++ b/src/Bundle/ChillActivityBundle/Form/ActivityReasonCategoryType.php
@@ -32,7 +32,7 @@ class ActivityReasonCategoryType extends AbstractType
public function configureOptions(OptionsResolver $resolver)
{
$resolver->setDefaults([
- 'data_class' => 'Chill\ActivityBundle\Entity\ActivityReasonCategory',
+ 'data_class' => \Chill\ActivityBundle\Entity\ActivityReasonCategory::class,
]);
}
diff --git a/src/Bundle/ChillActivityBundle/Form/ActivityType.php b/src/Bundle/ChillActivityBundle/Form/ActivityType.php
index 6d198c5fa..4bb1c1352 100644
--- a/src/Bundle/ChillActivityBundle/Form/ActivityType.php
+++ b/src/Bundle/ChillActivityBundle/Form/ActivityType.php
@@ -400,9 +400,7 @@ class ActivityType extends AbstractType
// the datetimetransformer will then handle timezone as GMT
$timezoneUTC = new DateTimeZone('GMT');
/** @var DateTime $data */
- $data = $formEvent->getData() === null ?
- DateTime::createFromFormat('U', '300') :
- $formEvent->getData();
+ $data = $formEvent->getData() ?? DateTime::createFromFormat('U', '300');
$seconds = $data->getTimezone()->getOffset($data);
$data->setTimeZone($timezoneUTC);
$data->add(new DateInterval('PT' . $seconds . 'S'));
diff --git a/src/Bundle/ChillActivityBundle/Tests/Form/Type/TranslatableActivityReasonTest.php b/src/Bundle/ChillActivityBundle/Tests/Form/Type/TranslatableActivityReasonTest.php
index 3c9777051..881e5a607 100644
--- a/src/Bundle/ChillActivityBundle/Tests/Form/Type/TranslatableActivityReasonTest.php
+++ b/src/Bundle/ChillActivityBundle/Tests/Form/Type/TranslatableActivityReasonTest.php
@@ -79,15 +79,15 @@ final class TranslatableActivityReasonTest extends TypeTestCase
$request = $prophet->prophesize();
$translator = $prophet->prophesize();
- $request->willExtend('Symfony\Component\HttpFoundation\Request');
+ $request->willExtend(\Symfony\Component\HttpFoundation\Request::class);
$request->getLocale()->willReturn($fallbackLocale);
- $requestStack->willExtend('Symfony\Component\HttpFoundation\RequestStack');
+ $requestStack->willExtend(\Symfony\Component\HttpFoundation\RequestStack::class);
$requestStack->getCurrentRequest()->will(static function () use ($request) {
return $request;
});
- $translator->willExtend('Symfony\Component\Translation\Translator');
+ $translator->willExtend(\Symfony\Component\Translation\Translator::class);
$translator->getFallbackLocales()->willReturn($locale);
return new TranslatableStringHelper(
diff --git a/src/Bundle/ChillActivityBundle/Tests/Security/Authorization/ActivityVoterTest.php b/src/Bundle/ChillActivityBundle/Tests/Security/Authorization/ActivityVoterTest.php
index a9b9e2ec7..1fb90a4ae 100644
--- a/src/Bundle/ChillActivityBundle/Tests/Security/Authorization/ActivityVoterTest.php
+++ b/src/Bundle/ChillActivityBundle/Tests/Security/Authorization/ActivityVoterTest.php
@@ -160,7 +160,7 @@ final class ActivityVoterTest extends KernelTestCase
{
$token = $this->prophet->prophesize();
$token
- ->willImplement('\Symfony\Component\Security\Core\Authentication\Token\TokenInterface');
+ ->willImplement('\\' . \Symfony\Component\Security\Core\Authentication\Token\TokenInterface::class);
if (null === $user) {
$token->getUser()->willReturn(null);
diff --git a/src/Bundle/ChillAsideActivityBundle/src/DependencyInjection/Configuration.php b/src/Bundle/ChillAsideActivityBundle/src/DependencyInjection/Configuration.php
index d01998358..8341e0240 100644
--- a/src/Bundle/ChillAsideActivityBundle/src/DependencyInjection/Configuration.php
+++ b/src/Bundle/ChillAsideActivityBundle/src/DependencyInjection/Configuration.php
@@ -22,7 +22,7 @@ class Configuration implements ConfigurationInterface
{
$treeBuilder = new TreeBuilder('chill_aside_activity');
- $treeBuilder->getRootNode('chill_aside_activity')
+ $treeBuilder->getRootNode()
->children()
->arrayNode('form')
->canBeEnabled()
diff --git a/src/Bundle/ChillAsideActivityBundle/src/Form/AsideActivityFormType.php b/src/Bundle/ChillAsideActivityBundle/src/Form/AsideActivityFormType.php
index 9a95a8d09..727287972 100644
--- a/src/Bundle/ChillAsideActivityBundle/src/Form/AsideActivityFormType.php
+++ b/src/Bundle/ChillAsideActivityBundle/src/Form/AsideActivityFormType.php
@@ -95,9 +95,7 @@ final class AsideActivityFormType extends AbstractType
// the datetimetransformer will then handle timezone as GMT
$timezoneUTC = new DateTimeZone('GMT');
/** @var DateTimeImmutable $data */
- $data = $formEvent->getData() === null ?
- DateTime::createFromFormat('U', '300') :
- $formEvent->getData();
+ $data = $formEvent->getData() ?? DateTime::createFromFormat('U', '300');
$seconds = $data->getTimezone()->getOffset($data);
$data->setTimeZone($timezoneUTC);
$data->add(new DateInterval('PT' . $seconds . 'S'));
diff --git a/src/Bundle/ChillBudgetBundle/Controller/AbstractElementController.php b/src/Bundle/ChillBudgetBundle/Controller/AbstractElementController.php
index badccf3b3..125c72ce4 100644
--- a/src/Bundle/ChillBudgetBundle/Controller/AbstractElementController.php
+++ b/src/Bundle/ChillBudgetBundle/Controller/AbstractElementController.php
@@ -116,7 +116,7 @@ abstract class AbstractElementController extends AbstractController
$indexPage = 'chill_budget_elements_household_index';
}
- $entity = null !== $element->getPerson() ? $element->getPerson() : $element->getHousehold();
+ $entity = $element->getPerson() ?? $element->getHousehold();
$form = $this->createForm($this->getType(), $element);
$form->add('submit', SubmitType::class);
diff --git a/src/Bundle/ChillBudgetBundle/DependencyInjection/Compiler/CalculatorCompilerPass.php b/src/Bundle/ChillBudgetBundle/DependencyInjection/Compiler/CalculatorCompilerPass.php
index 64df79202..012c4eab5 100644
--- a/src/Bundle/ChillBudgetBundle/DependencyInjection/Compiler/CalculatorCompilerPass.php
+++ b/src/Bundle/ChillBudgetBundle/DependencyInjection/Compiler/CalculatorCompilerPass.php
@@ -19,7 +19,7 @@ class CalculatorCompilerPass implements CompilerPassInterface
{
public function process(ContainerBuilder $container)
{
- $manager = $container->getDefinition('Chill\BudgetBundle\Calculator\CalculatorManager');
+ $manager = $container->getDefinition(\Chill\BudgetBundle\Calculator\CalculatorManager::class);
foreach ($container->findTaggedServiceIds('chill_budget.calculator') as $id => $tags) {
foreach ($tags as $tag) {
diff --git a/src/Bundle/ChillBudgetBundle/DependencyInjection/Configuration.php b/src/Bundle/ChillBudgetBundle/DependencyInjection/Configuration.php
index 8856df22b..ff9931f2d 100644
--- a/src/Bundle/ChillBudgetBundle/DependencyInjection/Configuration.php
+++ b/src/Bundle/ChillBudgetBundle/DependencyInjection/Configuration.php
@@ -19,7 +19,7 @@ class Configuration implements ConfigurationInterface
public function getConfigTreeBuilder()
{
$treeBuilder = new TreeBuilder('chill_budget');
- $rootNode = $treeBuilder->getRootNode('chill_budget');
+ $rootNode = $treeBuilder->getRootNode();
$rootNode
->children()
diff --git a/src/Bundle/ChillCalendarBundle/Command/MapAndSubscribeUserCalendarCommand.php b/src/Bundle/ChillCalendarBundle/Command/MapAndSubscribeUserCalendarCommand.php
index 902fe4c38..63ac15348 100644
--- a/src/Bundle/ChillCalendarBundle/Command/MapAndSubscribeUserCalendarCommand.php
+++ b/src/Bundle/ChillCalendarBundle/Command/MapAndSubscribeUserCalendarCommand.php
@@ -60,7 +60,7 @@ class MapAndSubscribeUserCalendarCommand extends Command
public function execute(InputInterface $input, OutputInterface $output): int
{
- $this->logger->info(__CLASS__ . ' execute command');
+ $this->logger->info(self::class . ' execute command');
$limit = 50;
$offset = 0;
@@ -71,7 +71,7 @@ class MapAndSubscribeUserCalendarCommand extends Command
$created = 0;
$renewed = 0;
- $this->logger->info(__CLASS__ . ' the number of user to get - renew', [
+ $this->logger->info(self::class . ' the number of user to get - renew', [
'total' => $total,
'expiration' => $expiration->format(DateTimeImmutable::ATOM),
]);
@@ -92,7 +92,7 @@ class MapAndSubscribeUserCalendarCommand extends Command
// we first try to renew an existing subscription, if any.
// if not, or if it fails, we try to create a new one
if ($this->mapCalendarToUser->hasActiveSubscription($user)) {
- $this->logger->debug(__CLASS__ . ' renew a subscription for', [
+ $this->logger->debug(self::class . ' renew a subscription for', [
'userId' => $user->getId(),
'username' => $user->getUsernameCanonical(),
]);
@@ -104,7 +104,7 @@ class MapAndSubscribeUserCalendarCommand extends Command
if (0 !== $expirationTs) {
++$renewed;
} else {
- $this->logger->warning(__CLASS__ . ' could not renew subscription for a user', [
+ $this->logger->warning(self::class . ' could not renew subscription for a user', [
'userId' => $user->getId(),
'username' => $user->getUsernameCanonical(),
]);
@@ -112,7 +112,7 @@ class MapAndSubscribeUserCalendarCommand extends Command
}
if (!$this->mapCalendarToUser->hasActiveSubscription($user)) {
- $this->logger->debug(__CLASS__ . ' create a subscription for', [
+ $this->logger->debug(self::class . ' create a subscription for', [
'userId' => $user->getId(),
'username' => $user->getUsernameCanonical(),
]);
@@ -124,7 +124,7 @@ class MapAndSubscribeUserCalendarCommand extends Command
if (0 !== $expirationTs) {
++$created;
} else {
- $this->logger->warning(__CLASS__ . ' could not create subscription for a user', [
+ $this->logger->warning(self::class . ' could not create subscription for a user', [
'userId' => $user->getId(),
'username' => $user->getUsernameCanonical(),
]);
@@ -139,7 +139,7 @@ class MapAndSubscribeUserCalendarCommand extends Command
$this->em->clear();
}
- $this->logger->warning(__CLASS__ . ' process executed', [
+ $this->logger->warning(self::class . ' process executed', [
'created' => $created,
'renewed' => $renewed,
]);
diff --git a/src/Bundle/ChillCalendarBundle/DependencyInjection/Configuration.php b/src/Bundle/ChillCalendarBundle/DependencyInjection/Configuration.php
index 127b69047..a3e4ae391 100644
--- a/src/Bundle/ChillCalendarBundle/DependencyInjection/Configuration.php
+++ b/src/Bundle/ChillCalendarBundle/DependencyInjection/Configuration.php
@@ -24,7 +24,7 @@ class Configuration implements ConfigurationInterface
public function getConfigTreeBuilder()
{
$treeBuilder = new TreeBuilder('chill_calendar');
- $rootNode = $treeBuilder->getRootNode('chill_calendar');
+ $rootNode = $treeBuilder->getRootNode();
$rootNode
->children()
diff --git a/src/Bundle/ChillCalendarBundle/Messenger/Handler/MSGraphChangeNotificationHandler.php b/src/Bundle/ChillCalendarBundle/Messenger/Handler/MSGraphChangeNotificationHandler.php
index 9c1e84511..a09c70c1e 100644
--- a/src/Bundle/ChillCalendarBundle/Messenger/Handler/MSGraphChangeNotificationHandler.php
+++ b/src/Bundle/ChillCalendarBundle/Messenger/Handler/MSGraphChangeNotificationHandler.php
@@ -77,7 +77,7 @@ class MSGraphChangeNotificationHandler implements MessageHandlerInterface
$user = $this->userRepository->find($changeNotificationMessage->getUserId());
if (null === $user) {
- $this->logger->warning(__CLASS__ . ' notification concern non-existent user, skipping');
+ $this->logger->warning(self::class . ' notification concern non-existent user, skipping');
return;
}
@@ -86,7 +86,7 @@ class MSGraphChangeNotificationHandler implements MessageHandlerInterface
$secret = $this->mapCalendarToUser->getSubscriptionSecret($user);
if ($secret !== ($notification['clientState'] ?? -1)) {
- $this->logger->warning(__CLASS__ . ' could not validate secret, skipping');
+ $this->logger->warning(self::class . ' could not validate secret, skipping');
continue;
}
@@ -101,7 +101,7 @@ class MSGraphChangeNotificationHandler implements MessageHandlerInterface
$this->calendarSyncer->handleCalendarSync($calendar, $notification, $user);
$this->em->flush();
} else {
- $this->logger->info(__CLASS__ . ' id not found in any calendar nor calendar range');
+ $this->logger->info(self::class . ' id not found in any calendar nor calendar range');
}
}
diff --git a/src/Bundle/ChillCalendarBundle/RemoteCalendar/Connector/MSGraph/RemoteToLocalSync/CalendarRangeSyncer.php b/src/Bundle/ChillCalendarBundle/RemoteCalendar/Connector/MSGraph/RemoteToLocalSync/CalendarRangeSyncer.php
index a9227282d..d05adfed7 100644
--- a/src/Bundle/ChillCalendarBundle/RemoteCalendar/Connector/MSGraph/RemoteToLocalSync/CalendarRangeSyncer.php
+++ b/src/Bundle/ChillCalendarBundle/RemoteCalendar/Connector/MSGraph/RemoteToLocalSync/CalendarRangeSyncer.php
@@ -59,7 +59,7 @@ class CalendarRangeSyncer
}
$calendarRange->preventEnqueueChanges = true;
- $this->logger->info(__CLASS__ . ' remove a calendar range because deleted on remote calendar');
+ $this->logger->info(self::class . ' remove a calendar range because deleted on remote calendar');
$this->em->remove($calendarRange);
break;
@@ -71,7 +71,7 @@ class CalendarRangeSyncer
$notification['resource']
)->toArray();
} catch (ClientExceptionInterface $clientException) {
- $this->logger->warning(__CLASS__ . ' could not retrieve event from ms graph. Already deleted ?', [
+ $this->logger->warning(self::class . ' could not retrieve event from ms graph. Already deleted ?', [
'calendarRangeId' => $calendarRange->getId(),
'remoteEventId' => $notification['resource'],
]);
@@ -82,7 +82,7 @@ class CalendarRangeSyncer
$lastModified = RemoteEventConverter::convertStringDateWithTimezone($new['lastModifiedDateTime']);
if ($calendarRange->getRemoteAttributes()['lastModifiedDateTime'] === $lastModified->getTimestamp()) {
- $this->logger->info(__CLASS__ . ' change key is equals. Source is probably a local update', [
+ $this->logger->info(self::class . ' change key is equals. Source is probably a local update', [
'calendarRangeId' => $calendarRange->getId(),
'remoteEventId' => $notification['resource'],
]);
diff --git a/src/Bundle/ChillCalendarBundle/RemoteCalendar/Connector/MSGraph/RemoteToLocalSync/CalendarSyncer.php b/src/Bundle/ChillCalendarBundle/RemoteCalendar/Connector/MSGraph/RemoteToLocalSync/CalendarSyncer.php
index c5a640f32..b3febf4d4 100644
--- a/src/Bundle/ChillCalendarBundle/RemoteCalendar/Connector/MSGraph/RemoteToLocalSync/CalendarSyncer.php
+++ b/src/Bundle/ChillCalendarBundle/RemoteCalendar/Connector/MSGraph/RemoteToLocalSync/CalendarSyncer.php
@@ -79,7 +79,7 @@ class CalendarSyncer
$notification['resource']
)->toArray();
} catch (ClientExceptionInterface $clientException) {
- $this->logger->warning(__CLASS__ . ' could not retrieve event from ms graph. Already deleted ?', [
+ $this->logger->warning(self::class . ' could not retrieve event from ms graph. Already deleted ?', [
'calendarId' => $calendar->getId(),
'remoteEventId' => $notification['resource'],
]);
@@ -96,7 +96,7 @@ class CalendarSyncer
);
if ($calendar->getRemoteAttributes()['lastModifiedDateTime'] === $lastModified->getTimestamp()) {
- $this->logger->info(__CLASS__ . ' change key is equals. Source is probably a local update', [
+ $this->logger->info(self::class . ' change key is equals. Source is probably a local update', [
'calendarRangeId' => $calendar->getId(),
'remoteEventId' => $notification['resource'],
]);
diff --git a/src/Bundle/ChillCalendarBundle/Service/ShortMessageNotification/BulkCalendarShortMessageSender.php b/src/Bundle/ChillCalendarBundle/Service/ShortMessageNotification/BulkCalendarShortMessageSender.php
index a35fffce0..83826bbcf 100644
--- a/src/Bundle/ChillCalendarBundle/Service/ShortMessageNotification/BulkCalendarShortMessageSender.php
+++ b/src/Bundle/ChillCalendarBundle/Service/ShortMessageNotification/BulkCalendarShortMessageSender.php
@@ -66,6 +66,6 @@ class BulkCalendarShortMessageSender
$this->em->refresh($calendar);
}
- $this->logger->info(__CLASS__ . 'a bulk of messages was sent', ['count_calendars' => $countCalendars, 'count_sms' => $countSms]);
+ $this->logger->info(self::class . 'a bulk of messages was sent', ['count_calendars' => $countCalendars, 'count_sms' => $countSms]);
}
}
diff --git a/src/Bundle/ChillCustomFieldsBundle/Command/CreateFieldsOnGroupCommand.php b/src/Bundle/ChillCustomFieldsBundle/Command/CreateFieldsOnGroupCommand.php
index c8c8ad4fc..2a03e90bb 100644
--- a/src/Bundle/ChillCustomFieldsBundle/Command/CreateFieldsOnGroupCommand.php
+++ b/src/Bundle/ChillCustomFieldsBundle/Command/CreateFieldsOnGroupCommand.php
@@ -192,9 +192,7 @@ class CreateFieldsOnGroupCommand extends Command
foreach ($languages as $lang) {
//todo replace with service to find lang when available
- $names[] = (isset($cf->getName()[$lang])) ?
- $cf->getName()[$lang] :
- 'Not available in this language';
+ $names[] = $cf->getName()[$lang] ?? 'Not available in this language';
}
if ($this->validator->validate($cf)) {
@@ -249,9 +247,7 @@ class CreateFieldsOnGroupCommand extends Command
foreach ($languages as $lang) {
//todo replace with service to find lang when available
- $row[] = (isset($customFieldGroup->getName()[$lang])) ?
- $customFieldGroup->getName()[$lang] :
- 'Not available in this language';
+ $row[] = $customFieldGroup->getName()[$lang] ?? 'Not available in this language';
}
$rows[] = $row;
}
diff --git a/src/Bundle/ChillCustomFieldsBundle/CustomFields/CustomFieldChoice.php b/src/Bundle/ChillCustomFieldsBundle/CustomFields/CustomFieldChoice.php
index 7876dd026..781b2b233 100644
--- a/src/Bundle/ChillCustomFieldsBundle/CustomFields/CustomFieldChoice.php
+++ b/src/Bundle/ChillCustomFieldsBundle/CustomFields/CustomFieldChoice.php
@@ -294,7 +294,7 @@ class CustomFieldChoice extends AbstractCustomField
public function render($value, CustomField $customField, $documentType = 'html')
{
//extract the data. They are under a _choice key if they are stored with allow_other
- $data = (isset($value['_choices'])) ? $value['_choices'] : $value;
+ $data = $value['_choices'] ?? $value;
$selected = (is_array($data)) ? $data : [$data];
$choices = $customField->getOptions()[self::CHOICES];
diff --git a/src/Bundle/ChillCustomFieldsBundle/DataFixtures/ORM/LoadOption.php b/src/Bundle/ChillCustomFieldsBundle/DataFixtures/ORM/LoadOption.php
index 0edc2457a..5b2598ab7 100644
--- a/src/Bundle/ChillCustomFieldsBundle/DataFixtures/ORM/LoadOption.php
+++ b/src/Bundle/ChillCustomFieldsBundle/DataFixtures/ORM/LoadOption.php
@@ -104,7 +104,7 @@ class LoadOption extends AbstractFixture implements OrderedFixtureInterface
$manager->persist($parent);
//Load children
- $expected_nb_children = mt_rand(10, 50);
+ $expected_nb_children = random_int(10, 50);
for ($i = 0; $i < $expected_nb_children; ++$i) {
$companyName = $this->fakerFr->company;
@@ -144,7 +144,7 @@ class LoadOption extends AbstractFixture implements OrderedFixtureInterface
$manager->persist($parent);
//Load children
- $expected_nb_children = mt_rand(10, 50);
+ $expected_nb_children = random_int(10, 50);
for ($i = 0; $i < $expected_nb_children; ++$i) {
$manager->persist($this->createChildOption($parent, [
diff --git a/src/Bundle/ChillCustomFieldsBundle/DependencyInjection/Configuration.php b/src/Bundle/ChillCustomFieldsBundle/DependencyInjection/Configuration.php
index d0db269a2..e68fdd2c4 100644
--- a/src/Bundle/ChillCustomFieldsBundle/DependencyInjection/Configuration.php
+++ b/src/Bundle/ChillCustomFieldsBundle/DependencyInjection/Configuration.php
@@ -25,7 +25,7 @@ class Configuration implements ConfigurationInterface
public function getConfigTreeBuilder()
{
$treeBuilder = new TreeBuilder('chill_custom_fields');
- $rootNode = $treeBuilder->getRootNode('chill_custom_fields');
+ $rootNode = $treeBuilder->getRootNode();
$classInfo = 'The class which may receive custom fields';
$nameInfo = 'The name which will appears in the user interface. May be translatable';
diff --git a/src/Bundle/ChillCustomFieldsBundle/Form/CustomFieldType.php b/src/Bundle/ChillCustomFieldsBundle/Form/CustomFieldType.php
index aa1d1b7e1..ea572759b 100644
--- a/src/Bundle/ChillCustomFieldsBundle/Form/CustomFieldType.php
+++ b/src/Bundle/ChillCustomFieldsBundle/Form/CustomFieldType.php
@@ -119,7 +119,7 @@ class CustomFieldType extends AbstractType
public function configureOptions(OptionsResolver $resolver)
{
$resolver->setDefaults([
- 'data_class' => 'Chill\CustomFieldsBundle\Entity\CustomField',
+ 'data_class' => \Chill\CustomFieldsBundle\Entity\CustomField::class,
]);
$resolver->setRequired(['type', 'group_widget'])
diff --git a/src/Bundle/ChillCustomFieldsBundle/Form/Type/ChoicesListType.php b/src/Bundle/ChillCustomFieldsBundle/Form/Type/ChoicesListType.php
index 071363451..c50bd856e 100644
--- a/src/Bundle/ChillCustomFieldsBundle/Form/Type/ChoicesListType.php
+++ b/src/Bundle/ChillCustomFieldsBundle/Form/Type/ChoicesListType.php
@@ -38,7 +38,7 @@ class ChoicesListType extends AbstractType
$formData = $form->getData();
if (null === $formData['slug']) {
- $slug = uniqid(mt_rand(), true);
+ $slug = uniqid(random_int(0, mt_getrandmax()), true);
$data['slug'] = $slug;
$event->setData($data);
diff --git a/src/Bundle/ChillCustomFieldsBundle/Form/Type/CustomFieldType.php b/src/Bundle/ChillCustomFieldsBundle/Form/Type/CustomFieldType.php
index 5b1d39529..67ea171e6 100644
--- a/src/Bundle/ChillCustomFieldsBundle/Form/Type/CustomFieldType.php
+++ b/src/Bundle/ChillCustomFieldsBundle/Form/Type/CustomFieldType.php
@@ -49,7 +49,7 @@ class CustomFieldType extends AbstractType
{
$resolver
->setRequired(['group'])
- ->addAllowedTypes('group', ['Chill\CustomFieldsBundle\Entity\CustomFieldsGroup']);
+ ->addAllowedTypes('group', [\Chill\CustomFieldsBundle\Entity\CustomFieldsGroup::class]);
}
public function getBlockPrefix()
diff --git a/src/Bundle/ChillCustomFieldsBundle/Service/CustomFieldsHelper.php b/src/Bundle/ChillCustomFieldsBundle/Service/CustomFieldsHelper.php
index 67afdec85..9ffd836e6 100644
--- a/src/Bundle/ChillCustomFieldsBundle/Service/CustomFieldsHelper.php
+++ b/src/Bundle/ChillCustomFieldsBundle/Service/CustomFieldsHelper.php
@@ -49,7 +49,7 @@ class CustomFieldsHelper
public function isEmptyValue(array $fields, CustomField $customField)
{
$slug = $customField->getSlug();
- $rawValue = (isset($fields[$slug])) ? $fields[$slug] : null;
+ $rawValue = $fields[$slug] ?? null;
$customFieldType = $this->provider->getCustomFieldByType($customField->getType());
$deserializedValue = $customFieldType->deserialize($rawValue, $customField);
@@ -71,7 +71,7 @@ class CustomFieldsHelper
public function renderCustomField(array $fields, CustomField $customField, $documentType = 'html')
{
$slug = $customField->getSlug();
- $rawValue = (isset($fields[$slug])) ? $fields[$slug] : null;
+ $rawValue = $fields[$slug] ?? null;
$customFieldType = $this->provider->getCustomFieldByType($customField->getType());
return $customFieldType->render($rawValue, $customField, $documentType);
diff --git a/src/Bundle/ChillCustomFieldsBundle/Tests/Controller/CustomFieldsGroupControllerTest.php b/src/Bundle/ChillCustomFieldsBundle/Tests/Controller/CustomFieldsGroupControllerTest.php
index 067fe7de6..7e0fe12d2 100644
--- a/src/Bundle/ChillCustomFieldsBundle/Tests/Controller/CustomFieldsGroupControllerTest.php
+++ b/src/Bundle/ChillCustomFieldsBundle/Tests/Controller/CustomFieldsGroupControllerTest.php
@@ -52,7 +52,7 @@ final class CustomFieldsGroupControllerTest extends WebTestCase
// Fill in the form and submit it
$form = $crawler->selectButton('Créer')->form([
'custom_fields_group[name][fr]' => 'Test',
- 'custom_fields_group[entity]' => 'Chill\PersonBundle\Entity\Person',
+ 'custom_fields_group[entity]' => \Chill\PersonBundle\Entity\Person::class,
]);
$crawler = $client->submit($form);
diff --git a/src/Bundle/ChillCustomFieldsBundle/Tests/CustomFieldTestHelper.php b/src/Bundle/ChillCustomFieldsBundle/Tests/CustomFieldTestHelper.php
index 35a9ee82b..79f547fe2 100644
--- a/src/Bundle/ChillCustomFieldsBundle/Tests/CustomFieldTestHelper.php
+++ b/src/Bundle/ChillCustomFieldsBundle/Tests/CustomFieldTestHelper.php
@@ -34,12 +34,12 @@ trait CustomFieldTestHelper
$kernel = static::$kernel;
//check a kernel is accessible
- $customFieldsGroup = $this->createMock('Chill\CustomFieldsBundle\Entity\CustomFieldsGroup');
+ $customFieldsGroup = $this->createMock(\Chill\CustomFieldsBundle\Entity\CustomFieldsGroup::class);
$customFieldsGroup->expects($this->once())
->method('getActiveCustomFields')
->will($this->returnValue([$field]));
- $request = $this->createMock('Symfony\Component\HttpFoundation\Request');
+ $request = $this->createMock(\Symfony\Component\HttpFoundation\Request::class);
$request->expects($this->any())
->method('getLocale')
->will($this->returnValue($locale));
diff --git a/src/Bundle/ChillCustomFieldsBundle/Tests/CustomFields/CustomFieldsTextTest.php b/src/Bundle/ChillCustomFieldsBundle/Tests/CustomFields/CustomFieldsTextTest.php
index cc1b4db64..6bfe2663c 100644
--- a/src/Bundle/ChillCustomFieldsBundle/Tests/CustomFields/CustomFieldsTextTest.php
+++ b/src/Bundle/ChillCustomFieldsBundle/Tests/CustomFields/CustomFieldsTextTest.php
@@ -41,11 +41,11 @@ final class CustomFieldsTextTest extends WebTestCase
$customField = $this->customFieldProvider->getCustomFieldByType('text');
$this->assertInstanceOf(
- 'Chill\CustomFieldsBundle\CustomFields\CustomFieldInterface',
+ \Chill\CustomFieldsBundle\CustomFields\CustomFieldInterface::class,
$customField
);
$this->assertInstanceOf(
- 'Chill\CustomFieldsBundle\CustomFields\CustomFieldText',
+ \Chill\CustomFieldsBundle\CustomFields\CustomFieldText::class,
$customField
);
}
diff --git a/src/Bundle/ChillCustomFieldsBundle/Tests/Templating/Twig/CustomFieldRenderingTwigTest.php b/src/Bundle/ChillCustomFieldsBundle/Tests/Templating/Twig/CustomFieldRenderingTwigTest.php
index 420e79dff..2e29d988b 100644
--- a/src/Bundle/ChillCustomFieldsBundle/Tests/Templating/Twig/CustomFieldRenderingTwigTest.php
+++ b/src/Bundle/ChillCustomFieldsBundle/Tests/Templating/Twig/CustomFieldRenderingTwigTest.php
@@ -46,7 +46,7 @@ final class CustomFieldRenderingTwigTest extends KernelTestCase
// set locale to fr
$prophet = new \Prophecy\Prophet();
$request = $prophet->prophesize();
- $request->willExtend('Symfony\Component\HttpFoundation\Request');
+ $request->willExtend(\Symfony\Component\HttpFoundation\Request::class);
$request->getLocale()->willReturn('fr');
self::$kernel->getContainer()->get('request_stack')
->push($request->reveal());
diff --git a/src/Bundle/ChillCustomFieldsBundle/Tests/Templating/Twig/CustomFieldsGroupRenderingTwigTest.php b/src/Bundle/ChillCustomFieldsBundle/Tests/Templating/Twig/CustomFieldsGroupRenderingTwigTest.php
index 7ffa31db5..f3b93c390 100644
--- a/src/Bundle/ChillCustomFieldsBundle/Tests/Templating/Twig/CustomFieldsGroupRenderingTwigTest.php
+++ b/src/Bundle/ChillCustomFieldsBundle/Tests/Templating/Twig/CustomFieldsGroupRenderingTwigTest.php
@@ -48,7 +48,7 @@ final class CustomFieldsGroupRenderingTwigTest extends KernelTestCase
// set locale to fr
$prophet = new \Prophecy\Prophet();
$request = $prophet->prophesize();
- $request->willExtend('Symfony\Component\HttpFoundation\Request');
+ $request->willExtend(\Symfony\Component\HttpFoundation\Request::class);
$request->getLocale()->willReturn('fr');
self::$kernel->getContainer()->get('request_stack')
->push($request->reveal());
diff --git a/src/Bundle/ChillDocStoreBundle/DependencyInjection/Configuration.php b/src/Bundle/ChillDocStoreBundle/DependencyInjection/Configuration.php
index d2c56d8d1..466158783 100644
--- a/src/Bundle/ChillDocStoreBundle/DependencyInjection/Configuration.php
+++ b/src/Bundle/ChillDocStoreBundle/DependencyInjection/Configuration.php
@@ -24,7 +24,7 @@ class Configuration implements ConfigurationInterface
public function getConfigTreeBuilder()
{
$treeBuilder = new TreeBuilder('chill_doc_store');
- $rootNode = $treeBuilder->getRootNode('chill_doc_store');
+ $rootNode = $treeBuilder->getRootNode();
// Here you should define the parameters that are allowed to
// configure your bundle. See the documentation linked above for
diff --git a/src/Bundle/ChillEventBundle/DataFixtures/ORM/LoadParticipation.php b/src/Bundle/ChillEventBundle/DataFixtures/ORM/LoadParticipation.php
index ed38faf01..71b07a123 100644
--- a/src/Bundle/ChillEventBundle/DataFixtures/ORM/LoadParticipation.php
+++ b/src/Bundle/ChillEventBundle/DataFixtures/ORM/LoadParticipation.php
@@ -43,7 +43,7 @@ class LoadParticipation extends AbstractFixture implements OrderedFixtureInterfa
for ($i = 0; $i < $expectedNumber; ++$i) {
$event = (new Event())
->setDate($this->faker->dateTimeBetween('-2 years', '+6 months'))
- ->setName($this->faker->words(mt_rand(2, 4), true))
+ ->setName($this->faker->words(random_int(2, 4), true))
->setType($this->getReference(LoadEventTypes::$refs[array_rand(LoadEventTypes::$refs)]))
->setCenter($center)
->setCircle(
@@ -75,7 +75,7 @@ class LoadParticipation extends AbstractFixture implements OrderedFixtureInterfa
/** @var \Chill\PersonBundle\Entity\Person $person */
foreach ($people as $person) {
- $nb = mt_rand(0, 3);
+ $nb = random_int(0, 3);
for ($i = 0; $i < $nb; ++$i) {
$event = $events[array_rand($events)];
diff --git a/src/Bundle/ChillEventBundle/DependencyInjection/Configuration.php b/src/Bundle/ChillEventBundle/DependencyInjection/Configuration.php
index b36f7b6a9..fe42ad99a 100644
--- a/src/Bundle/ChillEventBundle/DependencyInjection/Configuration.php
+++ b/src/Bundle/ChillEventBundle/DependencyInjection/Configuration.php
@@ -24,7 +24,7 @@ class Configuration implements ConfigurationInterface
public function getConfigTreeBuilder()
{
$treeBuilder = new TreeBuilder('chill_event');
- $rootNode = $treeBuilder->getRootNode('chill_event');
+ $rootNode = $treeBuilder->getRootNode();
// Here you should define the parameters that are allowed to
// configure your bundle. See the documentation linked above for
diff --git a/src/Bundle/ChillEventBundle/Form/EventType.php b/src/Bundle/ChillEventBundle/Form/EventType.php
index fec26c373..a72b90494 100644
--- a/src/Bundle/ChillEventBundle/Form/EventType.php
+++ b/src/Bundle/ChillEventBundle/Form/EventType.php
@@ -54,7 +54,7 @@ class EventType extends AbstractType
public function configureOptions(OptionsResolver $resolver)
{
$resolver->setDefaults([
- 'data_class' => 'Chill\EventBundle\Entity\Event',
+ 'data_class' => \Chill\EventBundle\Entity\Event::class,
]);
$resolver
->setRequired(['center', 'role'])
diff --git a/src/Bundle/ChillEventBundle/Form/EventTypeType.php b/src/Bundle/ChillEventBundle/Form/EventTypeType.php
index 9f971f55d..bab13c374 100644
--- a/src/Bundle/ChillEventBundle/Form/EventTypeType.php
+++ b/src/Bundle/ChillEventBundle/Form/EventTypeType.php
@@ -36,7 +36,7 @@ class EventTypeType extends AbstractType
public function setDefaultOptions(OptionsResolverInterface $resolver)
{
$resolver->setDefaults([
- 'data_class' => 'Chill\EventBundle\Entity\EventType',
+ 'data_class' => \Chill\EventBundle\Entity\EventType::class,
]);
}
}
diff --git a/src/Bundle/ChillEventBundle/Form/RoleType.php b/src/Bundle/ChillEventBundle/Form/RoleType.php
index e4e55faca..9c56d17e6 100644
--- a/src/Bundle/ChillEventBundle/Form/RoleType.php
+++ b/src/Bundle/ChillEventBundle/Form/RoleType.php
@@ -55,7 +55,7 @@ class RoleType extends AbstractType
public function setDefaultOptions(OptionsResolverInterface $resolver)
{
$resolver->setDefaults([
- 'data_class' => 'Chill\EventBundle\Entity\Role',
+ 'data_class' => \Chill\EventBundle\Entity\Role::class,
]);
}
}
diff --git a/src/Bundle/ChillEventBundle/Form/StatusType.php b/src/Bundle/ChillEventBundle/Form/StatusType.php
index e70011d22..5801f3264 100644
--- a/src/Bundle/ChillEventBundle/Form/StatusType.php
+++ b/src/Bundle/ChillEventBundle/Form/StatusType.php
@@ -38,7 +38,7 @@ class StatusType extends AbstractType
public function setDefaultOptions(OptionsResolverInterface $resolver)
{
$resolver->setDefaults([
- 'data_class' => 'Chill\EventBundle\Entity\Status',
+ 'data_class' => \Chill\EventBundle\Entity\Status::class,
]);
}
}
diff --git a/src/Bundle/ChillFamilyMembersBundle/DependencyInjection/Configuration.php b/src/Bundle/ChillFamilyMembersBundle/DependencyInjection/Configuration.php
index d2c09d7fa..98ea3125a 100644
--- a/src/Bundle/ChillFamilyMembersBundle/DependencyInjection/Configuration.php
+++ b/src/Bundle/ChillFamilyMembersBundle/DependencyInjection/Configuration.php
@@ -24,7 +24,7 @@ class Configuration implements ConfigurationInterface
public function getConfigTreeBuilder()
{
$treeBuilder = new TreeBuilder('chill_amli_family_members');
- $rootNode = $treeBuilder->getRootNode('chill_amli_family_members');
+ $rootNode = $treeBuilder->getRootNode();
$rootNode
->children()
diff --git a/src/Bundle/ChillMainBundle/Command/LoadPostalCodesCommand.php b/src/Bundle/ChillMainBundle/Command/LoadPostalCodesCommand.php
index fd8a469d6..ea42fde78 100644
--- a/src/Bundle/ChillMainBundle/Command/LoadPostalCodesCommand.php
+++ b/src/Bundle/ChillMainBundle/Command/LoadPostalCodesCommand.php
@@ -102,11 +102,7 @@ class LoadPostalCodesCommand extends Command
try {
$this->addPostalCode($row, $output);
++$num;
- } catch (ExistingPostalCodeException $ex) {
- $output->writeln(' on line ' . $line . ' : ' . $ex->getMessage() . '');
- } catch (CountryCodeNotFoundException $ex) {
- $output->writeln(' on line ' . $line . ' : ' . $ex->getMessage() . '');
- } catch (PostalCodeNotValidException $ex) {
+ } catch (ExistingPostalCodeException|CountryCodeNotFoundException|PostalCodeNotValidException $ex) {
$output->writeln(' on line ' . $line . ' : ' . $ex->getMessage() . '');
}
++$line;
diff --git a/src/Bundle/ChillMainBundle/Controller/ExportController.php b/src/Bundle/ChillMainBundle/Controller/ExportController.php
index caeec8327..686b4cbce 100644
--- a/src/Bundle/ChillMainBundle/Controller/ExportController.php
+++ b/src/Bundle/ChillMainBundle/Controller/ExportController.php
@@ -164,7 +164,7 @@ class ExportController extends AbstractController
{
$this->denyAccessUnlessGranted(SavedExportVoter::GENERATE, $savedExport);
- $key = md5(uniqid((string) mt_rand(), false));
+ $key = md5(uniqid((string) random_int(0, mt_getrandmax()), false));
$this->redis->setEx($key, 3600, serialize($savedExport->getOptions()));
@@ -481,7 +481,7 @@ class ExportController extends AbstractController
'alias' => $alias,
];
unset($parameters['_token']);
- $key = md5(uniqid((string) mt_rand(), false));
+ $key = md5(uniqid((string) random_int(0, mt_getrandmax()), false));
$this->redis->setEx($key, 3600, serialize($parameters));
diff --git a/src/Bundle/ChillMainBundle/DataFixtures/ORM/LoadAddressReferences.php b/src/Bundle/ChillMainBundle/DataFixtures/ORM/LoadAddressReferences.php
index 93aaf01b3..0fef33c2f 100644
--- a/src/Bundle/ChillMainBundle/DataFixtures/ORM/LoadAddressReferences.php
+++ b/src/Bundle/ChillMainBundle/DataFixtures/ORM/LoadAddressReferences.php
@@ -69,7 +69,7 @@ class LoadAddressReferences extends AbstractFixture implements ContainerAwareInt
$ar->setRefId($this->faker->numerify('ref-id-######'));
$ar->setStreet($this->faker->streetName);
- $ar->setStreetNumber((string) mt_rand(0, 199));
+ $ar->setStreetNumber((string) random_int(0, 199));
$ar->setPoint($this->getRandomPoint());
$ar->setPostcode($this->getReference(
LoadPostalCodes::$refs[array_rand(LoadPostalCodes::$refs)]
@@ -89,8 +89,8 @@ class LoadAddressReferences extends AbstractFixture implements ContainerAwareInt
{
$lonBrussels = 4.35243;
$latBrussels = 50.84676;
- $lon = $lonBrussels + 0.01 * mt_rand(-5, 5);
- $lat = $latBrussels + 0.01 * mt_rand(-5, 5);
+ $lon = $lonBrussels + 0.01 * random_int(-5, 5);
+ $lat = $latBrussels + 0.01 * random_int(-5, 5);
return Point::fromLonLat($lon, $lat);
}
diff --git a/src/Bundle/ChillMainBundle/DependencyInjection/CompilerPass/MenuCompilerPass.php b/src/Bundle/ChillMainBundle/DependencyInjection/CompilerPass/MenuCompilerPass.php
index c41a32056..ae53f09df 100644
--- a/src/Bundle/ChillMainBundle/DependencyInjection/CompilerPass/MenuCompilerPass.php
+++ b/src/Bundle/ChillMainBundle/DependencyInjection/CompilerPass/MenuCompilerPass.php
@@ -38,11 +38,7 @@ class MenuCompilerPass implements CompilerPassInterface
}
usort($services, static function ($a, $b) {
- if ($a['priority'] === $b['priority']) {
- return 0;
- }
-
- return ($a['priority'] < $b['priority']) ? -1 : 1;
+ return $a['priority'] <=> $b['priority'];
});
foreach ($services as $service) {
diff --git a/src/Bundle/ChillMainBundle/DependencyInjection/CompilerPass/ShortMessageCompilerPass.php b/src/Bundle/ChillMainBundle/DependencyInjection/CompilerPass/ShortMessageCompilerPass.php
index f75840c3a..f9fdb80d0 100644
--- a/src/Bundle/ChillMainBundle/DependencyInjection/CompilerPass/ShortMessageCompilerPass.php
+++ b/src/Bundle/ChillMainBundle/DependencyInjection/CompilerPass/ShortMessageCompilerPass.php
@@ -34,7 +34,7 @@ class ShortMessageCompilerPass implements CompilerPassInterface
{
public function process(ContainerBuilder $container)
{
- $config = $container->resolveEnvPlaceholders($container->getParameter('chill_main.short_messages', null), true);
+ $config = $container->resolveEnvPlaceholders($container->getParameter('chill_main.short_messages'), true);
// weird fix for special characters
$config['dsn'] = str_replace(['%%'], ['%'], $config['dsn']);
$dsn = parse_url($config['dsn']);
@@ -43,7 +43,7 @@ class ShortMessageCompilerPass implements CompilerPassInterface
if ('null' === $dsn['scheme'] || false === $config['enabled']) {
$defaultTransporter = new Reference(NullShortMessageSender::class);
} elseif ('ovh' === $dsn['scheme']) {
- if (!class_exists('\Ovh\Api')) {
+ if (!class_exists('\\' . \Ovh\Api::class)) {
throw new RuntimeException('Class \\Ovh\\Api not found');
}
@@ -66,17 +66,17 @@ class ShortMessageCompilerPass implements CompilerPassInterface
$ovh = new Definition();
$ovh
- ->setClass('\Ovh\Api')
+ ->setClass('\\' . \Ovh\Api::class)
->setArgument(0, $dsn['user'])
->setArgument(1, $dsn['pass'])
->setArgument(2, $dsn['host'])
->setArgument(3, $dsn['queries']['consumer_key']);
- $container->setDefinition('Ovh\Api', $ovh);
+ $container->setDefinition(\Ovh\Api::class, $ovh);
$ovhSender = new Definition();
$ovhSender
->setClass(OvhShortMessageSender::class)
- ->setArgument(0, new Reference('Ovh\Api'))
+ ->setArgument(0, new Reference(\Ovh\Api::class))
->setArgument(1, $dsn['queries']['service_name'])
->setArgument(2, $dsn['queries']['sender'])
->setArgument(3, new Reference(LoggerInterface::class))
diff --git a/src/Bundle/ChillMainBundle/DependencyInjection/Configuration.php b/src/Bundle/ChillMainBundle/DependencyInjection/Configuration.php
index 9631900ab..4605f35ab 100644
--- a/src/Bundle/ChillMainBundle/DependencyInjection/Configuration.php
+++ b/src/Bundle/ChillMainBundle/DependencyInjection/Configuration.php
@@ -37,7 +37,7 @@ class Configuration implements ConfigurationInterface
public function getConfigTreeBuilder()
{
$treeBuilder = new TreeBuilder('chill_main');
- $rootNode = $treeBuilder->getRootNode('chill_main');
+ $rootNode = $treeBuilder->getRootNode();
$rootNode
->children()
diff --git a/src/Bundle/ChillMainBundle/DependencyInjection/Widget/AbstractWidgetsCompilerPass.php b/src/Bundle/ChillMainBundle/DependencyInjection/Widget/AbstractWidgetsCompilerPass.php
index 223a7b6cb..d5234bfbe 100644
--- a/src/Bundle/ChillMainBundle/DependencyInjection/Widget/AbstractWidgetsCompilerPass.php
+++ b/src/Bundle/ChillMainBundle/DependencyInjection/Widget/AbstractWidgetsCompilerPass.php
@@ -193,8 +193,7 @@ abstract class AbstractWidgetsCompilerPass implements CompilerPassInterface
/** @var WidgetFactoryInterface $factory */
$factory = $this->widgetServices[$alias];
// get the config (under the key which equals to widget_alias
- $config = isset($param[$factory->getWidgetAlias()]) ?
- $param[$factory->getWidgetAlias()] : [];
+ $config = $param[$factory->getWidgetAlias()] ?? [];
// register the service into the container
$serviceId = $this->registerServiceIntoContainer(
$container,
diff --git a/src/Bundle/ChillMainBundle/DependencyInjection/Widget/AddWidgetConfigurationTrait.php b/src/Bundle/ChillMainBundle/DependencyInjection/Widget/AddWidgetConfigurationTrait.php
index a6688fca2..ec603236e 100644
--- a/src/Bundle/ChillMainBundle/DependencyInjection/Widget/AddWidgetConfigurationTrait.php
+++ b/src/Bundle/ChillMainBundle/DependencyInjection/Widget/AddWidgetConfigurationTrait.php
@@ -139,7 +139,7 @@ trait AddWidgetConfigurationTrait
protected function addWidgetsConfiguration(string $place, ContainerBuilder $containerBuilder)
{
$treeBuilder = new TreeBuilder($place);
- $root = $treeBuilder->getRootNode($place)
+ $root = $treeBuilder->getRootNode()
->canBeUnset()
->info('register widgets on place "' . $place . '"');
@@ -170,7 +170,7 @@ trait AddWidgetConfigurationTrait
// adding the possible config on each widget under the widget_alias
foreach ($this->filterWidgetByPlace($place) as $factory) {
$builder = new TreeBuilder($factory->getWidgetAlias());
- $widgetOptionsRoot = $builder->getRootNode($factory->getWidgetAlias());
+ $widgetOptionsRoot = $builder->getRootNode();
$widgetOptionsRoot->canBeUnset()
->info(sprintf(
'the configuration for the widget "%s" (only required if this widget is set in widget_alias)',
diff --git a/src/Bundle/ChillMainBundle/Entity/Address.php b/src/Bundle/ChillMainBundle/Entity/Address.php
index 9a0f8b7b3..962050d6f 100644
--- a/src/Bundle/ChillMainBundle/Entity/Address.php
+++ b/src/Bundle/ChillMainBundle/Entity/Address.php
@@ -527,28 +527,20 @@ class Address
/**
* Set streetAddress1 (legacy function).
- *
- * @param string $streetAddress1
- *
- * @return Address
*/
- public function setStreetAddress1($streetAddress1)
+ public function setStreetAddress1(?string $streetAddress1): self
{
- $this->street = null === $streetAddress1 ? '' : $streetAddress1;
+ $this->street = (string) $streetAddress1;
return $this;
}
/**
* Set streetAddress2 (legacy function).
- *
- * @param string $streetAddress2
- *
- * @return Address
*/
- public function setStreetAddress2($streetAddress2)
+ public function setStreetAddress2(?string $streetAddress2): self
{
- $this->streetNumber = null === $streetAddress2 ? '' : $streetAddress2;
+ $this->streetNumber = (string) $streetAddress2;
return $this;
}
diff --git a/src/Bundle/ChillMainBundle/Entity/Embeddable/PrivateCommentEmbeddable.php b/src/Bundle/ChillMainBundle/Entity/Embeddable/PrivateCommentEmbeddable.php
index 560b0dd7f..44e53671d 100644
--- a/src/Bundle/ChillMainBundle/Entity/Embeddable/PrivateCommentEmbeddable.php
+++ b/src/Bundle/ChillMainBundle/Entity/Embeddable/PrivateCommentEmbeddable.php
@@ -45,7 +45,7 @@ class PrivateCommentEmbeddable
public function merge(PrivateCommentEmbeddable $newComment): self
{
- $currentComments = null === $this->getComments() ? [] : $this->getComments();
+ $currentComments = $this->getComments() ?? [];
$mergedComments = $newComment->getComments() + $currentComments;
diff --git a/src/Bundle/ChillMainBundle/Export/Formatter/SpreadSheetFormatter.php b/src/Bundle/ChillMainBundle/Export/Formatter/SpreadSheetFormatter.php
index 6b77e5b2b..66db056c4 100644
--- a/src/Bundle/ChillMainBundle/Export/Formatter/SpreadSheetFormatter.php
+++ b/src/Bundle/ChillMainBundle/Export/Formatter/SpreadSheetFormatter.php
@@ -435,7 +435,7 @@ class SpreadSheetFormatter implements FormatterInterface
* Get the displayable result.
*
* @param string $key
- * @param string $value
+ * @param mixed $value
*
* @return string
*/
@@ -445,7 +445,7 @@ class SpreadSheetFormatter implements FormatterInterface
$this->initializeCache($key);
}
- $value = null === $value ? '' : $value;
+ $value = $value ?? '';
return call_user_func($this->cacheDisplayableResult[$key], $value);
}
diff --git a/src/Bundle/ChillMainBundle/Form/CenterType.php b/src/Bundle/ChillMainBundle/Form/CenterType.php
index 6af579870..ff758ca49 100644
--- a/src/Bundle/ChillMainBundle/Form/CenterType.php
+++ b/src/Bundle/ChillMainBundle/Form/CenterType.php
@@ -30,7 +30,7 @@ class CenterType extends AbstractType
public function configureOptions(OptionsResolver $resolver)
{
$resolver->setDefaults([
- 'data_class' => 'Chill\MainBundle\Entity\Center',
+ 'data_class' => \Chill\MainBundle\Entity\Center::class,
]);
}
diff --git a/src/Bundle/ChillMainBundle/Form/LocationFormType.php b/src/Bundle/ChillMainBundle/Form/LocationFormType.php
index 8e6861029..5a6776daf 100644
--- a/src/Bundle/ChillMainBundle/Form/LocationFormType.php
+++ b/src/Bundle/ChillMainBundle/Form/LocationFormType.php
@@ -75,7 +75,7 @@ final class LocationFormType extends AbstractType
public function configureOptions(OptionsResolver $resolver)
{
$resolver->setDefaults([
- 'data_class' => 'Chill\MainBundle\Entity\Location',
+ 'data_class' => \Chill\MainBundle\Entity\Location::class,
]);
}
diff --git a/src/Bundle/ChillMainBundle/Form/PermissionsGroupType.php b/src/Bundle/ChillMainBundle/Form/PermissionsGroupType.php
index ad5f7243b..16aafeb41 100644
--- a/src/Bundle/ChillMainBundle/Form/PermissionsGroupType.php
+++ b/src/Bundle/ChillMainBundle/Form/PermissionsGroupType.php
@@ -60,7 +60,7 @@ class PermissionsGroupType extends AbstractType
public function configureOptions(OptionsResolver $resolver)
{
$resolver->setDefaults([
- 'data_class' => 'Chill\MainBundle\Entity\PermissionsGroup',
+ 'data_class' => \Chill\MainBundle\Entity\PermissionsGroup::class,
]);
}
diff --git a/src/Bundle/ChillMainBundle/Form/ScopeType.php b/src/Bundle/ChillMainBundle/Form/ScopeType.php
index 86335c554..c5a7657b0 100644
--- a/src/Bundle/ChillMainBundle/Form/ScopeType.php
+++ b/src/Bundle/ChillMainBundle/Form/ScopeType.php
@@ -36,7 +36,7 @@ class ScopeType extends AbstractType
public function configureOptions(OptionsResolver $resolver)
{
$resolver->setDefaults([
- 'data_class' => 'Chill\MainBundle\Entity\Scope',
+ 'data_class' => \Chill\MainBundle\Entity\Scope::class,
]);
}
diff --git a/src/Bundle/ChillMainBundle/Form/Type/AppendScopeChoiceTypeTrait.php b/src/Bundle/ChillMainBundle/Form/Type/AppendScopeChoiceTypeTrait.php
index 547aeb3ec..8eda0d9d9 100644
--- a/src/Bundle/ChillMainBundle/Form/Type/AppendScopeChoiceTypeTrait.php
+++ b/src/Bundle/ChillMainBundle/Form/Type/AppendScopeChoiceTypeTrait.php
@@ -83,8 +83,8 @@ trait AppendScopeChoiceTypeTrait
{
$resolver
->setRequired(['center', 'role'])
- ->setAllowedTypes('center', 'Chill\MainBundle\Entity\Center')
- ->setAllowedTypes('role', 'Symfony\Component\Security\Core\Role\Role');
+ ->setAllowedTypes('center', \Chill\MainBundle\Entity\Center::class)
+ ->setAllowedTypes('role', 'string');
}
/**
diff --git a/src/Bundle/ChillMainBundle/Form/Type/ComposedGroupCenterType.php b/src/Bundle/ChillMainBundle/Form/Type/ComposedGroupCenterType.php
index d78cf813b..cfc838f5a 100644
--- a/src/Bundle/ChillMainBundle/Form/Type/ComposedGroupCenterType.php
+++ b/src/Bundle/ChillMainBundle/Form/Type/ComposedGroupCenterType.php
@@ -23,12 +23,12 @@ class ComposedGroupCenterType extends AbstractType
public function buildForm(FormBuilderInterface $builder, array $options)
{
$builder->add('permissionsgroup', EntityType::class, [
- 'class' => 'Chill\MainBundle\Entity\PermissionsGroup',
+ 'class' => \Chill\MainBundle\Entity\PermissionsGroup::class,
'choice_label' => static function (PermissionsGroup $group) {
return $group->getName();
},
])->add('center', EntityType::class, [
- 'class' => 'Chill\MainBundle\Entity\Center',
+ 'class' => \Chill\MainBundle\Entity\Center::class,
'choice_label' => static function (Center $center) {
return $center->getName();
},
@@ -37,7 +37,7 @@ class ComposedGroupCenterType extends AbstractType
public function configureOptions(OptionsResolver $resolver)
{
- $resolver->setDefault('data_class', 'Chill\MainBundle\Entity\GroupCenter');
+ $resolver->setDefault('data_class', \Chill\MainBundle\Entity\GroupCenter::class);
}
public function getBlockPrefix()
diff --git a/src/Bundle/ChillMainBundle/Form/Type/ComposedRoleScopeType.php b/src/Bundle/ChillMainBundle/Form/Type/ComposedRoleScopeType.php
index 1d541cbd7..a09130c03 100644
--- a/src/Bundle/ChillMainBundle/Form/Type/ComposedRoleScopeType.php
+++ b/src/Bundle/ChillMainBundle/Form/Type/ComposedRoleScopeType.php
@@ -98,6 +98,6 @@ class ComposedRoleScopeType extends AbstractType
public function configureOptions(OptionsResolver $resolver)
{
- $resolver->setDefault('data_class', 'Chill\MainBundle\Entity\RoleScope');
+ $resolver->setDefault('data_class', \Chill\MainBundle\Entity\RoleScope::class);
}
}
diff --git a/src/Bundle/ChillMainBundle/Form/Type/Select2CountryType.php b/src/Bundle/ChillMainBundle/Form/Type/Select2CountryType.php
index 5b4d49edd..bc4d7d3ef 100644
--- a/src/Bundle/ChillMainBundle/Form/Type/Select2CountryType.php
+++ b/src/Bundle/ChillMainBundle/Form/Type/Select2CountryType.php
@@ -77,7 +77,7 @@ class Select2CountryType extends AbstractType
asort($choices, SORT_STRING | SORT_FLAG_CASE);
$resolver->setDefaults([
- 'class' => 'Chill\MainBundle\Entity\Country',
+ 'class' => \Chill\MainBundle\Entity\Country::class,
'choices' => array_combine(array_values($choices), array_keys($choices)),
'preferred_choices' => array_combine(array_values($preferredChoices), array_keys($preferredChoices)),
]);
diff --git a/src/Bundle/ChillMainBundle/Form/Type/Select2LanguageType.php b/src/Bundle/ChillMainBundle/Form/Type/Select2LanguageType.php
index 164a138d9..328f3c174 100644
--- a/src/Bundle/ChillMainBundle/Form/Type/Select2LanguageType.php
+++ b/src/Bundle/ChillMainBundle/Form/Type/Select2LanguageType.php
@@ -73,7 +73,7 @@ class Select2LanguageType extends AbstractType
asort($choices, SORT_STRING | SORT_FLAG_CASE);
$resolver->setDefaults([
- 'class' => 'Chill\MainBundle\Entity\Language',
+ 'class' => \Chill\MainBundle\Entity\Language::class,
'choices' => array_combine(array_values($choices), array_keys($choices)),
'preferred_choices' => array_combine(array_values($preferredChoices), array_keys($preferredChoices)),
]);
diff --git a/src/Bundle/ChillMainBundle/Form/UserType.php b/src/Bundle/ChillMainBundle/Form/UserType.php
index dc2140997..e2255a1ab 100644
--- a/src/Bundle/ChillMainBundle/Form/UserType.php
+++ b/src/Bundle/ChillMainBundle/Form/UserType.php
@@ -167,7 +167,7 @@ class UserType extends AbstractType
public function configureOptions(OptionsResolver $resolver)
{
$resolver->setDefaults([
- 'data_class' => 'Chill\MainBundle\Entity\User',
+ 'data_class' => \Chill\MainBundle\Entity\User::class,
]);
$resolver
diff --git a/src/Bundle/ChillMainBundle/Form/WorkflowStepType.php b/src/Bundle/ChillMainBundle/Form/WorkflowStepType.php
index 1b18b3ef8..cc7d70f74 100644
--- a/src/Bundle/ChillMainBundle/Form/WorkflowStepType.php
+++ b/src/Bundle/ChillMainBundle/Form/WorkflowStepType.php
@@ -196,7 +196,7 @@ class WorkflowStepType extends AbstractType
public function configureOptions(OptionsResolver $resolver)
{
$resolver
- ->setDefined('class', EntityWorkflowStep::class)
+ ->setDefined('class')
->setRequired('transition')
->setAllowedTypes('transition', 'bool')
->setRequired('entity_workflow')
diff --git a/src/Bundle/ChillMainBundle/Pagination/PaginatorFactory.php b/src/Bundle/ChillMainBundle/Pagination/PaginatorFactory.php
index e6e0863a2..7f06bf216 100644
--- a/src/Bundle/ChillMainBundle/Pagination/PaginatorFactory.php
+++ b/src/Bundle/ChillMainBundle/Pagination/PaginatorFactory.php
@@ -78,9 +78,8 @@ class PaginatorFactory
$totalItems,
$this->getCurrentItemsPerPage(),
$this->getCurrentPageNumber(),
- null === $route ? $this->getCurrentRoute() : $route,
- null === $routeParameters ? $this->getCurrentRouteParameters() :
- $routeParameters,
+ $route ?? $this->getCurrentRoute(),
+ $routeParameters ?? $this->getCurrentRouteParameters(),
$this->router,
self::DEFAULT_CURRENT_PAGE_KEY,
self::DEFAULT_ITEM_PER_NUMBER_KEY
diff --git a/src/Bundle/ChillMainBundle/Search/SearchProvider.php b/src/Bundle/ChillMainBundle/Search/SearchProvider.php
index f63d3c04f..a629a45d2 100644
--- a/src/Bundle/ChillMainBundle/Search/SearchProvider.php
+++ b/src/Bundle/ChillMainBundle/Search/SearchProvider.php
@@ -91,11 +91,7 @@ class SearchProvider
{
//sort the array
uasort($this->searchServices, static function (SearchInterface $a, SearchInterface $b) {
- if ($a->getOrder() === $b->getOrder()) {
- return 0;
- }
-
- return ($a->getOrder() < $b->getOrder()) ? -1 : 1;
+ return $a->getOrder() <=> $b->getOrder();
});
return $this->searchServices;
@@ -124,11 +120,7 @@ class SearchProvider
{
//sort the array
uasort($this->hasAdvancedFormSearchServices, static function (SearchInterface $a, SearchInterface $b) {
- if ($a->getOrder() === $b->getOrder()) {
- return 0;
- }
-
- return ($a->getOrder() < $b->getOrder()) ? -1 : 1;
+ return $a->getOrder() <=> $b->getOrder();
});
return $this->hasAdvancedFormSearchServices;
diff --git a/src/Bundle/ChillMainBundle/Service/AddressGeographicalUnit/RefreshAddressToGeographicalUnitMaterializedViewCronJob.php b/src/Bundle/ChillMainBundle/Service/AddressGeographicalUnit/RefreshAddressToGeographicalUnitMaterializedViewCronJob.php
index 3c1ff0a75..9dbb38a3f 100644
--- a/src/Bundle/ChillMainBundle/Service/AddressGeographicalUnit/RefreshAddressToGeographicalUnitMaterializedViewCronJob.php
+++ b/src/Bundle/ChillMainBundle/Service/AddressGeographicalUnit/RefreshAddressToGeographicalUnitMaterializedViewCronJob.php
@@ -41,7 +41,7 @@ class RefreshAddressToGeographicalUnitMaterializedViewCronJob implements CronJob
return $cronJobExecution->getLastStart() < $now->sub(new DateInterval('P1D'))
// introduce a random component to ensure a roll when multiple instances are hosted on same machines
- && mt_rand(0, 10) === 0;
+ && random_int(0, 10) === 0;
}
public function getKey(): string
diff --git a/src/Bundle/ChillMainBundle/Service/Import/PostalCodeBEFromBestAddress.php b/src/Bundle/ChillMainBundle/Service/Import/PostalCodeBEFromBestAddress.php
index a6d9512c7..64acd072a 100644
--- a/src/Bundle/ChillMainBundle/Service/Import/PostalCodeBEFromBestAddress.php
+++ b/src/Bundle/ChillMainBundle/Service/Import/PostalCodeBEFromBestAddress.php
@@ -66,11 +66,11 @@ class PostalCodeBEFromBestAddress
gzclose($uncompressedStream);
unlink($tmpname);
- $this->logger->info(__CLASS__ . ' list of postal code downloaded');
+ $this->logger->info(self::class . ' list of postal code downloaded');
$this->baseImporter->finalize();
- $this->logger->info(__CLASS__ . ' postal code fetched', ['offset' => $offset ?? 0]);
+ $this->logger->info(self::class . ' postal code fetched', ['offset' => $offset ?? 0]);
}
private function getFileDownloadUrl(string $lang): string
diff --git a/src/Bundle/ChillMainBundle/Service/Import/PostalCodeFRFromOpenData.php b/src/Bundle/ChillMainBundle/Service/Import/PostalCodeFRFromOpenData.php
index f6cc2bd99..4a63db490 100644
--- a/src/Bundle/ChillMainBundle/Service/Import/PostalCodeFRFromOpenData.php
+++ b/src/Bundle/ChillMainBundle/Service/Import/PostalCodeFRFromOpenData.php
@@ -73,7 +73,7 @@ class PostalCodeFRFromOpenData
$this->baseImporter->finalize();
fclose($tmpfile);
- $this->logger->info(__CLASS__ . ' postal code fetched', ['offset' => $offset ?? 0]);
+ $this->logger->info(self::class . ' postal code fetched', ['offset' => $offset ?? 0]);
}
private function handleRecord(array $record): void
diff --git a/src/Bundle/ChillMainBundle/Test/Export/AbstractAggregatorTest.php b/src/Bundle/ChillMainBundle/Test/Export/AbstractAggregatorTest.php
index af0e3843a..99a75582f 100644
--- a/src/Bundle/ChillMainBundle/Test/Export/AbstractAggregatorTest.php
+++ b/src/Bundle/ChillMainBundle/Test/Export/AbstractAggregatorTest.php
@@ -243,7 +243,7 @@ abstract class AbstractAggregatorTest extends KernelTestCase
$result = $results[0];
$this->assertTrue(
- $result instanceof Traversable || is_array($result),
+ is_iterable($result),
'test that each row in the result is traversable or an array'
);
diff --git a/src/Bundle/ChillMainBundle/Test/Export/AbstractExportTest.php b/src/Bundle/ChillMainBundle/Test/Export/AbstractExportTest.php
index 0e5b56ae0..23f6c4b84 100644
--- a/src/Bundle/ChillMainBundle/Test/Export/AbstractExportTest.php
+++ b/src/Bundle/ChillMainBundle/Test/Export/AbstractExportTest.php
@@ -230,7 +230,7 @@ abstract class AbstractExportTest extends WebTestCase
$result = $results[0];
$this->assertTrue(
- $result instanceof Traversable || is_array($result),
+ is_iterable($result),
'test that each row in the result is traversable or an array'
);
diff --git a/src/Bundle/ChillMainBundle/Test/PrepareCenterTrait.php b/src/Bundle/ChillMainBundle/Test/PrepareCenterTrait.php
index 343c41180..e43cc8fdb 100644
--- a/src/Bundle/ChillMainBundle/Test/PrepareCenterTrait.php
+++ b/src/Bundle/ChillMainBundle/Test/PrepareCenterTrait.php
@@ -38,7 +38,7 @@ trait PrepareCenterTrait
}
$center = $this->centerProphet->prophesize();
- $center->willExtend('\Chill\MainBundle\Entity\Center');
+ $center->willExtend('\\' . \Chill\MainBundle\Entity\Center::class);
$center->getId()->willReturn($id);
$center->getName()->willReturn($name);
diff --git a/src/Bundle/ChillMainBundle/Test/PrepareCircleTrait.php b/src/Bundle/ChillMainBundle/Test/PrepareCircleTrait.php
index 4621fce04..8cbe9337c 100644
--- a/src/Bundle/ChillMainBundle/Test/PrepareCircleTrait.php
+++ b/src/Bundle/ChillMainBundle/Test/PrepareCircleTrait.php
@@ -38,7 +38,7 @@ trait PrepareCircleTrait
}
$scope = $this->circleProphet->prophesize();
- $scope->willExtend('\Chill\MainBundle\Entity\Scope');
+ $scope->willExtend('\\' . \Chill\MainBundle\Entity\Scope::class);
$scope->getId()->willReturn($id);
$scope->getName()->willReturn($name);
diff --git a/src/Bundle/ChillMainBundle/Tests/Export/ExportManagerTest.php b/src/Bundle/ChillMainBundle/Tests/Export/ExportManagerTest.php
index 77f5aa1e1..f0a57e1b0 100644
--- a/src/Bundle/ChillMainBundle/Tests/Export/ExportManagerTest.php
+++ b/src/Bundle/ChillMainBundle/Tests/Export/ExportManagerTest.php
@@ -198,10 +198,10 @@ final class ExportManagerTest extends KernelTestCase
//create a formatter
$formatterFoo = $this->prophet->prophesize();
- $formatterFoo->willImplement('Chill\MainBundle\Export\FormatterInterface');
+ $formatterFoo->willImplement(\Chill\MainBundle\Export\FormatterInterface::class);
$formatterFoo->getType()->willReturn('foo');
$formatterBar = $this->prophet->prophesize();
- $formatterBar->willImplement('Chill\MainBundle\Export\FormatterInterface');
+ $formatterBar->willImplement(\Chill\MainBundle\Export\FormatterInterface::class);
$formatterBar->getType()->willReturn('bar');
$exportManager->addFormatter($formatterFoo->reveal(), 'foo');
$exportManager->addFormatter($formatterBar->reveal(), 'bar');
@@ -380,12 +380,12 @@ final class ExportManagerTest extends KernelTestCase
//create a filter and add it to ExportManager
$agg = $this->prophet->prophesize();
- $agg->willImplement('Chill\MainBundle\Export\AggregatorInterface');
+ $agg->willImplement(\Chill\MainBundle\Export\AggregatorInterface::class);
$exportManager->addAggregator($agg->reveal(), 'dummy');
$obtained = $exportManager->getAggregator('dummy');
- $this->assertInstanceof('Chill\MainBundle\Export\AggregatorInterface', $obtained);
+ $this->assertInstanceof(\Chill\MainBundle\Export\AggregatorInterface::class, $obtained);
}
public function testGetAggregatorNonExistant()
@@ -403,11 +403,11 @@ final class ExportManagerTest extends KernelTestCase
//create three filters and add them to ExportManager
$aggFoo = $this->prophet->prophesize();
- $aggFoo->willImplement('Chill\MainBundle\Export\AggregatorInterface');
+ $aggFoo->willImplement(\Chill\MainBundle\Export\AggregatorInterface::class);
$aggBar = $this->prophet->prophesize();
- $aggBar->willImplement('Chill\MainBundle\Export\AggregatorInterface');
+ $aggBar->willImplement(\Chill\MainBundle\Export\AggregatorInterface::class);
$aggFooBar = $this->prophet->prophesize();
- $aggFooBar->willImplement('Chill\MainBundle\Export\AggregatorInterface');
+ $aggFooBar->willImplement(\Chill\MainBundle\Export\AggregatorInterface::class);
$exportManager->addAggregator($aggFoo->reveal(), 'foo');
$exportManager->addAggregator($aggBar->reveal(), 'bar');
$exportManager->addAggregator($aggFooBar->reveal(), 'foobar');
@@ -477,12 +477,12 @@ final class ExportManagerTest extends KernelTestCase
//create a filter and add it to ExportManager
$filter = $this->prophet->prophesize();
- $filter->willImplement('Chill\MainBundle\Export\FilterInterface');
+ $filter->willImplement(\Chill\MainBundle\Export\FilterInterface::class);
$exportManager->addFilter($filter->reveal(), 'dummy');
$obtained = $exportManager->getFilter('dummy');
- $this->assertInstanceof('Chill\MainBundle\Export\FilterInterface', $obtained);
+ $this->assertInstanceof(\Chill\MainBundle\Export\FilterInterface::class, $obtained);
}
public function testGetFilterNonExistant()
@@ -500,11 +500,11 @@ final class ExportManagerTest extends KernelTestCase
//create three filters and add them to ExportManager
$filterFoo = $this->prophet->prophesize();
- $filterFoo->willImplement('Chill\MainBundle\Export\FilterInterface');
+ $filterFoo->willImplement(\Chill\MainBundle\Export\FilterInterface::class);
$filterBar = $this->prophet->prophesize();
- $filterBar->willImplement('Chill\MainBundle\Export\FilterInterface');
+ $filterBar->willImplement(\Chill\MainBundle\Export\FilterInterface::class);
$filterFooBar = $this->prophet->prophesize();
- $filterFooBar->willImplement('Chill\MainBundle\Export\FilterInterface');
+ $filterFooBar->willImplement(\Chill\MainBundle\Export\FilterInterface::class);
$exportManager->addFilter($filterFoo->reveal(), 'foo');
$exportManager->addFilter($filterBar->reveal(), 'bar');
$exportManager->addFilter($filterFooBar->reveal(), 'foobar');
@@ -522,12 +522,12 @@ final class ExportManagerTest extends KernelTestCase
//create a formatter
$formatter = $this->prophet->prophesize();
- $formatter->willImplement('Chill\MainBundle\Export\FormatterInterface');
+ $formatter->willImplement(\Chill\MainBundle\Export\FormatterInterface::class);
$exportManager->addFormatter($formatter->reveal(), 'dummy');
$obtained = $exportManager->getFormatter('dummy');
- $this->assertInstanceOf('Chill\MainBundle\Export\FormatterInterface', $obtained);
+ $this->assertInstanceOf(\Chill\MainBundle\Export\FormatterInterface::class, $obtained);
}
public function testIsGrantedForElementWithExportAndUserIsGranted()
@@ -536,7 +536,7 @@ final class ExportManagerTest extends KernelTestCase
$user = $this->prepareUser([]);
$authorizationChecker = $this->prophet->prophesize();
- $authorizationChecker->willImplement('Symfony\Component\Security\Core\Authorization\AuthorizationCheckerInterface');
+ $authorizationChecker->willImplement(\Symfony\Component\Security\Core\Authorization\AuthorizationCheckerInterface::class);
$authorizationChecker->isGranted('CHILL_STAT_DUMMY', $center)
->willReturn(true);
@@ -564,7 +564,7 @@ final class ExportManagerTest extends KernelTestCase
$user = $this->prepareUser([]);
$authorizationChecker = $this->prophet->prophesize();
- $authorizationChecker->willImplement('Symfony\Component\Security\Core\Authorization\AuthorizationCheckerInterface');
+ $authorizationChecker->willImplement(\Symfony\Component\Security\Core\Authorization\AuthorizationCheckerInterface::class);
$authorizationChecker->isGranted('CHILL_STAT_DUMMY', $center)
->willReturn(true);
$authorizationChecker->isGranted('CHILL_STAT_DUMMY', $centerB)
diff --git a/src/Bundle/ChillMainBundle/Tests/Form/Type/PickCenterTypeTest.php b/src/Bundle/ChillMainBundle/Tests/Form/Type/PickCenterTypeTest.php
index ad32ecee7..ffb7c6bed 100644
--- a/src/Bundle/ChillMainBundle/Tests/Form/Type/PickCenterTypeTest.php
+++ b/src/Bundle/ChillMainBundle/Tests/Form/Type/PickCenterTypeTest.php
@@ -101,7 +101,7 @@ final class PickCenterTypeTest extends TypeTestCase
$prophet = new \Prophecy\Prophet();
$prophecyCenter = $prophet->prophesize();
- $prophecyCenter->willExtend('\Chill\MainBundle\Entity\Center');
+ $prophecyCenter->willExtend('\\' . \Chill\MainBundle\Entity\Center::class);
$prophecyCenter->getId()->willReturn($id);
$prophecyCenter->getName()->willReturn($name);
@@ -122,18 +122,18 @@ final class PickCenterTypeTest extends TypeTestCase
//create a center transformer
$centerTransformerProphecy = $prophet->prophesize();
$centerTransformerProphecy
- ->willExtend('Chill\MainBundle\Form\Type\DataTransformer\CenterTransformer');
+ ->willExtend(\Chill\MainBundle\Form\Type\DataTransformer\CenterTransformer::class);
$transformer = $centerTransformerProphecy->reveal();
$tokenProphecy = $prophet->prophesize();
$tokenProphecy
- ->willImplement('\Symfony\Component\Security\Core\Authentication\Token\TokenInterface');
+ ->willImplement('\\' . \Symfony\Component\Security\Core\Authentication\Token\TokenInterface::class);
$tokenProphecy->getUser()->willReturn($user);
$token = $tokenProphecy->reveal();
$tokenStorageProphecy = $prophet->prophesize();
$tokenStorageProphecy
- ->willExtend('Symfony\Component\Security\Core\Authentication\Token\Storage\TokenStorage');
+ ->willExtend(\Symfony\Component\Security\Core\Authentication\Token\Storage\TokenStorage::class);
$tokenStorageProphecy->getToken()->willReturn($token);
$tokenStorage = $tokenStorageProphecy->reveal();
diff --git a/src/Bundle/ChillMainBundle/Tests/Search/AbstractSearchTest.php b/src/Bundle/ChillMainBundle/Tests/Search/AbstractSearchTest.php
index 497f91271..9348c6fe2 100644
--- a/src/Bundle/ChillMainBundle/Tests/Search/AbstractSearchTest.php
+++ b/src/Bundle/ChillMainBundle/Tests/Search/AbstractSearchTest.php
@@ -26,7 +26,7 @@ final class AbstractSearchTest extends \PHPUnit\Framework\TestCase
protected function setUp(): void
{
- $this->stub = $this->getMockForAbstractClass('Chill\MainBundle\Search\AbstractSearch');
+ $this->stub = $this->getMockForAbstractClass(\Chill\MainBundle\Search\AbstractSearch::class);
}
public function testParseDateRegular()
diff --git a/src/Bundle/ChillMainBundle/Tests/Search/SearchProviderTest.php b/src/Bundle/ChillMainBundle/Tests/Search/SearchProviderTest.php
index 362787b84..f9dbcec51 100644
--- a/src/Bundle/ChillMainBundle/Tests/Search/SearchProviderTest.php
+++ b/src/Bundle/ChillMainBundle/Tests/Search/SearchProviderTest.php
@@ -245,7 +245,7 @@ final class SearchProviderTest extends TestCase
private function createDefaultSearchService($result, $order)
{
$mock = $this
- ->getMockForAbstractClass('Chill\MainBundle\Search\AbstractSearch');
+ ->getMockForAbstractClass(\Chill\MainBundle\Search\AbstractSearch::class);
//set the mock as default
$mock->expects($this->any())
@@ -267,7 +267,7 @@ final class SearchProviderTest extends TestCase
private function createNonDefaultDomainSearchService($result, $order, $domain)
{
$mock = $this
- ->getMockForAbstractClass('Chill\MainBundle\Search\AbstractSearch');
+ ->getMockForAbstractClass(\Chill\MainBundle\Search\AbstractSearch::class);
//set the mock as default
$mock->expects($this->any())
diff --git a/src/Bundle/ChillMainBundle/Tests/Security/Authorization/AuthorizationHelperTest.php b/src/Bundle/ChillMainBundle/Tests/Security/Authorization/AuthorizationHelperTest.php
index cc5a49096..8e3c27e99 100644
--- a/src/Bundle/ChillMainBundle/Tests/Security/Authorization/AuthorizationHelperTest.php
+++ b/src/Bundle/ChillMainBundle/Tests/Security/Authorization/AuthorizationHelperTest.php
@@ -279,8 +279,8 @@ final class AuthorizationHelperTest extends KernelTestCase
]);
$helper = $this->getAuthorizationHelper();
$entity = $this->getProphet()->prophesize();
- $entity->willImplement('\Chill\MainBundle\Entity\HasCenterInterface');
- $entity->willImplement('\Chill\MainBundle\Entity\HasScopeInterface');
+ $entity->willImplement('\\' . \Chill\MainBundle\Entity\HasCenterInterface::class);
+ $entity->willImplement('\\' . \Chill\MainBundle\Entity\HasScopeInterface::class);
$entity->getCenter()->willReturn($center);
$entity->getScope()->willReturn($scope);
@@ -386,7 +386,7 @@ final class AuthorizationHelperTest extends KernelTestCase
]);
$helper = $this->getAuthorizationHelper();
$entity = $this->getProphet()->prophesize();
- $entity->willImplement('\Chill\MainBundle\Entity\HasCenterInterface');
+ $entity->willImplement('\\' . \Chill\MainBundle\Entity\HasCenterInterface::class);
$entity->getCenter()->willReturn($center);
$this->assertTrue($helper->userHasAccess(
@@ -410,7 +410,7 @@ final class AuthorizationHelperTest extends KernelTestCase
$helper = $this->getAuthorizationHelper();
$entity = $this->getProphet()->prophesize();
- $entity->willImplement('\Chill\MainBundle\Entity\HasCenterInterface');
+ $entity->willImplement('\\' . \Chill\MainBundle\Entity\HasCenterInterface::class);
$entity->getCenter()->willReturn($center);
$this->assertTrue($helper->userHasAccess(
@@ -434,8 +434,8 @@ final class AuthorizationHelperTest extends KernelTestCase
]);
$helper = $this->getAuthorizationHelper();
$entity = $this->getProphet()->prophesize();
- $entity->willImplement('\Chill\MainBundle\Entity\HasCenterInterface');
- $entity->willImplement('\Chill\MainBundle\Entity\HasScopeInterface');
+ $entity->willImplement('\\' . \Chill\MainBundle\Entity\HasCenterInterface::class);
+ $entity->willImplement('\\' . \Chill\MainBundle\Entity\HasScopeInterface::class);
$entity->getCenter()->willReturn($centerB);
$entity->getScope()->willReturn($scope);
@@ -455,7 +455,7 @@ final class AuthorizationHelperTest extends KernelTestCase
]);
$helper = $this->getAuthorizationHelper();
$entity = $this->getProphet()->prophesize();
- $entity->willImplement('\Chill\MainBundle\Entity\HasCenterInterface');
+ $entity->willImplement('\\' . \Chill\MainBundle\Entity\HasCenterInterface::class);
$entity->getCenter()->willReturn($center);
$this->assertFalse($helper->userHasAccess($user, $entity->reveal(), 'CHILL_ROLE'));
@@ -474,8 +474,8 @@ final class AuthorizationHelperTest extends KernelTestCase
]);
$helper = $this->getAuthorizationHelper();
$entity = $this->getProphet()->prophesize();
- $entity->willImplement('\Chill\MainBundle\Entity\HasCenterInterface');
- $entity->willImplement('\Chill\MainBundle\Entity\HasScopeInterface');
+ $entity->willImplement('\\' . \Chill\MainBundle\Entity\HasCenterInterface::class);
+ $entity->willImplement('\\' . \Chill\MainBundle\Entity\HasScopeInterface::class);
$entity->getCenter()->willReturn($center);
$entity->getScope()->willReturn($scope);
@@ -506,7 +506,7 @@ final class AuthorizationHelperTest extends KernelTestCase
]);
$helper = $this->getAuthorizationHelper();
$entity = $this->getProphet()->prophesize();
- $entity->willImplement('\Chill\MainBundle\Entity\HasCenterInterface');
+ $entity->willImplement('\\' . \Chill\MainBundle\Entity\HasCenterInterface::class);
$entity->getCenter()->willReturn($centerA);
$this->assertFalse($helper->userHasAccess($user, $entity->reveal(), 'CHILL_ROLE'));
diff --git a/src/Bundle/ChillPersonBundle/Controller/PersonController.php b/src/Bundle/ChillPersonBundle/Controller/PersonController.php
index bb03a6b33..4b1c10e0f 100644
--- a/src/Bundle/ChillPersonBundle/Controller/PersonController.php
+++ b/src/Bundle/ChillPersonBundle/Controller/PersonController.php
@@ -162,7 +162,7 @@ final class PersonController extends AbstractController
$cFGroup = null;
$cFDefaultGroup = $this->em->getRepository(\Chill\CustomFieldsBundle\Entity\CustomFieldsDefaultGroup::class)
- ->findOneByEntity('Chill\\PersonBundle\\Entity\\Person');
+ ->findOneByEntity(\Chill\PersonBundle\Entity\Person::class);
if ($cFDefaultGroup) {
$cFGroup = $cFDefaultGroup->getCustomFieldsGroup();
diff --git a/src/Bundle/ChillPersonBundle/DataFixtures/ORM/LoadCustomFields.php b/src/Bundle/ChillPersonBundle/DataFixtures/ORM/LoadCustomFields.php
index 14434be6e..87746842a 100644
--- a/src/Bundle/ChillPersonBundle/DataFixtures/ORM/LoadCustomFields.php
+++ b/src/Bundle/ChillPersonBundle/DataFixtures/ORM/LoadCustomFields.php
@@ -125,12 +125,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 (mt_rand(0, 1) === 1) {
+ if (random_int(0, 1) === 1) {
/** @var Person $person */
$person = $manager->getRepository(Person::class)->find($id);
$person->setCFData([
'remarques' => $this->createCustomFieldText()
- ->serialize($faker->text(mt_rand(150, 250)), $this->customFieldText),
+ ->serialize($faker->text(random_int(150, 250)), $this->customFieldText),
'document-d-identite' => $this->createCustomFieldChoice()
->serialize([$choices[array_rand($choices)]], $this->customFieldChoice),
]);
diff --git a/src/Bundle/ChillPersonBundle/DependencyInjection/ChillPersonExtension.php b/src/Bundle/ChillPersonBundle/DependencyInjection/ChillPersonExtension.php
index d60e15e41..6a2dc924e 100644
--- a/src/Bundle/ChillPersonBundle/DependencyInjection/ChillPersonExtension.php
+++ b/src/Bundle/ChillPersonBundle/DependencyInjection/ChillPersonExtension.php
@@ -1006,7 +1006,7 @@ class ChillPersonExtension extends Extension implements PrependExtensionInterfac
'property' => 'step',
],
'supports' => [
- 'Chill\PersonBundle\Entity\AccompanyingPeriod',
+ \Chill\PersonBundle\Entity\AccompanyingPeriod::class,
],
'initial_marking' => 'DRAFT',
'places' => [
@@ -1043,7 +1043,7 @@ class ChillPersonExtension extends Extension implements PrependExtensionInterfac
$container->prependExtensionConfig(
'chill_custom_fields',
['customizables_entities' => [
- ['class' => 'Chill\PersonBundle\Entity\Person', 'name' => 'PersonEntity'],
+ ['class' => \Chill\PersonBundle\Entity\Person::class, 'name' => 'PersonEntity'],
],
]
);
diff --git a/src/Bundle/ChillPersonBundle/DependencyInjection/Configuration.php b/src/Bundle/ChillPersonBundle/DependencyInjection/Configuration.php
index f9686c900..a591663ad 100644
--- a/src/Bundle/ChillPersonBundle/DependencyInjection/Configuration.php
+++ b/src/Bundle/ChillPersonBundle/DependencyInjection/Configuration.php
@@ -30,7 +30,7 @@ class Configuration implements ConfigurationInterface
public function getConfigTreeBuilder()
{
$treeBuilder = new TreeBuilder('cl_chill_person');
- $rootNode = $treeBuilder->getRootNode('cl_chill_person');
+ $rootNode = $treeBuilder->getRootNode();
$rootNode
->canBeDisabled()
@@ -137,7 +137,7 @@ class Configuration implements ConfigurationInterface
private function addFieldNode($key)
{
$tree = new TreeBuilder($key, 'enum');
- $node = $tree->getRootNode($key);
+ $node = $tree->getRootNode();
switch ($key) {
case 'accompanying_period':
diff --git a/src/Bundle/ChillPersonBundle/Entity/Household/Household.php b/src/Bundle/ChillPersonBundle/Entity/Household/Household.php
index b463312c8..48e1ac1fc 100644
--- a/src/Bundle/ChillPersonBundle/Entity/Household/Household.php
+++ b/src/Bundle/ChillPersonBundle/Entity/Household/Household.php
@@ -200,7 +200,7 @@ class Household
*/
public function getCurrentAddress(?DateTime $at = null): ?Address
{
- $at = null === $at ? new DateTime('today') : $at;
+ $at = $at ?? new DateTime('today');
$addrs = $this->getAddresses()->filter(static function (Address $a) use ($at) {
return $a->getValidFrom() <= $at && (
@@ -412,7 +412,7 @@ class Household
{
$criteria = new Criteria();
$expr = Criteria::expr();
- $date = null === $now ? (new DateTimeImmutable('today')) : $now;
+ $date = $now ?? new DateTimeImmutable('today');
$criteria
->where(
@@ -634,7 +634,7 @@ class Household
{
$criteria = new Criteria();
$expr = Criteria::expr();
- $date = null === $now ? (new DateTimeImmutable('today')) : $now;
+ $date = $now ?? new DateTimeImmutable('today');
$criteria
->where($expr->orX(
diff --git a/src/Bundle/ChillPersonBundle/Entity/Household/HouseholdMember.php b/src/Bundle/ChillPersonBundle/Entity/Household/HouseholdMember.php
index e5e5e4626..031279173 100644
--- a/src/Bundle/ChillPersonBundle/Entity/Household/HouseholdMember.php
+++ b/src/Bundle/ChillPersonBundle/Entity/Household/HouseholdMember.php
@@ -142,7 +142,7 @@ class HouseholdMember
public function isCurrent(?DateTimeImmutable $at = null): bool
{
- $at = null === $at ? new DateTimeImmutable('now') : $at;
+ $at = $at ?? new DateTimeImmutable('now');
return $this->getStartDate() < $at && (
null === $this->getEndDate() || $this->getEndDate() > $at
diff --git a/src/Bundle/ChillPersonBundle/Entity/Person.php b/src/Bundle/ChillPersonBundle/Entity/Person.php
index 27c34ba23..63bd6efba 100644
--- a/src/Bundle/ChillPersonBundle/Entity/Person.php
+++ b/src/Bundle/ChillPersonBundle/Entity/Person.php
@@ -1087,7 +1087,7 @@ class Person implements HasCenterInterface, TrackCreationInterface, TrackUpdateI
{
$criteria = new Criteria();
$expr = Criteria::expr();
- $date = null === $at ? new DateTimeImmutable('today') : $at;
+ $date = $at ?? new DateTimeImmutable('today');
$datef = $date->format('Y-m-d');
if (
diff --git a/src/Bundle/ChillPersonBundle/Export/Filter/PersonFilters/AgeFilter.php b/src/Bundle/ChillPersonBundle/Export/Filter/PersonFilters/AgeFilter.php
index 0bf175ce4..c05f97ca8 100644
--- a/src/Bundle/ChillPersonBundle/Export/Filter/PersonFilters/AgeFilter.php
+++ b/src/Bundle/ChillPersonBundle/Export/Filter/PersonFilters/AgeFilter.php
@@ -42,8 +42,8 @@ class AgeFilter implements ExportElementValidatedInterface, FilterInterface
{
$where = $qb->getDQLPart('where');
- $min = null !== $data['min_age'] ? $data['min_age'] : 0;
- $max = null !== $data['max_age'] ? $data['max_age'] : 150;
+ $min = $data['min_age'] ?? 0;
+ $max = $data['max_age'] ?? 150;
$calc = $this->rollingDateConverter->convert($data['date_calc']);
$minDate = $calc->sub(new DateInterval('P' . $max . 'Y'));
diff --git a/src/Bundle/ChillPersonBundle/Form/AccompanyingPeriodType.php b/src/Bundle/ChillPersonBundle/Form/AccompanyingPeriodType.php
index f6bf4962e..25d380562 100644
--- a/src/Bundle/ChillPersonBundle/Form/AccompanyingPeriodType.php
+++ b/src/Bundle/ChillPersonBundle/Form/AccompanyingPeriodType.php
@@ -98,7 +98,7 @@ class AccompanyingPeriodType extends AbstractType
public function configureOptions(OptionsResolver $resolver)
{
$resolver->setDefaults([
- 'data_class' => 'Chill\PersonBundle\Entity\AccompanyingPeriod',
+ 'data_class' => \Chill\PersonBundle\Entity\AccompanyingPeriod::class,
]);
$resolver
diff --git a/src/Bundle/ChillPersonBundle/Form/PersonType.php b/src/Bundle/ChillPersonBundle/Form/PersonType.php
index 15888c015..42e62929d 100644
--- a/src/Bundle/ChillPersonBundle/Form/PersonType.php
+++ b/src/Bundle/ChillPersonBundle/Form/PersonType.php
@@ -250,7 +250,7 @@ class PersonType extends AbstractType
$resolver->setAllowedTypes(
'cFGroup',
- ['null', 'Chill\CustomFieldsBundle\Entity\CustomFieldsGroup']
+ ['null', \Chill\CustomFieldsBundle\Entity\CustomFieldsGroup::class]
);
}
diff --git a/src/Bundle/ChillPersonBundle/Form/Type/Select2MaritalStatusType.php b/src/Bundle/ChillPersonBundle/Form/Type/Select2MaritalStatusType.php
index 0099e6367..f057bc1d1 100644
--- a/src/Bundle/ChillPersonBundle/Form/Type/Select2MaritalStatusType.php
+++ b/src/Bundle/ChillPersonBundle/Form/Type/Select2MaritalStatusType.php
@@ -40,13 +40,13 @@ class Select2MaritalStatusType extends AbstractType
public function buildForm(FormBuilderInterface $builder, array $options)
{
- $transformer = new ObjectToIdTransformer($this->em, 'Chill\PersonBundle\Entity\MaritalStatus');
+ $transformer = new ObjectToIdTransformer($this->em, \Chill\PersonBundle\Entity\MaritalStatus::class);
$builder->addModelTransformer($transformer);
}
public function configureOptions(OptionsResolver $resolver)
{
- $maritalStatuses = $this->em->getRepository('Chill\PersonBundle\Entity\MaritalStatus')->findAll();
+ $maritalStatuses = $this->em->getRepository(\Chill\PersonBundle\Entity\MaritalStatus::class)->findAll();
$choices = [];
foreach ($maritalStatuses as $ms) {
diff --git a/src/Bundle/ChillPersonBundle/Household/MembersEditor.php b/src/Bundle/ChillPersonBundle/Household/MembersEditor.php
index bdb7a8eca..2b2564091 100644
--- a/src/Bundle/ChillPersonBundle/Household/MembersEditor.php
+++ b/src/Bundle/ChillPersonBundle/Household/MembersEditor.php
@@ -168,7 +168,7 @@ class MembersEditor
$criteria->where(
$expr->andX(
$expr->lt('startDate', $date),
- $expr->isNull('endDate', $date)
+ $expr->isNull('endDate')
)
);
diff --git a/src/Bundle/ChillPersonBundle/Repository/ResidentialAddressRepository.php b/src/Bundle/ChillPersonBundle/Repository/ResidentialAddressRepository.php
index 424411a72..5f75d537b 100644
--- a/src/Bundle/ChillPersonBundle/Repository/ResidentialAddressRepository.php
+++ b/src/Bundle/ChillPersonBundle/Repository/ResidentialAddressRepository.php
@@ -44,7 +44,7 @@ class ResidentialAddressRepository extends ServiceEntityRepository
public function buildQueryFindCurrentResidentialAddresses(Person $person, ?DateTimeImmutable $at = null): QueryBuilder
{
- $date = null === $at ? new DateTimeImmutable('today') : $at;
+ $date = $at ?? new DateTimeImmutable('today');
$qb = $this->createQueryBuilder('ra');
$dateFilter = $qb->expr()->andX(
diff --git a/src/Bundle/ChillPersonBundle/Service/AccompanyingPeriod/OldDraftAccompanyingPeriodRemover.php b/src/Bundle/ChillPersonBundle/Service/AccompanyingPeriod/OldDraftAccompanyingPeriodRemover.php
index 2a608e4c1..a5663050a 100644
--- a/src/Bundle/ChillPersonBundle/Service/AccompanyingPeriod/OldDraftAccompanyingPeriodRemover.php
+++ b/src/Bundle/ChillPersonBundle/Service/AccompanyingPeriod/OldDraftAccompanyingPeriodRemover.php
@@ -34,7 +34,7 @@ class OldDraftAccompanyingPeriodRemover implements OldDraftAccompanyingPeriodRem
public function remove(DateInterval $interval): void
{
- $this->logger->debug('[' . __CLASS__ . '] start to remove old periods', [
+ $this->logger->debug('[' . self::class . '] start to remove old periods', [
'interval' => $interval->format('%d days'),
]);
@@ -96,7 +96,7 @@ class OldDraftAccompanyingPeriodRemover implements OldDraftAccompanyingPeriodRem
];
});
- $this->logger->info('[' . __CLASS__ . '] periods removed', array_merge($results, [
+ $this->logger->info('[' . self::class . '] periods removed', array_merge($results, [
'interval' => $interval->format('%d days'),
]));
}
diff --git a/src/Bundle/ChillPersonBundle/Tests/AccompanyingPeriod/Events/PersonMoveEventSubscriberTest.php b/src/Bundle/ChillPersonBundle/Tests/AccompanyingPeriod/Events/PersonMoveEventSubscriberTest.php
index e35766a75..4f9977b6d 100644
--- a/src/Bundle/ChillPersonBundle/Tests/AccompanyingPeriod/Events/PersonMoveEventSubscriberTest.php
+++ b/src/Bundle/ChillPersonBundle/Tests/AccompanyingPeriod/Events/PersonMoveEventSubscriberTest.php
@@ -162,7 +162,7 @@ final class PersonMoveEventSubscriberTest extends KernelTestCase
->setNextMembership($nextMembership);
$notificationPersister = $this->prophesize(NotificationPersisterInterface::class);
- $notificationPersister->persist(Argument::type(Notification::class))->shouldBeCalled(1);
+ $notificationPersister->persist(Argument::type(Notification::class))->shouldBeCalled();
$eventSubscriber = $this->buildSubscriber(null, $notificationPersister->reveal(), null, null);
$eventSubscriber->resetPeriodLocation($event);
diff --git a/src/Bundle/ChillPersonBundle/Tests/Controller/PersonControllerCreateTest.php b/src/Bundle/ChillPersonBundle/Tests/Controller/PersonControllerCreateTest.php
index fbba0bbc3..6f92c864b 100644
--- a/src/Bundle/ChillPersonBundle/Tests/Controller/PersonControllerCreateTest.php
+++ b/src/Bundle/ChillPersonBundle/Tests/Controller/PersonControllerCreateTest.php
@@ -89,7 +89,7 @@ final class PersonControllerCreateTest extends WebTestCase
$form = $crawler->selectButton('Ajouter la personne')->form();
$this->assertInstanceOf(
- 'Symfony\Component\DomCrawler\Form',
+ \Symfony\Component\DomCrawler\Form::class,
$form,
'The page contains a butto '
);
diff --git a/src/Bundle/ChillPersonBundle/Tests/Security/Authorization/PersonVoterTest.php b/src/Bundle/ChillPersonBundle/Tests/Security/Authorization/PersonVoterTest.php
index d7f08a3a4..e6651028c 100644
--- a/src/Bundle/ChillPersonBundle/Tests/Security/Authorization/PersonVoterTest.php
+++ b/src/Bundle/ChillPersonBundle/Tests/Security/Authorization/PersonVoterTest.php
@@ -158,7 +158,7 @@ final class PersonVoterTest extends KernelTestCase
{
$token = $this->prophet->prophesize();
$token
- ->willImplement('\Symfony\Component\Security\Core\Authentication\Token\TokenInterface');
+ ->willImplement('\\' . \Symfony\Component\Security\Core\Authentication\Token\TokenInterface::class);
if (null === $permissions) {
$token->getUser()->willReturn(null);
diff --git a/src/Bundle/ChillPersonBundle/Tests/Serializer/Normalizer/AccompanyingPeriodWorkDocGenNormalizerTest.php b/src/Bundle/ChillPersonBundle/Tests/Serializer/Normalizer/AccompanyingPeriodWorkDocGenNormalizerTest.php
index e71e0bf51..ce226834b 100644
--- a/src/Bundle/ChillPersonBundle/Tests/Serializer/Normalizer/AccompanyingPeriodWorkDocGenNormalizerTest.php
+++ b/src/Bundle/ChillPersonBundle/Tests/Serializer/Normalizer/AccompanyingPeriodWorkDocGenNormalizerTest.php
@@ -88,7 +88,7 @@ final class AccompanyingPeriodWorkDocGenNormalizerTest extends KernelTestCase
$this->assertEqualsCanonicalizing(array_keys($expected), array_keys($actual));
foreach ($expected as $key => $item) {
- if ('@ignored' === $item) {
+ if (0 === $item) {
continue;
}
diff --git a/src/Bundle/ChillPersonBundle/Tests/Service/DocGenerator/PersonContextTest.php b/src/Bundle/ChillPersonBundle/Tests/Service/DocGenerator/PersonContextTest.php
index 44414cdba..17c6195b3 100644
--- a/src/Bundle/ChillPersonBundle/Tests/Service/DocGenerator/PersonContextTest.php
+++ b/src/Bundle/ChillPersonBundle/Tests/Service/DocGenerator/PersonContextTest.php
@@ -187,8 +187,7 @@ final class PersonContextTest extends TestCase
{
$builder = $this->prophesize(FormBuilderInterface::class);
- $builder->add('title', TextType::class, Argument::type('array'))
- ->shouldBeCalled(1);
+ $builder->add('title', TextType::class, Argument::type('array'))->shouldBeCalled();
if ($withScope) {
$builder->add('scope', ScopePickerType::class, Argument::type('array'))
diff --git a/src/Bundle/ChillReportBundle/Controller/ReportController.php b/src/Bundle/ChillReportBundle/Controller/ReportController.php
index 0a62a4b33..da39aedec 100644
--- a/src/Bundle/ChillReportBundle/Controller/ReportController.php
+++ b/src/Bundle/ChillReportBundle/Controller/ReportController.php
@@ -344,7 +344,7 @@ class ReportController extends AbstractController
}
$cFGroups = $em->getRepository(\Chill\CustomFieldsBundle\Entity\CustomFieldsGroup::class)
- ->findByEntity('Chill\ReportBundle\Entity\Report');
+ ->findByEntity(\Chill\ReportBundle\Entity\Report::class);
if (count($cFGroups) === 1) {
return $this->redirect(
@@ -403,7 +403,7 @@ class ReportController extends AbstractController
$em = $this->getDoctrine()->getManager();
$cFGroups = $em->getRepository(\Chill\CustomFieldsBundle\Entity\CustomFieldsGroup::class)
- ->findByEntity('Chill\ReportBundle\Entity\Report');
+ ->findByEntity(\Chill\ReportBundle\Entity\Report::class);
if (count($cFGroups) === 1) {
return $this->redirect(
diff --git a/src/Bundle/ChillReportBundle/DataFixtures/ORM/LoadCustomField.php b/src/Bundle/ChillReportBundle/DataFixtures/ORM/LoadCustomField.php
index 5eebbaad1..a9b8edc30 100644
--- a/src/Bundle/ChillReportBundle/DataFixtures/ORM/LoadCustomField.php
+++ b/src/Bundle/ChillReportBundle/DataFixtures/ORM/LoadCustomField.php
@@ -68,15 +68,15 @@ class LoadCustomField extends AbstractFixture implements OrderedFixtureInterface
];
for ($i = 0; 25 >= $i; ++$i) {
- $cFType = $cFTypes[mt_rand(0, count($cFTypes) - 1)];
+ $cFType = $cFTypes[random_int(0, count($cFTypes) - 1)];
$customField = (new CustomField())
->setSlug("cf_report_{$i}")
->setType($cFType['type'])
->setOptions($cFType['options'])
->setName(['fr' => "CustomField {$i}"])
- ->setOrdering(mt_rand(0, 1000) / 1000)
- ->setCustomFieldsGroup($this->getReference('cf_group_report_' . (mt_rand(0, 3))));
+ ->setOrdering(random_int(0, 1000) / 1000)
+ ->setCustomFieldsGroup($this->getReference('cf_group_report_' . (random_int(0, 3))));
$manager->persist($customField);
}
diff --git a/src/Bundle/ChillReportBundle/DataFixtures/ORM/LoadCustomFieldsGroup.php b/src/Bundle/ChillReportBundle/DataFixtures/ORM/LoadCustomFieldsGroup.php
index 47cc2511d..32bd5c346 100644
--- a/src/Bundle/ChillReportBundle/DataFixtures/ORM/LoadCustomFieldsGroup.php
+++ b/src/Bundle/ChillReportBundle/DataFixtures/ORM/LoadCustomFieldsGroup.php
@@ -66,7 +66,7 @@ class LoadCustomFieldsGroup extends AbstractFixture implements OrderedFixtureInt
$cFGroup = (new CustomFieldsGroup())
->setName($name)
- ->setEntity('Chill\ReportBundle\Entity\Report')
+ ->setEntity(\Chill\ReportBundle\Entity\Report::class)
->setOptions($options);
$manager->persist($cFGroup);
diff --git a/src/Bundle/ChillReportBundle/DataFixtures/ORM/LoadReports.php b/src/Bundle/ChillReportBundle/DataFixtures/ORM/LoadReports.php
index 2148a370a..db4646eed 100644
--- a/src/Bundle/ChillReportBundle/DataFixtures/ORM/LoadReports.php
+++ b/src/Bundle/ChillReportBundle/DataFixtures/ORM/LoadReports.php
@@ -88,7 +88,7 @@ class LoadReports extends AbstractFixture implements ContainerAwareInterface, Or
$report = (new Report())
->setPerson($person)
->setCFGroup(
- mt_rand(0, 10) > 5 ?
+ random_int(0, 10) > 5 ?
$this->getReference('cf_group_report_logement') :
$this->getReference('cf_group_report_education')
)
@@ -111,7 +111,7 @@ class LoadReports extends AbstractFixture implements ContainerAwareInterface, Or
//set date. 30% of the dates are 2015-05-01
$expectedDate = new DateTime('2015-01-05');
- if (mt_rand(0, 100) < 30) {
+ if (random_int(0, 100) < 30) {
$report->setDate($expectedDate);
} else {
$report->setDate($this->faker->dateTimeBetween('-1 year', 'now')
@@ -155,7 +155,7 @@ class LoadReports extends AbstractFixture implements ContainerAwareInterface, Or
$selectedPeople = [];
foreach ($people as $person) {
- if (mt_rand(0, 100) < $percentage) {
+ if (random_int(0, 100) < $percentage) {
$selectedPeople[] = $person;
}
}
@@ -183,7 +183,7 @@ class LoadReports extends AbstractFixture implements ContainerAwareInterface, Or
$picked = [];
if ($multiple) {
- $numberSelected = mt_rand(1, count($choices) - 1);
+ $numberSelected = random_int(1, count($choices) - 1);
for ($i = 0; $i < $numberSelected; ++$i) {
$picked[] = $this->pickChoice($choices);
diff --git a/src/Bundle/ChillReportBundle/DependencyInjection/ChillReportExtension.php b/src/Bundle/ChillReportBundle/DependencyInjection/ChillReportExtension.php
index 9d8bf8fbe..8f1c5d0d4 100644
--- a/src/Bundle/ChillReportBundle/DependencyInjection/ChillReportExtension.php
+++ b/src/Bundle/ChillReportBundle/DependencyInjection/ChillReportExtension.php
@@ -41,7 +41,7 @@ class ChillReportExtension extends Extension implements PrependExtensionInterfac
'chill_custom_fields',
['customizables_entities' => [
[
- 'class' => 'Chill\ReportBundle\Entity\Report',
+ 'class' => \Chill\ReportBundle\Entity\Report::class,
'name' => 'ReportEntity',
'options' => [
'summary_fields' => [
diff --git a/src/Bundle/ChillReportBundle/DependencyInjection/Configuration.php b/src/Bundle/ChillReportBundle/DependencyInjection/Configuration.php
index 565ff08a7..70c9f532b 100644
--- a/src/Bundle/ChillReportBundle/DependencyInjection/Configuration.php
+++ b/src/Bundle/ChillReportBundle/DependencyInjection/Configuration.php
@@ -24,7 +24,7 @@ class Configuration implements ConfigurationInterface
public function getConfigTreeBuilder()
{
$treeBuilder = new TreeBuilder('chill_report');
- $rootNode = $treeBuilder->getRootNode('chill_report');
+ $rootNode = $treeBuilder->getRootNode();
// Here you should define the parameters that are allowed to
// configure your bundle. See the documentation linked above for
diff --git a/src/Bundle/ChillReportBundle/Form/ReportType.php b/src/Bundle/ChillReportBundle/Form/ReportType.php
index 435d894d9..8d6551443 100644
--- a/src/Bundle/ChillReportBundle/Form/ReportType.php
+++ b/src/Bundle/ChillReportBundle/Form/ReportType.php
@@ -88,14 +88,14 @@ class ReportType extends AbstractType
public function configureOptions(OptionsResolver $resolver)
{
$resolver->setDefaults([
- 'data_class' => 'Chill\ReportBundle\Entity\Report',
+ 'data_class' => \Chill\ReportBundle\Entity\Report::class,
]);
$resolver->setRequired([
'cFGroup',
]);
- $resolver->setAllowedTypes('cFGroup', 'Chill\CustomFieldsBundle\Entity\CustomFieldsGroup');
+ $resolver->setAllowedTypes('cFGroup', \Chill\CustomFieldsBundle\Entity\CustomFieldsGroup::class);
$this->appendScopeChoicesOptions($resolver);
}
diff --git a/src/Bundle/ChillReportBundle/Search/ReportSearch.php b/src/Bundle/ChillReportBundle/Search/ReportSearch.php
index 55bbe9f66..e392c37f5 100644
--- a/src/Bundle/ChillReportBundle/Search/ReportSearch.php
+++ b/src/Bundle/ChillReportBundle/Search/ReportSearch.php
@@ -167,7 +167,7 @@ class ReportSearch extends AbstractSearch implements ContainerAwareInterface
->orderBy('r.date', 'desc');
$reportQuery = $qb->getQuery();
- $reportQuery->setFetchMode('Chill\\ReportBundle\\Entity\\Report', 'person', \Doctrine\ORM\Mapping\ClassMetadata::FETCH_EAGER);
+ $reportQuery->setFetchMode(\Chill\ReportBundle\Entity\Report::class, 'person', \Doctrine\ORM\Mapping\ClassMetadata::FETCH_EAGER);
return $reportQuery->getResult();
}
diff --git a/src/Bundle/ChillReportBundle/Tests/Controller/ReportControllerNextTest.php b/src/Bundle/ChillReportBundle/Tests/Controller/ReportControllerNextTest.php
index ea30084ae..d299860bc 100644
--- a/src/Bundle/ChillReportBundle/Tests/Controller/ReportControllerNextTest.php
+++ b/src/Bundle/ChillReportBundle/Tests/Controller/ReportControllerNextTest.php
@@ -64,7 +64,7 @@ final class ReportControllerNextTest extends WebTestCase
$customFieldsGroups = self::$kernel->getContainer()
->get('doctrine.orm.entity_manager')
->getRepository(\Chill\CustomFieldsBundle\Entity\CustomFieldsGroup::class)
- ->findBy(['entity' => 'Chill\ReportBundle\Entity\Report']);
+ ->findBy(['entity' => \Chill\ReportBundle\Entity\Report::class]);
//filter customFieldsGroup to get only "situation de logement"
$filteredCustomFieldsGroupHouse = array_filter(
$customFieldsGroups,
diff --git a/src/Bundle/ChillReportBundle/Tests/Controller/ReportControllerTest.php b/src/Bundle/ChillReportBundle/Tests/Controller/ReportControllerTest.php
index 6a6ee99f1..1afe851b8 100644
--- a/src/Bundle/ChillReportBundle/Tests/Controller/ReportControllerTest.php
+++ b/src/Bundle/ChillReportBundle/Tests/Controller/ReportControllerTest.php
@@ -82,7 +82,7 @@ final class ReportControllerTest extends WebTestCase
$customFieldsGroups = self::$kernel->getContainer()
->get('doctrine.orm.entity_manager')
->getRepository(\Chill\CustomFieldsBundle\Entity\CustomFieldsGroup::class)
- ->findBy(['entity' => 'Chill\ReportBundle\Entity\Report']);
+ ->findBy(['entity' => \Chill\ReportBundle\Entity\Report::class]);
//filter customFieldsGroup to get only "situation de logement"
$filteredCustomFieldsGroupHouse = array_filter(
$customFieldsGroups,
@@ -132,7 +132,7 @@ final class ReportControllerTest extends WebTestCase
$form = $crawlerAddAReportPage->selectButton('Créer un nouveau rapport')->form();
$this->assertInstanceOf(
- 'Symfony\Component\DomCrawler\Form',
+ \Symfony\Component\DomCrawler\Form::class,
$form,
'I can see a form with a button "add a new report" '
);
@@ -251,7 +251,7 @@ final class ReportControllerTest extends WebTestCase
$link = $crawlerPersonPage->selectLink("AJOUT D'UN RAPPORT")->link();
$this->assertInstanceOf(
- 'Symfony\Component\DomCrawler\Link',
+ \Symfony\Component\DomCrawler\Link::class,
$link,
'There is a "add a report" link in menu'
);
@@ -278,7 +278,7 @@ final class ReportControllerTest extends WebTestCase
->form();
$this->assertInstanceOf(
- 'Symfony\Component\DomCrawler\Form',
+ \Symfony\Component\DomCrawler\Form::class,
$addForm,
'I have a report form'
);
diff --git a/src/Bundle/ChillReportBundle/Tests/DependencyInjection/ChillReportExtensionTest.php b/src/Bundle/ChillReportBundle/Tests/DependencyInjection/ChillReportExtensionTest.php
index 2b02159ca..e480ca960 100644
--- a/src/Bundle/ChillReportBundle/Tests/DependencyInjection/ChillReportExtensionTest.php
+++ b/src/Bundle/ChillReportBundle/Tests/DependencyInjection/ChillReportExtensionTest.php
@@ -32,7 +32,7 @@ final class ChillReportExtensionTest extends KernelTestCase
$reportFounded = false;
foreach ($customizablesEntities as $customizablesEntity) {
- if ('Chill\ReportBundle\Entity\Report' === $customizablesEntity['class']) {
+ if (\Chill\ReportBundle\Entity\Report::class === $customizablesEntity['class']) {
$reportFounded = true;
}
}
diff --git a/src/Bundle/ChillReportBundle/Tests/Security/Authorization/ReportVoterTest.php b/src/Bundle/ChillReportBundle/Tests/Security/Authorization/ReportVoterTest.php
index be32edc8d..4179df56d 100644
--- a/src/Bundle/ChillReportBundle/Tests/Security/Authorization/ReportVoterTest.php
+++ b/src/Bundle/ChillReportBundle/Tests/Security/Authorization/ReportVoterTest.php
@@ -167,7 +167,7 @@ final class ReportVoterTest extends KernelTestCase
{
$token = $this->prophet->prophesize();
$token
- ->willImplement('\Symfony\Component\Security\Core\Authentication\Token\TokenInterface');
+ ->willImplement('\\' . \Symfony\Component\Security\Core\Authentication\Token\TokenInterface::class);
if (null === $user) {
$token->getUser()->willReturn(null);
diff --git a/src/Bundle/ChillReportBundle/Tests/Timeline/TimelineProviderTest.php b/src/Bundle/ChillReportBundle/Tests/Timeline/TimelineProviderTest.php
index 9f39fb87e..ecaabb495 100644
--- a/src/Bundle/ChillReportBundle/Tests/Timeline/TimelineProviderTest.php
+++ b/src/Bundle/ChillReportBundle/Tests/Timeline/TimelineProviderTest.php
@@ -191,6 +191,6 @@ final class TimelineProviderTest extends WebTestCase
}
}
- return $groups[mt_rand(0, count($groups) - 1)];
+ return $groups[random_int(0, count($groups) - 1)];
}
}
diff --git a/src/Bundle/ChillTaskBundle/DependencyInjection/Configuration.php b/src/Bundle/ChillTaskBundle/DependencyInjection/Configuration.php
index 8c57ef0f6..f01050684 100644
--- a/src/Bundle/ChillTaskBundle/DependencyInjection/Configuration.php
+++ b/src/Bundle/ChillTaskBundle/DependencyInjection/Configuration.php
@@ -24,7 +24,7 @@ class Configuration implements ConfigurationInterface
public function getConfigTreeBuilder()
{
$treeBuilder = new TreeBuilder('chill_task');
- $rootNode = $treeBuilder->getRootNode('chill_task');
+ $rootNode = $treeBuilder->getRootNode();
// Here you should define the parameters that are allowed to
// configure your bundle. See the documentation linked above for
diff --git a/src/Bundle/ChillTaskBundle/Menu/MenuBuilder.php b/src/Bundle/ChillTaskBundle/Menu/MenuBuilder.php
index 4933b063c..2ecd2f5de 100644
--- a/src/Bundle/ChillTaskBundle/Menu/MenuBuilder.php
+++ b/src/Bundle/ChillTaskBundle/Menu/MenuBuilder.php
@@ -71,7 +71,7 @@ class MenuBuilder implements LocalMenuBuilderInterface
break;
case 'section':
- $menu->setExtras('icons', 'tasks');
+ $menu->setExtras('icons');
break;
diff --git a/src/Bundle/ChillTaskBundle/Timeline/TaskLifeCycleEventTimelineProvider.php b/src/Bundle/ChillTaskBundle/Timeline/TaskLifeCycleEventTimelineProvider.php
index e5414cac1..4d8ddd062 100644
--- a/src/Bundle/ChillTaskBundle/Timeline/TaskLifeCycleEventTimelineProvider.php
+++ b/src/Bundle/ChillTaskBundle/Timeline/TaskLifeCycleEventTimelineProvider.php
@@ -108,7 +108,7 @@ class TaskLifeCycleEventTimelineProvider implements TimelineProviderInterface
{
$workflow = $this->registry->get(
$entity->getTask(),
- (isset($entity->getData()['workflow'])) ? $entity->getData()['workflow'] : null
+ $entity->getData()['workflow'] ?? null
);
// sf4 check: prevent error message:
// `Notice: Undefined property: Chill\TaskBundle\Entity\Task\SingleTaskPlaceEvent::$getData`
diff --git a/src/Bundle/ChillThirdPartyBundle/DependencyInjection/Configuration.php b/src/Bundle/ChillThirdPartyBundle/DependencyInjection/Configuration.php
index 3248f58d7..d4c2cd598 100644
--- a/src/Bundle/ChillThirdPartyBundle/DependencyInjection/Configuration.php
+++ b/src/Bundle/ChillThirdPartyBundle/DependencyInjection/Configuration.php
@@ -24,7 +24,7 @@ class Configuration implements ConfigurationInterface
public function getConfigTreeBuilder()
{
$treeBuilder = new TreeBuilder('chill_third_party');
- $rootNode = $treeBuilder->getRootNode('chill_third_party');
+ $rootNode = $treeBuilder->getRootNode();
// Here you should define the parameters that are allowed to
// configure your bundle. See the documentation linked above for