mirror of
https://gitlab.com/Chill-Projet/chill-bundles.git
synced 2025-08-20 14:43:49 +00:00
cs: Enable risky rule static_lambda
.
This commit is contained in:
@@ -100,7 +100,7 @@ class ReportList implements ListInterface, ExportElementValidatedInterface
|
||||
'expanded' => true,
|
||||
'choices' => $choices,
|
||||
'label' => 'Fields to include in export',
|
||||
'choice_attr' => function ($val, $key, $index) {
|
||||
'choice_attr' => static function ($val, $key, $index) {
|
||||
// add a 'data-display-target' for address fields
|
||||
if (substr($val, 0, 8) === 'address_') {
|
||||
return ['data-display-target' => 'address_date'];
|
||||
@@ -124,7 +124,7 @@ class ReportList implements ListInterface, ExportElementValidatedInterface
|
||||
}
|
||||
},
|
||||
'constraints' => [new Callback([
|
||||
'callback' => function ($selected, ExecutionContextInterface $context) {
|
||||
'callback' => static function ($selected, ExecutionContextInterface $context) {
|
||||
if (count($selected) === 0) {
|
||||
$context->buildViolation('You must select at least one element')
|
||||
->atPath('fields')
|
||||
@@ -165,7 +165,7 @@ class ReportList implements ListInterface, ExportElementValidatedInterface
|
||||
case 'report_date':
|
||||
// for birthdate or report date, we have to transform the string into a date
|
||||
// to format the date correctly.
|
||||
return function ($value) use ($key) {
|
||||
return static function ($value) use ($key) {
|
||||
if ('_header' === $value) {
|
||||
return 'person_birthdate' === $key ? 'birthdate' : 'report_date';
|
||||
}
|
||||
@@ -202,7 +202,7 @@ class ReportList implements ListInterface, ExportElementValidatedInterface
|
||||
$scopes[$row['id']] = $this->translatableStringHelper->localize($row['name']);
|
||||
}
|
||||
|
||||
return function ($value) use ($scopes): string {
|
||||
return static function ($value) use ($scopes): string {
|
||||
if ('_header' === $value) {
|
||||
return 'circle';
|
||||
}
|
||||
@@ -224,7 +224,7 @@ class ReportList implements ListInterface, ExportElementValidatedInterface
|
||||
$users[$row['id']] = $row['username'];
|
||||
}
|
||||
|
||||
return function ($value) use ($users): string {
|
||||
return static function ($value) use ($users): string {
|
||||
if ('_header' === $value) {
|
||||
return 'user';
|
||||
}
|
||||
@@ -282,7 +282,7 @@ class ReportList implements ListInterface, ExportElementValidatedInterface
|
||||
default:
|
||||
// for fields which are associated with person
|
||||
if (in_array($key, $this->fields)) {
|
||||
return function ($value) use ($key) {
|
||||
return static function ($value) use ($key) {
|
||||
if ('_header' === $value) {
|
||||
return strtolower($key);
|
||||
}
|
||||
@@ -331,7 +331,7 @@ class ReportList implements ListInterface, ExportElementValidatedInterface
|
||||
|
||||
public function initiateQuery(array $requiredModifiers, array $acl, array $data = [])
|
||||
{
|
||||
$centers = array_map(function ($el) { return $el['center']; }, $acl);
|
||||
$centers = array_map(static function ($el) { return $el['center']; }, $acl);
|
||||
|
||||
// throw an error if any fields are present
|
||||
if (!array_key_exists('fields', $data)) {
|
||||
@@ -503,7 +503,7 @@ class ReportList implements ListInterface, ExportElementValidatedInterface
|
||||
private function getCustomFields()
|
||||
{
|
||||
return array_filter($this->customfieldsGroup
|
||||
->getCustomFields()->toArray(), function (CustomField $cf) {
|
||||
->getCustomFields()->toArray(), static function (CustomField $cf) {
|
||||
return $cf->getType() !== 'title';
|
||||
});
|
||||
}
|
||||
|
@@ -94,7 +94,7 @@ class ReportSearch extends AbstractSearch implements ContainerAwareInterface
|
||||
|
||||
foreach ($reachableCenters as $center) {
|
||||
$reachableScopesId = array_map(
|
||||
function (Scope $scope) { return $scope->getId(); },
|
||||
static function (Scope $scope) { return $scope->getId(); },
|
||||
$this->helper->getReachableScopes($this->user, $role, $center)
|
||||
);
|
||||
$whereElement->add(
|
||||
|
@@ -66,7 +66,7 @@ class ReportControllerNextTest extends WebTestCase
|
||||
//filter customFieldsGroup to get only "situation de logement"
|
||||
$filteredCustomFieldsGroupHouse = array_filter(
|
||||
$customFieldsGroups,
|
||||
function (CustomFieldsGroup $group) {
|
||||
static function (CustomFieldsGroup $group) {
|
||||
return in_array('Situation de logement', $group->getName());
|
||||
}
|
||||
);
|
||||
|
@@ -84,7 +84,7 @@ class ReportControllerTest extends WebTestCase
|
||||
//filter customFieldsGroup to get only "situation de logement"
|
||||
$filteredCustomFieldsGroupHouse = array_filter(
|
||||
$customFieldsGroups,
|
||||
function (CustomFieldsGroup $group) {
|
||||
static function (CustomFieldsGroup $group) {
|
||||
return in_array('Situation de logement', $group->getName());
|
||||
}
|
||||
);
|
||||
|
@@ -65,7 +65,7 @@ class TimelineProviderTest extends WebTestCase
|
||||
static::$em
|
||||
->getRepository('ChillMainBundle:Scope')
|
||||
->findAll(),
|
||||
function (Scope $scope) { return $scope->getName()['en'] === 'social'; }
|
||||
static function (Scope $scope) { return $scope->getName()['en'] === 'social'; }
|
||||
);
|
||||
|
||||
$report = (new Report())
|
||||
|
Reference in New Issue
Block a user