DX: apply rector rulesset up to PHP72

This commit is contained in:
2023-03-29 22:32:52 +02:00
parent 64b8ae3df1
commit b9a7530f7a
110 changed files with 194 additions and 229 deletions

View File

@@ -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);
}

View File

@@ -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);

View File

@@ -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);