@@ -39,7 +39,7 @@ discard block |
||
| 39 | 39 | 'template' => '@LAGAdmin/Field/actionCollection.html.twig', |
| 40 | 40 | 'actions' => [], |
| 41 | 41 | ]) |
| 42 | - ->setNormalizer('actions', function (Options $options, $value) use ($actionConfiguration, $defaultActions) { |
|
| 42 | + ->setNormalizer('actions', function(Options $options, $value) use ($actionConfiguration, $defaultActions) { |
|
| 43 | 43 | if (!is_array($value) || 0 === count($value)) { |
| 44 | 44 | $value = [ |
| 45 | 45 | 'edit' => [], |
@@ -138,7 +138,7 @@ discard block |
||
| 138 | 138 | '_self', |
| 139 | 139 | '_blank', |
| 140 | 140 | ]) |
| 141 | - ->setNormalizer('route', function (Options $options, $value) use ($actionConfiguration) { |
|
| 141 | + ->setNormalizer('route', function(Options $options, $value) use ($actionConfiguration) { |
|
| 142 | 142 | // route or url should be defined |
| 143 | 143 | if (!$value && !$options->offsetGet('url') && !$options->offsetGet('admin')) { |
| 144 | 144 | throw new InvalidOptionsException( |
@@ -156,7 +156,7 @@ discard block |
||
| 156 | 156 | |
| 157 | 157 | return $value; |
| 158 | 158 | }) |
| 159 | - ->setNormalizer('admin', function (Options $options, $value) { |
|
| 159 | + ->setNormalizer('admin', function(Options $options, $value) { |
|
| 160 | 160 | // if a Admin is defined, an Action should be defined too |
| 161 | 161 | if ($value && !$options->offsetGet('action')) { |
| 162 | 162 | throw new InvalidOptionsException( |
@@ -166,7 +166,7 @@ discard block |
||
| 166 | 166 | |
| 167 | 167 | return $value; |
| 168 | 168 | }) |
| 169 | - ->setNormalizer('parameters', function (Options $options, $values) { |
|
| 169 | + ->setNormalizer('parameters', function(Options $options, $values) { |
|
| 170 | 170 | $cleanedValues = []; |
| 171 | 171 | |
| 172 | 172 | foreach ($values as $name => $method) { |
@@ -32,7 +32,7 @@ |
||
| 32 | 32 | public function __construct( |
| 33 | 33 | RequestStack $requestStack, |
| 34 | 34 | ApplicationConfigurationStorage $applicationConfigurationStorage |
| 35 | - ){ |
|
| 35 | + ) { |
|
| 36 | 36 | $this->requestStack = $requestStack; |
| 37 | 37 | $this->applicationConfiguration = $applicationConfigurationStorage->getConfiguration(); |
| 38 | 38 | } |
@@ -138,6 +138,10 @@ discard block |
||
| 138 | 138 | ]; |
| 139 | 139 | } |
| 140 | 140 | |
| 141 | + /** |
|
| 142 | + * @param string $entityClass |
|
| 143 | + * @param string $adminName |
|
| 144 | + */ |
|
| 141 | 145 | private function addDefaultFields(array &$configuration, $entityClass, $adminName) |
| 142 | 146 | { |
| 143 | 147 | $fieldsMapping = [ |
@@ -343,7 +347,7 @@ discard block |
||
| 343 | 347 | /** |
| 344 | 348 | * Return the default action field if found. |
| 345 | 349 | * |
| 346 | - * @param array $fields |
|
| 350 | + * @param string[] $fields |
|
| 347 | 351 | * |
| 348 | 352 | * @return string|null |
| 349 | 353 | */ |
@@ -420,6 +424,9 @@ discard block |
||
| 420 | 424 | return $metadata; |
| 421 | 425 | } |
| 422 | 426 | |
| 427 | + /** |
|
| 428 | + * @param string $type |
|
| 429 | + */ |
|
| 423 | 430 | private function getOperatorFromFieldType($type) |
| 424 | 431 | { |
| 425 | 432 | $mapping = [ |
@@ -172,7 +172,7 @@ |
||
| 172 | 172 | /** |
| 173 | 173 | * @param array $configuration |
| 174 | 174 | * @param ActionConfiguration $actionConfiguration |
| 175 | - * @return array |
|
| 175 | + * @return string |
|
| 176 | 176 | * @throws Exception |
| 177 | 177 | */ |
| 178 | 178 | private function resolveTopLevelConfiguration(array $configuration, ActionConfiguration $actionConfiguration) |
@@ -89,7 +89,7 @@ discard block |
||
| 89 | 89 | $eventDispatcher |
| 90 | 90 | ->expects($this->once()) |
| 91 | 91 | ->method('dispatch') |
| 92 | - ->willReturnCallback(function ($eventName, $event) use ($queryBuilder, $admin) { |
|
| 92 | + ->willReturnCallback(function($eventName, $event) use ($queryBuilder, $admin) { |
|
| 93 | 93 | $this->assertEquals(AdminEvents::DOCTRINE_ORM_FILTER, $eventName); |
| 94 | 94 | /** @var DoctrineOrmFilterEvent $event */ |
| 95 | 95 | $this->assertInstanceOf(DoctrineOrmFilterEvent::class, $event); |
@@ -217,7 +217,7 @@ discard block |
||
| 217 | 217 | $requestStack |
| 218 | 218 | ); |
| 219 | 219 | |
| 220 | - $this->assertExceptionRaised(Exception::class, function () use ($provider, $admin) { |
|
| 220 | + $this->assertExceptionRaised(Exception::class, function() use ($provider, $admin) { |
|
| 221 | 221 | $provider->get($admin, 42); |
| 222 | 222 | }); |
| 223 | 223 | } |
@@ -230,7 +230,7 @@ discard block |
||
| 230 | 230 | /** @var RequestStack|MockObject $requestStack */ |
| 231 | 231 | $requestStack = $this->createMock(RequestStack::class); |
| 232 | 232 | |
| 233 | - $entity =new EntityFixture(42); |
|
| 233 | + $entity = new EntityFixture(42); |
|
| 234 | 234 | |
| 235 | 235 | /** @var EntityManagerInterface|MockObject $entityManager */ |
| 236 | 236 | $entityManager = $this->createMock(EntityManagerInterface::class); |
@@ -96,7 +96,7 @@ discard block |
||
| 96 | 96 | $admin = $this->createMock(AdminInterface::class); |
| 97 | 97 | $event = new AdminEvent($admin, $request); |
| 98 | 98 | |
| 99 | - $this->assertExceptionRaised(Exception::class, function () use ($subscriber, $event) { |
|
| 99 | + $this->assertExceptionRaised(Exception::class, function() use ($subscriber, $event) { |
|
| 100 | 100 | $subscriber->handleRequest($event); |
| 101 | 101 | }); |
| 102 | 102 | } |
@@ -106,7 +106,7 @@ discard block |
||
| 106 | 106 | */ |
| 107 | 107 | public function testCreateView() |
| 108 | 108 | { |
| 109 | - list($subscriber, , $viewFactory) = $this->createAdminSubscriberMock(); |
|
| 109 | + list($subscriber,, $viewFactory) = $this->createAdminSubscriberMock(); |
|
| 110 | 110 | $view = $this->createMock(ViewInterface::class); |
| 111 | 111 | |
| 112 | 112 | $actionConfiguration = $this->createMock(ActionConfiguration::class); |
@@ -244,7 +244,7 @@ discard block |
||
| 244 | 244 | */ |
| 245 | 245 | public function testLoadEntitiesWithMultipleStrategy() |
| 246 | 246 | { |
| 247 | - list($subscriber, , , $dataProviderFactory, , , ,) = $this->createAdminSubscriberMock(); |
|
| 247 | + list($subscriber,,, $dataProviderFactory,,,,) = $this->createAdminSubscriberMock(); |
|
| 248 | 248 | |
| 249 | 249 | $actionConfiguration = $this->createMock(ActionConfiguration::class); |
| 250 | 250 | $actionConfiguration |
@@ -314,7 +314,7 @@ discard block |
||
| 314 | 314 | */ |
| 315 | 315 | public function testLoadEntitiesWithUniqueStrategy() |
| 316 | 316 | { |
| 317 | - list($subscriber, , , $dataProviderFactory) = $this->createAdminSubscriberMock(); |
|
| 317 | + list($subscriber,,, $dataProviderFactory) = $this->createAdminSubscriberMock(); |
|
| 318 | 318 | |
| 319 | 319 | $actionConfiguration = $this->createMock(ActionConfiguration::class); |
| 320 | 320 | $actionConfiguration |
@@ -387,7 +387,7 @@ discard block |
||
| 387 | 387 | */ |
| 388 | 388 | public function testLoadEntitiesWithoutIdentifier() |
| 389 | 389 | { |
| 390 | - list($subscriber, , , $dataProviderFactory) = $this->createAdminSubscriberMock(); |
|
| 390 | + list($subscriber,,, $dataProviderFactory) = $this->createAdminSubscriberMock(); |
|
| 391 | 391 | |
| 392 | 392 | $actionConfiguration = $this->createMock(ActionConfiguration::class); |
| 393 | 393 | $actionConfiguration |
@@ -444,7 +444,7 @@ discard block |
||
| 444 | 444 | $request = new Request(); |
| 445 | 445 | $event = new EntityEvent($admin, $request); |
| 446 | 446 | |
| 447 | - $this->assertExceptionRaised(Exception::class, function () use ($subscriber, $event) { |
|
| 447 | + $this->assertExceptionRaised(Exception::class, function() use ($subscriber, $event) { |
|
| 448 | 448 | $subscriber->loadEntities($event); |
| 449 | 449 | }); |
| 450 | 450 | } |
@@ -454,7 +454,7 @@ discard block |
||
| 454 | 454 | */ |
| 455 | 455 | public function testSaveEntity() |
| 456 | 456 | { |
| 457 | - list($subscriber, , , $dataProviderFactory, , $session, $translator) = $this->createAdminSubscriberMock(); |
|
| 457 | + list($subscriber,,, $dataProviderFactory,, $session, $translator) = $this->createAdminSubscriberMock(); |
|
| 458 | 458 | |
| 459 | 459 | $adminConfiguration = $this->createMock(AdminConfiguration::class); |
| 460 | 460 | $adminConfiguration |
@@ -63,7 +63,7 @@ |
||
| 63 | 63 | * using the logger using info channel |
| 64 | 64 | * |
| 65 | 65 | * @param $flashMessage |
| 66 | - * @param null $logMessage |
|
| 66 | + * @param string $logMessage |
|
| 67 | 67 | */ |
| 68 | 68 | public function handleSuccess($flashMessage, $logMessage = null) |
| 69 | 69 | { |
@@ -161,7 +161,7 @@ discard block |
||
| 161 | 161 | } |
| 162 | 162 | |
| 163 | 163 | /** |
| 164 | - * @return KernelInterface | PHPUnit_Framework_MockObject_MockObject |
|
| 164 | + * @return \PHPUnit\Framework\MockObject\MockObject | PHPUnit_Framework_MockObject_MockObject |
|
| 165 | 165 | */ |
| 166 | 166 | protected function mockKernel() |
| 167 | 167 | { |
@@ -172,8 +172,8 @@ discard block |
||
| 172 | 172 | } |
| 173 | 173 | |
| 174 | 174 | /** |
| 175 | - * @param $name |
|
| 176 | - * @return ActionInterface | PHPUnit_Framework_MockObject_MockObject |
|
| 175 | + * @param string $name |
|
| 176 | + * @return \PHPUnit\Framework\MockObject\MockObject | PHPUnit_Framework_MockObject_MockObject |
|
| 177 | 177 | */ |
| 178 | 178 | protected function mockAction($name) |
| 179 | 179 | { |
@@ -189,7 +189,7 @@ discard block |
||
| 189 | 189 | } |
| 190 | 190 | |
| 191 | 191 | /** |
| 192 | - * @return ActionConfiguration | PHPUnit_Framework_MockObject_MockObject |
|
| 192 | + * @return \PHPUnit\Framework\MockObject\MockObject | PHPUnit_Framework_MockObject_MockObject |
|
| 193 | 193 | */ |
| 194 | 194 | protected function mockActionConfiguration() |
| 195 | 195 | { |
@@ -246,7 +246,7 @@ discard block |
||
| 246 | 246 | /** |
| 247 | 247 | * Return a mock of an entity repository |
| 248 | 248 | * |
| 249 | - * @return RepositoryInterface | PHPUnit_Framework_MockObject_MockObject |
|
| 249 | + * @return \PHPUnit\Framework\MockObject\MockObject | PHPUnit_Framework_MockObject_MockObject |
|
| 250 | 250 | */ |
| 251 | 251 | protected function mockEntityRepository() |
| 252 | 252 | { |
@@ -256,7 +256,7 @@ discard block |
||
| 256 | 256 | } |
| 257 | 257 | |
| 258 | 258 | /** |
| 259 | - * @return EntityManager | PHPUnit_Framework_MockObject_MockObject |
|
| 259 | + * @return \PHPUnit\Framework\MockObject\MockObject | PHPUnit_Framework_MockObject_MockObject |
|
| 260 | 260 | */ |
| 261 | 261 | protected function mockEntityManager() |
| 262 | 262 | { |
@@ -278,7 +278,7 @@ discard block |
||
| 278 | 278 | } |
| 279 | 279 | |
| 280 | 280 | /** |
| 281 | - * @return Registry | PHPUnit_Framework_MockObject_MockObject |
|
| 281 | + * @return \PHPUnit\Framework\MockObject\MockObject | PHPUnit_Framework_MockObject_MockObject |
|
| 282 | 282 | * |
| 283 | 283 | * @deprecated |
| 284 | 284 | */ |
@@ -296,7 +296,7 @@ discard block |
||
| 296 | 296 | } |
| 297 | 297 | |
| 298 | 298 | /** |
| 299 | - * @return ActionFactory | PHPUnit_Framework_MockObject_MockObject |
|
| 299 | + * @return \PHPUnit\Framework\MockObject\MockObject | PHPUnit_Framework_MockObject_MockObject |
|
| 300 | 300 | */ |
| 301 | 301 | protected function mockActionFactory() |
| 302 | 302 | { |
@@ -312,7 +312,7 @@ discard block |
||
| 312 | 312 | } |
| 313 | 313 | |
| 314 | 314 | /** |
| 315 | - * @return TokenStorageInterface | PHPUnit_Framework_MockObject_MockObject |
|
| 315 | + * @return \PHPUnit\Framework\MockObject\MockObject | PHPUnit_Framework_MockObject_MockObject |
|
| 316 | 316 | */ |
| 317 | 317 | protected function mockTokenStorage() |
| 318 | 318 | { |
@@ -338,7 +338,7 @@ discard block |
||
| 338 | 338 | } |
| 339 | 339 | |
| 340 | 340 | /** |
| 341 | - * @return MessageHandlerInterface | PHPUnit_Framework_MockObject_MockObject |
|
| 341 | + * @return \PHPUnit\Framework\MockObject\MockObject | PHPUnit_Framework_MockObject_MockObject |
|
| 342 | 342 | */ |
| 343 | 343 | protected function mockMessageHandler() |
| 344 | 344 | { |
@@ -351,7 +351,7 @@ discard block |
||
| 351 | 351 | } |
| 352 | 352 | |
| 353 | 353 | /** |
| 354 | - * @return TranslatorInterface | PHPUnit_Framework_MockObject_MockObject |
|
| 354 | + * @return \PHPUnit\Framework\MockObject\MockObject | PHPUnit_Framework_MockObject_MockObject |
|
| 355 | 355 | */ |
| 356 | 356 | protected function mockTranslator() |
| 357 | 357 | { |
@@ -392,7 +392,7 @@ discard block |
||
| 392 | 392 | /** |
| 393 | 393 | * @param $class |
| 394 | 394 | * |
| 395 | - * @return PHPUnit_Framework_MockObject_MockObject|mixed |
|
| 395 | + * @return \PHPUnit\Framework\MockObject\MockObject |
|
| 396 | 396 | */ |
| 397 | 397 | protected function getMockWithoutConstructor($class) |
| 398 | 398 | { |
@@ -65,12 +65,12 @@ |
||
| 65 | 65 | // initialise database |
| 66 | 66 | if (!self::$isDatabaseCreated) { |
| 67 | 67 | // TODO remove database at the end of the tests |
| 68 | - exec(__DIR__ . '/app/console doctrine:database:create --if-not-exists', $output); |
|
| 69 | - exec(__DIR__ . '/app/console doctrine:schema:update --force', $output); |
|
| 68 | + exec(__DIR__.'/app/console doctrine:database:create --if-not-exists', $output); |
|
| 69 | + exec(__DIR__.'/app/console doctrine:schema:update --force', $output); |
|
| 70 | 70 | |
| 71 | 71 | foreach ($output as $line) { |
| 72 | 72 | // TODO only in verbose mode |
| 73 | - fwrite(STDOUT, $line . "\n"); |
|
| 73 | + fwrite(STDOUT, $line."\n"); |
|
| 74 | 74 | } |
| 75 | 75 | fwrite(STDOUT, "\n"); |
| 76 | 76 | self::$isDatabaseCreated = true; |
@@ -274,7 +274,7 @@ discard block |
||
| 274 | 274 | /** |
| 275 | 275 | * Check if the Entity manager is open or closed. |
| 276 | 276 | * |
| 277 | - * @return bool |
|
| 277 | + * @return boolean|null |
|
| 278 | 278 | */ |
| 279 | 279 | public function isOpen() |
| 280 | 280 | { |
@@ -345,7 +345,7 @@ discard block |
||
| 345 | 345 | /** |
| 346 | 346 | * Checks whether the state of the filter collection is clean. |
| 347 | 347 | * |
| 348 | - * @return boolean True, if the filter collection is clean. |
|
| 348 | + * @return boolean|null True, if the filter collection is clean. |
|
| 349 | 349 | */ |
| 350 | 350 | public function isFiltersStateClean() |
| 351 | 351 | { |
@@ -355,7 +355,7 @@ discard block |
||
| 355 | 355 | /** |
| 356 | 356 | * Checks whether the Entity Manager has filters. |
| 357 | 357 | * |
| 358 | - * @return boolean True, if the EM has a filter collection. |
|
| 358 | + * @return boolean|null True, if the EM has a filter collection. |
|
| 359 | 359 | */ |
| 360 | 360 | public function hasFilters() |
| 361 | 361 | { |
@@ -517,7 +517,7 @@ discard block |
||
| 517 | 517 | * |
| 518 | 518 | * @param object $object |
| 519 | 519 | * |
| 520 | - * @return bool |
|
| 520 | + * @return boolean|null |
|
| 521 | 521 | */ |
| 522 | 522 | public function contains($object) |
| 523 | 523 | { |