mirror of
https://gitlab.com/Chill-Projet/chill-bundles.git
synced 2025-09-02 04:53:49 +00:00
cs: Enable risky rule static_lambda
.
This commit is contained in:
@@ -77,7 +77,7 @@ class CustomFieldDate extends AbstractCustomField
|
||||
|
||||
public function buildOptionsForm(FormBuilderInterface $builder)
|
||||
{
|
||||
$validatorFunction = function ($value, ExecutionContextInterface $context) {
|
||||
$validatorFunction = static function ($value, ExecutionContextInterface $context) {
|
||||
try {
|
||||
$date = new DateTime($value);
|
||||
} catch (Exception $e) {
|
||||
@@ -179,7 +179,7 @@ class CustomFieldDate extends AbstractCustomField
|
||||
// add constraints if required
|
||||
if (null !== $options[self::MIN]) {
|
||||
$fieldOptions['constraints'][] = new Callback(
|
||||
function ($timestamp, ExecutionContextInterface $context) use ($options) {
|
||||
static function ($timestamp, ExecutionContextInterface $context) use ($options) {
|
||||
if (null === $timestamp) {
|
||||
return;
|
||||
}
|
||||
@@ -200,7 +200,7 @@ class CustomFieldDate extends AbstractCustomField
|
||||
|
||||
if (null !== $options[self::MAX]) {
|
||||
$fieldOptions['constraints'][] = new Callback(
|
||||
function ($timestamp, ExecutionContextInterface $context) use ($options) {
|
||||
static function ($timestamp, ExecutionContextInterface $context) use ($options) {
|
||||
if (null === $timestamp) {
|
||||
return;
|
||||
}
|
||||
|
@@ -57,7 +57,7 @@ class CustomFieldLongChoice extends AbstractCustomField
|
||||
$translatableStringHelper = $this->translatableStringHelper;
|
||||
$builder->add($customField->getSlug(), Select2ChoiceType::class, [
|
||||
'choices' => $entries,
|
||||
'choice_label' => function (Option $option) use ($translatableStringHelper) {
|
||||
'choice_label' => static function (Option $option) use ($translatableStringHelper) {
|
||||
return $translatableStringHelper->localize($option->getText());
|
||||
},
|
||||
'choice_value' => static fn (Option $key): ?int => null === $key ? null : $key->getId(),
|
||||
@@ -65,7 +65,7 @@ class CustomFieldLongChoice extends AbstractCustomField
|
||||
'expanded' => false,
|
||||
'required' => $customField->isRequired(),
|
||||
'placeholder' => 'Choose a value',
|
||||
'group_by' => function (Option $option) use ($translatableStringHelper) {
|
||||
'group_by' => static function (Option $option) use ($translatableStringHelper) {
|
||||
if ($option->hasParent()) {
|
||||
return $translatableStringHelper->localize($option->getParent()->getText());
|
||||
}
|
||||
|
Reference in New Issue
Block a user