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:
@@ -56,7 +56,7 @@ class Configuration implements ConfigurationInterface
|
||||
->info('The number of seconds of this duration. Must be an integer.')
|
||||
->cannotBeEmpty()
|
||||
->validate()
|
||||
->ifTrue(function ($data) {
|
||||
->ifTrue(static function ($data) {
|
||||
return !is_int($data);
|
||||
})->thenInvalid('The value %s is not a valid integer')
|
||||
->end()
|
||||
|
@@ -75,7 +75,7 @@ class ListActivity implements ListInterface
|
||||
'choices' => array_combine($this->fields, $this->fields),
|
||||
'label' => 'Fields to include in export',
|
||||
'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')
|
||||
@@ -189,7 +189,7 @@ class ListActivity implements ListInterface
|
||||
|
||||
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)) {
|
||||
|
@@ -125,7 +125,7 @@ class ActivityType extends AbstractType
|
||||
$builder->add('socialIssues', HiddenType::class);
|
||||
$builder->get('socialIssues')
|
||||
->addModelTransformer(new CallbackTransformer(
|
||||
function (iterable $socialIssuesAsIterable): string {
|
||||
static function (iterable $socialIssuesAsIterable): string {
|
||||
$socialIssueIds = [];
|
||||
|
||||
foreach ($socialIssuesAsIterable as $value) {
|
||||
@@ -151,7 +151,7 @@ class ActivityType extends AbstractType
|
||||
$builder->add('socialActions', HiddenType::class);
|
||||
$builder->get('socialActions')
|
||||
->addModelTransformer(new CallbackTransformer(
|
||||
function (iterable $socialActionsAsIterable): string {
|
||||
static function (iterable $socialActionsAsIterable): string {
|
||||
$socialActionIds = [];
|
||||
|
||||
foreach ($socialActionsAsIterable as $value) {
|
||||
@@ -203,7 +203,7 @@ class ActivityType extends AbstractType
|
||||
'choice_label' => function (ActivityPresence $activityPresence) {
|
||||
return $this->translatableStringHelper->localize($activityPresence->getName());
|
||||
},
|
||||
'query_builder' => function (EntityRepository $er) {
|
||||
'query_builder' => static function (EntityRepository $er) {
|
||||
return $er->createQueryBuilder('a')
|
||||
->where('a.active = true');
|
||||
},
|
||||
@@ -229,7 +229,7 @@ class ActivityType extends AbstractType
|
||||
return $this->translatableStringHelper->localize($activityReason->getName());
|
||||
},
|
||||
'attr' => ['class' => 'select2 '],
|
||||
'query_builder' => function (EntityRepository $er) {
|
||||
'query_builder' => static function (EntityRepository $er) {
|
||||
return $er->createQueryBuilder('a')
|
||||
->where('a.active = true');
|
||||
},
|
||||
@@ -248,7 +248,7 @@ class ActivityType extends AbstractType
|
||||
$builder->add('persons', HiddenType::class);
|
||||
$builder->get('persons')
|
||||
->addModelTransformer(new CallbackTransformer(
|
||||
function (iterable $personsAsIterable): string {
|
||||
static function (iterable $personsAsIterable): string {
|
||||
$personIds = [];
|
||||
|
||||
foreach ($personsAsIterable as $value) {
|
||||
@@ -270,7 +270,7 @@ class ActivityType extends AbstractType
|
||||
$builder->add('thirdParties', HiddenType::class);
|
||||
$builder->get('thirdParties')
|
||||
->addModelTransformer(new CallbackTransformer(
|
||||
function (iterable $thirdpartyAsIterable): string {
|
||||
static function (iterable $thirdpartyAsIterable): string {
|
||||
$thirdpartyIds = [];
|
||||
|
||||
foreach ($thirdpartyAsIterable as $value) {
|
||||
@@ -303,7 +303,7 @@ class ActivityType extends AbstractType
|
||||
$builder->add('users', HiddenType::class);
|
||||
$builder->get('users')
|
||||
->addModelTransformer(new CallbackTransformer(
|
||||
function (iterable $usersAsIterable): string {
|
||||
static function (iterable $usersAsIterable): string {
|
||||
$userIds = [];
|
||||
|
||||
foreach ($usersAsIterable as $value) {
|
||||
@@ -325,7 +325,7 @@ class ActivityType extends AbstractType
|
||||
$builder->add('location', HiddenType::class)
|
||||
->get('location')
|
||||
->addModelTransformer(new CallbackTransformer(
|
||||
function (?Location $location): string {
|
||||
static function (?Location $location): string {
|
||||
if (null === $location) {
|
||||
return '';
|
||||
}
|
||||
@@ -365,7 +365,7 @@ class ActivityType extends AbstractType
|
||||
->addModelTransformer($durationTimeTransformer);
|
||||
|
||||
$builder->get($fieldName)
|
||||
->addEventListener(FormEvents::PRE_SET_DATA, function (FormEvent $formEvent) use (
|
||||
->addEventListener(FormEvents::PRE_SET_DATA, static function (FormEvent $formEvent) use (
|
||||
$timeChoices,
|
||||
$builder,
|
||||
$durationTimeTransformer,
|
||||
|
@@ -55,7 +55,7 @@ class TranslatableActivityReason extends AbstractType
|
||||
|
||||
return null;
|
||||
},
|
||||
'query_builder' => function (EntityRepository $er) {
|
||||
'query_builder' => static function (EntityRepository $er) {
|
||||
return $er->createQueryBuilder('r')
|
||||
->where('r.active = true');
|
||||
},
|
||||
|
@@ -37,7 +37,7 @@ class TranslatableActivityReasonCategory extends AbstractType
|
||||
[
|
||||
'class' => 'ChillActivityBundle:ActivityReasonCategory',
|
||||
'choice_label' => 'name[' . $locale . ']',
|
||||
'query_builder' => function (EntityRepository $er) {
|
||||
'query_builder' => static function (EntityRepository $er) {
|
||||
return $er->createQueryBuilder('c')
|
||||
->where('c.active = true');
|
||||
},
|
||||
|
@@ -167,7 +167,7 @@ final class ActivityACLAwareRepository implements ActivityACLAwareRepositoryInte
|
||||
$reachableScopes = $this->authorizationHelper->getReachableScopes($this->tokenStorage->getToken()->getUser(), $role, $center);
|
||||
// we get the ids for those scopes
|
||||
$reachablesScopesId = array_map(
|
||||
function (Scope $scope) { return $scope->getId(); },
|
||||
static function (Scope $scope) { return $scope->getId(); },
|
||||
$reachableScopes
|
||||
);
|
||||
|
||||
|
@@ -366,8 +366,8 @@ class ActivityControllerTest extends WebTestCase
|
||||
$center
|
||||
);
|
||||
$reachableScopesId = array_intersect(
|
||||
array_map(function ($s) { return $s->getId(); }, $reachableScopesDelete),
|
||||
array_map(function ($s) { return $s->getId(); }, $reachableScopesUpdate)
|
||||
array_map(static function ($s) { return $s->getId(); }, $reachableScopesDelete),
|
||||
array_map(static function ($s) { return $s->getId(); }, $reachableScopesUpdate)
|
||||
);
|
||||
|
||||
if (count($reachableScopesId) === 0) {
|
||||
|
@@ -186,7 +186,7 @@ class ActivityTypeTest extends KernelTestCase
|
||||
|
||||
// map all the values in an array
|
||||
$values = array_map(
|
||||
function ($choice) { return $choice->value; },
|
||||
static function ($choice) { return $choice->value; },
|
||||
$view['activity']['durationTime']->vars['choices']
|
||||
);
|
||||
|
||||
|
@@ -81,7 +81,7 @@ class TranslatableActivityReasonTest extends TypeTestCase
|
||||
$request->getLocale()->willReturn($fallbackLocale);
|
||||
|
||||
$requestStack->willExtend('Symfony\Component\HttpFoundation\RequestStack');
|
||||
$requestStack->getCurrentRequest()->will(function () use ($request) {
|
||||
$requestStack->getCurrentRequest()->will(static function () use ($request) {
|
||||
return $request;
|
||||
});
|
||||
|
||||
|
Reference in New Issue
Block a user