@@ -76,7 +76,7 @@ |
||
| 76 | 76 | null, |
| 77 | 77 | 'pagerfanta', |
| 78 | 78 | ]) |
| 79 | - ->setNormalizer('actions', function (Options $options, $actions) { |
|
| 79 | + ->setNormalizer('actions', function(Options $options, $actions) { |
|
| 80 | 80 | $normalizedActions = []; |
| 81 | 81 | $addBatchAction = false; |
| 82 | 82 | |
@@ -120,13 +120,13 @@ discard block |
||
| 120 | 120 | if ('array' === $type) { |
| 121 | 121 | $builder |
| 122 | 122 | ->get($field) |
| 123 | - ->addModelTransformer(new CallbackTransformer(function (?array $value = null) { |
|
| 123 | + ->addModelTransformer(new CallbackTransformer(function(?array $value = null) { |
|
| 124 | 124 | if (null === $value) { |
| 125 | 125 | $value = []; |
| 126 | 126 | } |
| 127 | 127 | |
| 128 | 128 | return Yaml::dump($value); |
| 129 | - }, function ($value) { |
|
| 129 | + }, function($value) { |
|
| 130 | 130 | if (null === $value) { |
| 131 | 131 | return []; |
| 132 | 132 | } |
@@ -139,13 +139,13 @@ discard block |
||
| 139 | 139 | if ('simple_array' === $type) { |
| 140 | 140 | $builder |
| 141 | 141 | ->get($field) |
| 142 | - ->addModelTransformer(new CallbackTransformer(function (?array $value = null) { |
|
| 142 | + ->addModelTransformer(new CallbackTransformer(function(?array $value = null) { |
|
| 143 | 143 | if (null === $value) { |
| 144 | 144 | $value = []; |
| 145 | 145 | } |
| 146 | 146 | |
| 147 | 147 | return implode(',', $value); |
| 148 | - }, function ($value) { |
|
| 148 | + }, function($value) { |
|
| 149 | 149 | if (null === $value) { |
| 150 | 150 | return []; |
| 151 | 151 | } |
@@ -23,7 +23,7 @@ |
||
| 23 | 23 | |
| 24 | 24 | $resolver |
| 25 | 25 | ->setDefault('class', '') |
| 26 | - ->setNormalizer('class', function (Options $options, $value) { |
|
| 26 | + ->setNormalizer('class', function(Options $options, $value) { |
|
| 27 | 27 | if ($value) { |
| 28 | 28 | return $value; |
| 29 | 29 | } |
@@ -31,7 +31,7 @@ |
||
| 31 | 31 | 'template' => '@LAGAdmin/Field/actionCollection.html.twig', |
| 32 | 32 | 'actions' => [], |
| 33 | 33 | ]) |
| 34 | - ->setNormalizer('actions', function (Options $options, $value) use ($actionConfiguration) { |
|
| 34 | + ->setNormalizer('actions', function(Options $options, $value) use ($actionConfiguration) { |
|
| 35 | 35 | if (!is_array($value) || 0 === count($value)) { |
| 36 | 36 | $value = [ |
| 37 | 37 | 'edit' => [], |
@@ -226,7 +226,7 @@ |
||
| 226 | 226 | */ |
| 227 | 227 | public function testCreateRedirectionWithException() |
| 228 | 228 | { |
| 229 | - list($factory, , ,) = $this->createFactory(); |
|
| 229 | + list($factory,,,) = $this->createFactory(); |
|
| 230 | 230 | |
| 231 | 231 | $request = $this->createMock(Request::class); |
| 232 | 232 | $adminConfiguration = $this->createMock(AdminConfiguration::class); |
@@ -56,7 +56,7 @@ discard block |
||
| 56 | 56 | '_self', |
| 57 | 57 | '_blank', |
| 58 | 58 | ]) |
| 59 | - ->setNormalizer('route', function (Options $options, $value) use ($actionConfiguration) { |
|
| 59 | + ->setNormalizer('route', function(Options $options, $value) use ($actionConfiguration) { |
|
| 60 | 60 | // route or url should be defined |
| 61 | 61 | if (!$value && !$options->offsetGet('url') && !$options->offsetGet('admin')) { |
| 62 | 62 | throw new InvalidOptionsException('Either an url or a route should be defined'); |
@@ -72,7 +72,7 @@ discard block |
||
| 72 | 72 | |
| 73 | 73 | return $value; |
| 74 | 74 | }) |
| 75 | - ->setNormalizer('admin', function (Options $options, $value) { |
|
| 75 | + ->setNormalizer('admin', function(Options $options, $value) { |
|
| 76 | 76 | // if a Admin is defined, an Action should be defined too |
| 77 | 77 | if ($value && !$options->offsetGet('action')) { |
| 78 | 78 | throw new InvalidOptionsException('An Action should be provided if an Admin is provided'); |
@@ -80,7 +80,7 @@ discard block |
||
| 80 | 80 | |
| 81 | 81 | return $value; |
| 82 | 82 | }) |
| 83 | - ->setNormalizer('parameters', function (Options $options, $values) { |
|
| 83 | + ->setNormalizer('parameters', function(Options $options, $values) { |
|
| 84 | 84 | $cleanedValues = []; |
| 85 | 85 | |
| 86 | 86 | foreach ($values as $name => $method) { |
@@ -92,7 +92,7 @@ discard block |
||
| 92 | 92 | |
| 93 | 93 | return $cleanedValues; |
| 94 | 94 | }) |
| 95 | - ->setNormalizer('text', function (Options $options, $value) use ($actionConfiguration) { |
|
| 95 | + ->setNormalizer('text', function(Options $options, $value) use ($actionConfiguration) { |
|
| 96 | 96 | if ($value) { |
| 97 | 97 | return $value; |
| 98 | 98 | } |
@@ -87,7 +87,7 @@ discard block |
||
| 87 | 87 | ->setAllowedTypes('routing_name_pattern', 'string') |
| 88 | 88 | ->setAllowedTypes('routing_url_pattern', 'string') |
| 89 | 89 | ->setAllowedTypes('page_parameter', 'string') |
| 90 | - ->setNormalizer('routing_name_pattern', function (Options $options, $value) { |
|
| 90 | + ->setNormalizer('routing_name_pattern', function(Options $options, $value) { |
|
| 91 | 91 | if (false === strstr($value, '{admin}')) { |
| 92 | 92 | throw new InvalidOptionsException('Admin routing configuration pattern name should contains the {admin} placeholder'); |
| 93 | 93 | } |
@@ -97,7 +97,7 @@ discard block |
||
| 97 | 97 | |
| 98 | 98 | return $value; |
| 99 | 99 | }) |
| 100 | - ->setNormalizer('routing_url_pattern', function (Options $options, $value) { |
|
| 100 | + ->setNormalizer('routing_url_pattern', function(Options $options, $value) { |
|
| 101 | 101 | if (false === strstr($value, '{admin}')) { |
| 102 | 102 | throw new InvalidOptionsException('Admin routing configuration url pattern should contains {admin} placeholder'); |
| 103 | 103 | } |
@@ -135,7 +135,7 @@ discard block |
||
| 135 | 135 | |
| 136 | 136 | $resolver->setDefault('fields_mapping', $defaultMapping); |
| 137 | 137 | $resolver->setAllowedTypes('fields_mapping', 'array'); |
| 138 | - $resolver->setNormalizer('fields_mapping', function (Options $options, $value) use ($defaultMapping) { |
|
| 138 | + $resolver->setNormalizer('fields_mapping', function(Options $options, $value) use ($defaultMapping) { |
|
| 139 | 139 | // Merge with default mapping to allow override |
| 140 | 140 | $value = array_merge($defaultMapping, $value); |
| 141 | 141 | |
@@ -149,7 +149,7 @@ discard block |
||
| 149 | 149 | |
| 150 | 150 | $resolver->setDefault('fields_template_mapping', $defaultMapping); |
| 151 | 151 | $resolver->setAllowedTypes('fields_template_mapping', 'array'); |
| 152 | - $resolver->setNormalizer('fields_template_mapping', function (Options $options, $value) use ($defaultMapping) { |
|
| 152 | + $resolver->setNormalizer('fields_template_mapping', function(Options $options, $value) use ($defaultMapping) { |
|
| 153 | 153 | // Merge with default mapping to allow override |
| 154 | 154 | $value = array_merge($defaultMapping, $value); |
| 155 | 155 | |
@@ -14,7 +14,7 @@ discard block |
||
| 14 | 14 | { |
| 15 | 15 | $resolver |
| 16 | 16 | ->setDefaults([ |
| 17 | - 'translation' => function (OptionsResolver $subResolver) use ($pattern, $catalog) { |
|
| 17 | + 'translation' => function(OptionsResolver $subResolver) use ($pattern, $catalog) { |
|
| 18 | 18 | $subResolver |
| 19 | 19 | ->setDefaults([ |
| 20 | 20 | 'enabled' => true, |
@@ -25,7 +25,7 @@ discard block |
||
| 25 | 25 | }, |
| 26 | 26 | ]) |
| 27 | 27 | ->setAllowedTypes('translation', 'array') |
| 28 | - ->setNormalizer('translation', function (Options $options, $value) { |
|
| 28 | + ->setNormalizer('translation', function(Options $options, $value) { |
|
| 29 | 29 | if (!array_key_exists('enabled', $value)) { |
| 30 | 30 | throw new InvalidOptionsException('Admin translation enabled parameter should be defined'); |
| 31 | 31 | } |
@@ -137,7 +137,7 @@ discard block |
||
| 137 | 137 | */ |
| 138 | 138 | protected function getFieldsNormalizer() |
| 139 | 139 | { |
| 140 | - return function (Options $options, $fields) { |
|
| 140 | + return function(Options $options, $fields) { |
|
| 141 | 141 | $normalizedFields = []; |
| 142 | 142 | |
| 143 | 143 | foreach ($fields as $name => $field) { |
@@ -159,7 +159,7 @@ discard block |
||
| 159 | 159 | */ |
| 160 | 160 | protected function getOrderNormalizer() |
| 161 | 161 | { |
| 162 | - return function (Options $options, $order) { |
|
| 162 | + return function(Options $options, $order) { |
|
| 163 | 163 | foreach ($order as $field => $sort) { |
| 164 | 164 | if (!is_string($sort) || !is_string($field) || !in_array(strtolower($sort), ['asc', 'desc'])) { |
| 165 | 165 | throw new Exception('Order value should be an array of string (["field" => $key]), got '.gettype($sort)); |
@@ -178,7 +178,7 @@ discard block |
||
| 178 | 178 | */ |
| 179 | 179 | protected function getLoadStrategyNormalizer() |
| 180 | 180 | { |
| 181 | - return function (Options $options, $value) { |
|
| 181 | + return function(Options $options, $value) { |
|
| 182 | 182 | if (!$value) { |
| 183 | 183 | if ('create' == $this->actionName) { |
| 184 | 184 | $value = LAGAdminBundle::LOAD_STRATEGY_NONE; |
@@ -201,7 +201,7 @@ discard block |
||
| 201 | 201 | */ |
| 202 | 202 | protected function getCriteriaNormalizer() |
| 203 | 203 | { |
| 204 | - return function (Options $options, $value) { |
|
| 204 | + return function(Options $options, $value) { |
|
| 205 | 205 | if (!$value) { |
| 206 | 206 | $idActions = [ |
| 207 | 207 | 'edit', |
@@ -239,7 +239,7 @@ discard block |
||
| 239 | 239 | */ |
| 240 | 240 | protected function getFiltersNormalizer(): Closure |
| 241 | 241 | { |
| 242 | - return function (Options $options, $data) { |
|
| 242 | + return function(Options $options, $data) { |
|
| 243 | 243 | $normalizedData = []; |
| 244 | 244 | |
| 245 | 245 | foreach ($data as $name => $field) { |
@@ -265,7 +265,7 @@ discard block |
||
| 265 | 265 | |
| 266 | 266 | protected function getFormNormalizer(): Closure |
| 267 | 267 | { |
| 268 | - return function (Options $options, $value) { |
|
| 268 | + return function(Options $options, $value) { |
|
| 269 | 269 | if (null !== $value) { |
| 270 | 270 | return $value; |
| 271 | 271 | } |
@@ -285,7 +285,7 @@ discard block |
||
| 285 | 285 | |
| 286 | 286 | protected function getTitleNormalizer(): Closure |
| 287 | 287 | { |
| 288 | - return function (Options $options, $value) { |
|
| 288 | + return function(Options $options, $value) { |
|
| 289 | 289 | // If the translation system is not used, return the provided value as is |
| 290 | 290 | if (!$this->adminConfiguration->isTranslationEnabled()) { |
| 291 | 291 | if (null === $value) { |
@@ -358,7 +358,7 @@ discard block |
||
| 358 | 358 | 'menus' => [], |
| 359 | 359 | ]) |
| 360 | 360 | ->setAllowedTypes('add_return', 'boolean') |
| 361 | - ->setNormalizer('menus', function (Options $options, $value) { |
|
| 361 | + ->setNormalizer('menus', function(Options $options, $value) { |
|
| 362 | 362 | if (false === $value) { |
| 363 | 363 | return $value; |
| 364 | 364 | } |
@@ -429,7 +429,7 @@ discard block |
||
| 429 | 429 | ->setAllowedTypes('route_path', 'string') |
| 430 | 430 | ->setAllowedTypes('route_defaults', 'array') |
| 431 | 431 | ->setAllowedTypes('route_requirements', 'array') |
| 432 | - ->setNormalizer('route_defaults', function (Options $options, $value) { |
|
| 432 | + ->setNormalizer('route_defaults', function(Options $options, $value) { |
|
| 433 | 433 | if (!$value || is_array($value)) { |
| 434 | 434 | $value = []; |
| 435 | 435 | } |