DX: rector rules upt to PHP 74

This commit is contained in:
2023-04-15 00:20:19 +02:00
parent a68190f0c6
commit 858ade467c
213 changed files with 433 additions and 1052 deletions

View File

@@ -306,7 +306,7 @@ class ReportList implements ExportElementValidatedInterface, ListInterface
}
// add the key from slugs and return
return array_merge($fields, array_keys($this->slugs));
return [...$fields, ...array_keys($this->slugs)];
}
public function getResult($query, $data)
@@ -331,9 +331,7 @@ class ReportList implements ExportElementValidatedInterface, ListInterface
public function initiateQuery(array $requiredModifiers, array $acl, array $data = [])
{
$centers = array_map(static function ($el) {
return $el['center'];
}, $acl);
$centers = array_map(static fn($el) => $el['center'], $acl);
// throw an error if any fields are present
if (!array_key_exists('fields', $data)) {
@@ -505,9 +503,7 @@ class ReportList implements ExportElementValidatedInterface, ListInterface
private function getCustomFields()
{
return array_filter($this->customfieldsGroup
->getCustomFields()->toArray(), static function (CustomField $cf) {
return $cf->getType() !== 'title';
});
->getCustomFields()->toArray(), static fn(CustomField $cf) => $cf->getType() !== 'title');
}
private function getLabelForCustomField($key, array $values, $data)

View File

@@ -97,9 +97,7 @@ class ReportSearch extends AbstractSearch implements ContainerAwareInterface
foreach ($reachableCenters as $center) {
$reachableScopesId = array_map(
static function (Scope $scope) {
return $scope->getId();
},
static fn(Scope $scope) => $scope->getId(),
$this->helper->getReachableScopes($this->user, $role, $center)
);
$whereElement->add(

View File

@@ -68,9 +68,7 @@ final class ReportControllerNextTest extends WebTestCase
//filter customFieldsGroup to get only "situation de logement"
$filteredCustomFieldsGroupHouse = array_filter(
$customFieldsGroups,
static function (CustomFieldsGroup $group) {
return in_array('Situation de logement', $group->getName(), true);
}
static fn(CustomFieldsGroup $group) => in_array('Situation de logement', $group->getName(), true)
);
$this->group = $filteredCustomFieldsGroupHouse[0];
}

View File

@@ -86,9 +86,7 @@ final class ReportControllerTest extends WebTestCase
//filter customFieldsGroup to get only "situation de logement"
$filteredCustomFieldsGroupHouse = array_filter(
$customFieldsGroups,
static function (CustomFieldsGroup $group) {
return in_array('Situation de logement', $group->getName(), true);
}
static fn(CustomFieldsGroup $group) => in_array('Situation de logement', $group->getName(), true)
);
self::$group = $filteredCustomFieldsGroupHouse[0];

View File

@@ -67,9 +67,7 @@ final class TimelineProviderTest extends WebTestCase
self::$em
->getRepository(\Chill\MainBundle\Entity\Scope::class)
->findAll(),
static function (Scope $scope) {
return $scope->getName()['en'] === 'social';
}
static fn(Scope $scope) => $scope->getName()['en'] === 'social'
);
$report = (new Report())

View File

@@ -267,7 +267,7 @@ class TimelineReportProvider implements TimelineProviderInterface
'{scopes_ids}' => implode(', ', array_fill(0, count($scopeIds), '?')),
]);
// append $scopeIds to parameters
$parameters = array_merge($parameters, $scopeIds);
$parameters = [...$parameters, ...$scopeIds];
}
if (0 === count($formattedClauses)) {