@@ -22,7 +22,7 @@ |
||
| 22 | 22 | |
| 23 | 23 | public function getDataTransformer(): ?Closure |
| 24 | 24 | { |
| 25 | - return function ($data) { |
|
| 25 | + return function($data) { |
|
| 26 | 26 | if ($data === null) { |
| 27 | 27 | return ''; |
| 28 | 28 | } |
@@ -222,7 +222,7 @@ discard block |
||
| 222 | 222 | |
| 223 | 223 | private function getActionNormalizer(): Closure |
| 224 | 224 | { |
| 225 | - return function (Options $options, $actions) { |
|
| 225 | + return function(Options $options, $actions) { |
|
| 226 | 226 | $normalizedActions = []; |
| 227 | 227 | // $addBatchAction = false; |
| 228 | 228 | |
@@ -257,7 +257,7 @@ discard block |
||
| 257 | 257 | |
| 258 | 258 | private function getRoutesPatternNormalizer(): Closure |
| 259 | 259 | { |
| 260 | - return function (Options $options, $value) { |
|
| 260 | + return function(Options $options, $value) { |
|
| 261 | 261 | if (!u($value)->containsAny('{action}')) { |
| 262 | 262 | throw new InvalidOptionsException(sprintf('The "%s" parameters in admin "%s" should contains the "%s" parameters', 'routes_pattern', $options->offsetGet('name'), '{action}')); |
| 263 | 263 | } |
@@ -110,7 +110,7 @@ discard block |
||
| 110 | 110 | ->setAllowedTypes('redirect', ['string', 'null']) |
| 111 | 111 | ->setDefault('add_return_link', null) |
| 112 | 112 | ->setAllowedTypes('add_return_link', ['boolean', 'null']) |
| 113 | - ->addNormalizer('add_return_link', function (Options $options, $value) { |
|
| 113 | + ->addNormalizer('add_return_link', function(Options $options, $value) { |
|
| 114 | 114 | return $value ?? $options->offsetGet('name') !== 'list'; |
| 115 | 115 | }) |
| 116 | 116 | ; |
@@ -272,7 +272,7 @@ discard block |
||
| 272 | 272 | |
| 273 | 273 | private function getTitleNormalizer(): Closure |
| 274 | 274 | { |
| 275 | - return function (Options $options, $value) { |
|
| 275 | + return function(Options $options, $value) { |
|
| 276 | 276 | if ($value === null) { |
| 277 | 277 | $value = u($options->offsetGet('name'))->camel()->title()->toString(); |
| 278 | 278 | } |
@@ -283,7 +283,7 @@ discard block |
||
| 283 | 283 | |
| 284 | 284 | private function getPathNormalizer(): Closure |
| 285 | 285 | { |
| 286 | - return function (Options $options, $value) { |
|
| 286 | + return function(Options $options, $value) { |
|
| 287 | 287 | if ($value !== null) { |
| 288 | 288 | $path = u($value); |
| 289 | 289 | |
@@ -341,7 +341,7 @@ discard block |
||
| 341 | 341 | */ |
| 342 | 342 | private function getFieldsNormalizer(): Closure |
| 343 | 343 | { |
| 344 | - return function (Options $options, $fields) { |
|
| 344 | + return function(Options $options, $fields) { |
|
| 345 | 345 | $normalizedFields = []; |
| 346 | 346 | |
| 347 | 347 | foreach ($fields as $name => $field) { |
@@ -361,7 +361,7 @@ discard block |
||
| 361 | 361 | */ |
| 362 | 362 | private function getOrderNormalizer(): Closure |
| 363 | 363 | { |
| 364 | - return function (Options $options, $order) { |
|
| 364 | + return function(Options $options, $order) { |
|
| 365 | 365 | foreach ($order as $field => $sort) { |
| 366 | 366 | if (!\is_string($sort) || !\is_string($field) || !\in_array(strtolower($sort), ['asc', 'desc'])) { |
| 367 | 367 | throw new Exception('Order value should be an array of string (["field" => $key]), got '.\gettype($sort)); |
@@ -374,7 +374,7 @@ discard block |
||
| 374 | 374 | |
| 375 | 375 | private function getLoadStrategyNormalizer(): Closure |
| 376 | 376 | { |
| 377 | - return function (Options $options, $value) { |
|
| 377 | + return function(Options $options, $value) { |
|
| 378 | 378 | if ($value !== null) { |
| 379 | 379 | return $value; |
| 380 | 380 | } |
@@ -397,7 +397,7 @@ discard block |
||
| 397 | 397 | */ |
| 398 | 398 | private function getCriteriaNormalizer(): Closure |
| 399 | 399 | { |
| 400 | - return function (Options $options, $value) { |
|
| 400 | + return function(Options $options, $value) { |
|
| 401 | 401 | if (!$value) { |
| 402 | 402 | $idActions = [ |
| 403 | 403 | 'edit', |
@@ -420,7 +420,7 @@ discard block |
||
| 420 | 420 | */ |
| 421 | 421 | private function getFiltersNormalizer(): Closure |
| 422 | 422 | { |
| 423 | - return function (Options $options, $data) { |
|
| 423 | + return function(Options $options, $data) { |
|
| 424 | 424 | $normalizedData = []; |
| 425 | 425 | |
| 426 | 426 | foreach ($data as $name => $field) { |
@@ -446,7 +446,7 @@ discard block |
||
| 446 | 446 | |
| 447 | 447 | private function getFormNormalizer(): Closure |
| 448 | 448 | { |
| 449 | - return function (Options $options, $value) { |
|
| 449 | + return function(Options $options, $value) { |
|
| 450 | 450 | if ($value !== null && $value !== false) { |
| 451 | 451 | return $value; |
| 452 | 452 | } |
@@ -470,7 +470,7 @@ discard block |
||
| 470 | 470 | |
| 471 | 471 | private function getRouteParametersNormalizer(): Closure |
| 472 | 472 | { |
| 473 | - return function (Options $options, $value) { |
|
| 473 | + return function(Options $options, $value) { |
|
| 474 | 474 | if (\count($value) > 0) { |
| 475 | 475 | return $value; |
| 476 | 476 | } |
@@ -49,7 +49,7 @@ discard block |
||
| 49 | 49 | ->setAllowedTypes('translation', ['boolean']) |
| 50 | 50 | ->setAllowedTypes('translation_domain', ['string', 'null']) |
| 51 | 51 | ->setAllowedTypes('sortable', ['boolean']) |
| 52 | - ->addNormalizer('attr', function (Options $options, $value) { |
|
| 52 | + ->addNormalizer('attr', function(Options $options, $value) { |
|
| 53 | 53 | if ($value === null) { |
| 54 | 54 | $value = []; |
| 55 | 55 | } |
@@ -62,7 +62,7 @@ discard block |
||
| 62 | 62 | |
| 63 | 63 | return $value; |
| 64 | 64 | }) |
| 65 | - ->addNormalizer('header_attr', function (Options $options, $value) { |
|
| 65 | + ->addNormalizer('header_attr', function(Options $options, $value) { |
|
| 66 | 66 | if ($value === null) { |
| 67 | 67 | $value = []; |
| 68 | 68 | } |
@@ -75,14 +75,14 @@ discard block |
||
| 75 | 75 | |
| 76 | 76 | return $value; |
| 77 | 77 | }) |
| 78 | - ->setNormalizer('mapped', function (Options $options, $mapped) { |
|
| 78 | + ->setNormalizer('mapped', function(Options $options, $mapped) { |
|
| 79 | 79 | if (u($this->getName())->startsWith('_')) { |
| 80 | 80 | return true; |
| 81 | 81 | } |
| 82 | 82 | |
| 83 | 83 | return $mapped; |
| 84 | 84 | }) |
| 85 | - ->setNormalizer('property_path', function (Options $options, $propertyPath) { |
|
| 85 | + ->setNormalizer('property_path', function(Options $options, $propertyPath) { |
|
| 86 | 86 | if (u($this->getName())->startsWith('_')) { |
| 87 | 87 | return null; |
| 88 | 88 | } |
@@ -22,7 +22,7 @@ |
||
| 22 | 22 | 'template' => '@LAGAdmin/fields/action.html.twig', |
| 23 | 23 | 'translation' => true, |
| 24 | 24 | ]) |
| 25 | - ->addNormalizer('attr', function (Options $options, $value) { |
|
| 25 | + ->addNormalizer('attr', function(Options $options, $value) { |
|
| 26 | 26 | if (!empty($value['class'])) { |
| 27 | 27 | return $value; |
| 28 | 28 | } |
@@ -32,7 +32,7 @@ discard block |
||
| 32 | 32 | |
| 33 | 33 | foreach ($order as $field => $orderValue) { |
| 34 | 34 | if ($metadata->hasField($field)) { |
| 35 | - $this->addFieldOrder($queryBuilder ,$field, $orderValue); |
|
| 35 | + $this->addFieldOrder($queryBuilder, $field, $orderValue); |
|
| 36 | 36 | } |
| 37 | 37 | |
| 38 | 38 | if ($metadata->hasAssociation($field)) { |
@@ -47,7 +47,7 @@ discard block |
||
| 47 | 47 | $queryBuilder->addOrderBy($alias.'.'.$field, $orderValue); |
| 48 | 48 | } |
| 49 | 49 | |
| 50 | - private function addAssociationOrder(QueryBuilder $queryBuilder, ClassMetadata $metadata,string $field, string $orderValue): void |
|
| 50 | + private function addAssociationOrder(QueryBuilder $queryBuilder, ClassMetadata $metadata, string $field, string $orderValue): void |
|
| 51 | 51 | { |
| 52 | 52 | $joins = $queryBuilder->getDQLPart('join'); |
| 53 | 53 | $alias = $queryBuilder->getRootAliases()[0]; |
@@ -396,12 +396,12 @@ |
||
| 396 | 396 | public function filterFormDataProviderNormalizer(): array |
| 397 | 397 | { |
| 398 | 398 | return [ |
| 399 | - [null, 'my_action', null], |
|
| 400 | - [false, 'my_action', null], |
|
| 401 | - [null, 'create', AdminType::class], |
|
| 402 | - ['MyForm', 'create', 'MyForm'], |
|
| 403 | - [null, 'edit', AdminType::class], |
|
| 404 | - [null, 'delete', DeleteType::class], |
|
| 399 | + [null, 'my_action', null], |
|
| 400 | + [false, 'my_action', null], |
|
| 401 | + [null, 'create', AdminType::class], |
|
| 402 | + ['MyForm', 'create', 'MyForm'], |
|
| 403 | + [null, 'edit', AdminType::class], |
|
| 404 | + [null, 'delete', DeleteType::class], |
|
| 405 | 405 | ]; |
| 406 | 406 | } |
| 407 | 407 | |
@@ -39,7 +39,7 @@ discard block |
||
| 39 | 39 | $field |
| 40 | 40 | ->expects($this->once()) |
| 41 | 41 | ->method('getDataTransformer') |
| 42 | - ->willReturn(function ($value) { |
|
| 42 | + ->willReturn(function($value) { |
|
| 43 | 43 | return u($value)->title()->toString(); |
| 44 | 44 | }) |
| 45 | 45 | ; |
@@ -62,7 +62,7 @@ discard block |
||
| 62 | 62 | ->environment |
| 63 | 63 | ->expects($this->once()) |
| 64 | 64 | ->method('render') |
| 65 | - ->willReturnCallback(function ($template, $context) use($data) { |
|
| 65 | + ->willReturnCallback(function($template, $context) use($data) { |
|
| 66 | 66 | $this->assertEquals('@LAGAdmin/fields/string.html.twig', $template); |
| 67 | 67 | $this->assertEquals([ |
| 68 | 68 | 'data' => 'My_value', |
@@ -93,7 +93,7 @@ discard block |
||
| 93 | 93 | $field |
| 94 | 94 | ->expects($this->once()) |
| 95 | 95 | ->method('getDataTransformer') |
| 96 | - ->willReturn(function ($value) { |
|
| 96 | + ->willReturn(function($value) { |
|
| 97 | 97 | return u($value)->title()->toString(); |
| 98 | 98 | }) |
| 99 | 99 | ; |
@@ -113,7 +113,7 @@ discard block |
||
| 113 | 113 | ->environment |
| 114 | 114 | ->expects($this->once()) |
| 115 | 115 | ->method('render') |
| 116 | - ->willReturnCallback(function () { |
|
| 116 | + ->willReturnCallback(function() { |
|
| 117 | 117 | throw new Exception(); |
| 118 | 118 | }) |
| 119 | 119 | ; |
@@ -19,7 +19,7 @@ |
||
| 19 | 19 | $metadataFactory |
| 20 | 20 | ->expects($this->once()) |
| 21 | 21 | ->method('getMetadataFor') |
| 22 | - ->willReturnCallback(function (string $class) { |
|
| 22 | + ->willReturnCallback(function(string $class) { |
|
| 23 | 23 | $this->assertEquals('MyLittleClass', $class); |
| 24 | 24 | |
| 25 | 25 | throw new Exception(); |