From 3bc96fe5ecb30b33da8e90689caf1d6880349d30 Mon Sep 17 00:00:00 2001 From: Dmitry Groza Date: Wed, 5 Jul 2017 01:29:32 +0000 Subject: [PATCH] Apply fixes from StyleCI --- .../Sortable/SortableServiceProvider.php | 2 +- tests/M2mSortableTest.php | 42 ++--- tests/MorphToManySortableTest.php | 42 ++--- tests/SortableControllerTest.php | 154 +++++++++--------- tests/SortableGroupTraitTest.php | 130 +++++++-------- tests/SortableTestBase.php | 7 +- tests/SortableTraitTest.php | 76 ++++----- tests/SortableTraitWithChangedFieldTest.php | 76 ++++----- 8 files changed, 264 insertions(+), 265 deletions(-) diff --git a/src/Rutorika/Sortable/SortableServiceProvider.php b/src/Rutorika/Sortable/SortableServiceProvider.php index 862b2c7..09493f7 100644 --- a/src/Rutorika/Sortable/SortableServiceProvider.php +++ b/src/Rutorika/Sortable/SortableServiceProvider.php @@ -34,6 +34,6 @@ public function boot() */ public function provides() { - return array(); + return []; } } diff --git a/tests/M2mSortableTest.php b/tests/M2mSortableTest.php index c87ffae..dfd078d 100644 --- a/tests/M2mSortableTest.php +++ b/tests/M2mSortableTest.php @@ -482,14 +482,14 @@ public function testMoveBeforeOtherRelatedNotChanged($entityId, $relativeEntityI */ public function moveWhenMovedEntityComesBeforeRelativeEntityProvider() { - return array( - array(1, 7, 30), - array(7, 9, 30), - array(15, 30, 30), - array(1, 30, 30), - array(1, 2, 30), - array(29, 30, 30), - ); + return [ + [1, 7, 30], + [7, 9, 30], + [15, 30, 30], + [1, 30, 30], + [1, 2, 30], + [29, 30, 30], + ]; } /** @@ -497,14 +497,14 @@ public function moveWhenMovedEntityComesBeforeRelativeEntityProvider() */ public function moveWhenMovedEntityComesAfterRelativeEntityProvider() { - return array( - array(7, 1, 30), - array(9, 7, 30), - array(30, 15, 30), - array(30, 1, 30), - array(2, 1, 30), - array(30, 29, 30), - ); + return [ + [7, 1, 30], + [9, 7, 30], + [30, 15, 30], + [30, 1, 30], + [2, 1, 30], + [30, 29, 30], + ]; } /** @@ -512,11 +512,11 @@ public function moveWhenMovedEntityComesAfterRelativeEntityProvider() */ public function moveWhenMovedEntityIsRelativeEntityProvider() { - return array( - array(1, 30), - array(7, 30), - array(30, 30), - ); + return [ + [1, 30], + [7, 30], + [30, 30], + ]; } /** diff --git a/tests/MorphToManySortableTest.php b/tests/MorphToManySortableTest.php index 246839a..29abbf9 100644 --- a/tests/MorphToManySortableTest.php +++ b/tests/MorphToManySortableTest.php @@ -483,14 +483,14 @@ public function testMoveBeforeOtherRelatedNotChanged($entityId, $relativeEntityI */ public function moveWhenMovedEntityComesBeforeRelativeEntityProvider() { - return array( - array(1, 7, 30), - array(7, 9, 30), - array(15, 30, 30), - array(1, 30, 30), - array(1, 2, 30), - array(29, 30, 30), - ); + return [ + [1, 7, 30], + [7, 9, 30], + [15, 30, 30], + [1, 30, 30], + [1, 2, 30], + [29, 30, 30], + ]; } /** @@ -498,14 +498,14 @@ public function moveWhenMovedEntityComesBeforeRelativeEntityProvider() */ public function moveWhenMovedEntityComesAfterRelativeEntityProvider() { - return array( - array(7, 1, 30), - array(9, 7, 30), - array(30, 15, 30), - array(30, 1, 30), - array(2, 1, 30), - array(30, 29, 30), - ); + return [ + [7, 1, 30], + [9, 7, 30], + [30, 15, 30], + [30, 1, 30], + [2, 1, 30], + [30, 29, 30], + ]; } /** @@ -513,11 +513,11 @@ public function moveWhenMovedEntityComesAfterRelativeEntityProvider() */ public function moveWhenMovedEntityIsRelativeEntityProvider() { - return array( - array(1, 30), - array(7, 30), - array(30, 30), - ); + return [ + [1, 30], + [7, 30], + [30, 30], + ]; } /** diff --git a/tests/SortableControllerTest.php b/tests/SortableControllerTest.php index bbc31b4..9868f4c 100644 --- a/tests/SortableControllerTest.php +++ b/tests/SortableControllerTest.php @@ -11,7 +11,7 @@ public function setUp() parent::setUp(); $this->loadMigrationsFrom([ '--database' => 'testbench', - '--realpath' => realpath(__DIR__.'/migrations'), + '--realpath' => realpath(__DIR__ . '/migrations'), ]); for ($i = 1; $i <= 30; ++$i) { @@ -46,16 +46,16 @@ protected function getEnvironmentSetUp($app) $app['config']->set('app.debug', true); $app['config']->set( 'database.connections.testbench', - array( + [ 'driver' => 'sqlite', 'database' => ':memory:', 'prefix' => '', - ) + ] ); $app['config']->set( 'sortable.entities', - array( + [ 'sortable_entity' => '\SortableEntity', 'sortable_entity_full_config' => ['entity' => '\SortableEntity'], 'sortable_entity_m2m' => ['entity' => '\M2mEntity', 'relation' => 'relatedEntities'], @@ -63,7 +63,7 @@ protected function getEnvironmentSetUp($app) 'sortable_entity_m2m_without_relation' => ['entity' => '\M2mEntity'], 'sortable_entity_m2m_with_invalid_relation' => ['entity' => '\M2mEntity'], - ) + ] ); $app['router']->post('sort', '\Rutorika\Sortable\SortableController@sort'); @@ -225,170 +225,170 @@ protected function parseJSON($response) public function validParamsProvider() { - return array( - array( - array( + return [ + [ + [ 'type' => 'moveAfter', 'entityName' => 'sortable_entity', 'positionEntityId' => 4, 'id' => 13, - ), - ), - array( - array( + ], + ], + [ + [ 'type' => 'moveAfter', 'entityName' => 'sortable_entity', 'positionEntityId' => 10, 'id' => 5, - ), - ), - array( - array( + ], + ], + [ + [ 'type' => 'moveBefore', 'entityName' => 'sortable_entity', 'positionEntityId' => 1, 'id' => 30, - ), - ), - array( - array( + ], + ], + [ + [ 'type' => 'moveBefore', 'entityName' => 'sortable_entity_full_config', 'positionEntityId' => 1, 'id' => 30, - ), - ), - ); + ], + ], + ]; } public function validParamsM2mProvider() { - return array( - array( - array( + return [ + [ + [ 'type' => 'moveAfter', 'entityName' => 'sortable_entity_m2m', 'parentId' => 1, 'positionEntityId' => 4, 'id' => 13, - ), - ), - array( - array( + ], + ], + [ + [ 'type' => 'moveAfter', 'entityName' => 'sortable_entity_m2m', 'parentId' => 1, 'positionEntityId' => 10, 'id' => 5, - ), - ), - array( - array( + ], + ], + [ + [ 'type' => 'moveBefore', 'entityName' => 'sortable_entity_m2m', 'parentId' => 1, 'positionEntityId' => 1, 'id' => 30, - ), - ), - ); + ], + ], + ]; } public function invalidParamsProvider() { - return array( - array( - array( + return [ + [ + [ 'type' => 'moveAfter', 'entityName' => 'sortable_entity', 'positionEntityId' => 4, 'id' => 50, - ), + ], 'invalidEntityId', - ), - array( - array( + ], + [ + [ 'type' => 'moveAfter', 'entityName' => 'sortable_entity', 'positionEntityId' => 50, 'id' => 4, - ), + ], 'invalidPositionEntityId', - ), - array( - array( + ], + [ + [ 'type' => 'moveAfter', 'entityName' => 'invalid_entity', 'positionEntityId' => 10, 'id' => 5, - ), + ], 'invalidEntityName', - ), - array( - array( + ], + [ + [ 'type' => 'moveAfter', 'entityName' => 'sortable_entity_without_class', 'positionEntityId' => 10, 'id' => 5, - ), + ], 'invalidEntityClass', - ), - array( - array( + ], + [ + [ 'type' => 'moveSomewher', 'entityName' => 'sortable_entity', 'positionEntityId' => 1, 'id' => 30, - ), + ], 'invalidType', - ), - ); + ], + ]; } public function invalidM2mParamsProvider() { - return array( - array( - array( + return [ + [ + [ 'type' => 'moveAfter', 'entityName' => 'sortable_entity_m2m', 'parentId' => 1, 'positionEntityId' => 4, 'id' => 50, - ), + ], 'invalidEntityId', - ), - array( - array( + ], + [ + [ 'type' => 'moveAfter', 'entityName' => 'sortable_entity_m2m', 'parentId' => 1, 'positionEntityId' => 50, 'id' => 1, - ), + ], 'invalidPositionEntityId', - ), - array( - array( + ], + [ + [ 'type' => 'moveAfter', 'entityName' => 'sortable_entity_m2m', 'parentId' => 3, 'positionEntityId' => 4, 'id' => 6, - ), + ], 'parentEntityId', - ), - array( - array( + ], + [ + [ 'type' => 'moveAfter', 'entityName' => 'sortable_entity_m2m_failed', 'parentId' => 3, 'positionEntityId' => 4, 'id' => 1, - ), + ], 'invalidEntityName', - ), - ); + ], + ]; } protected function getPackageProviders($app) diff --git a/tests/SortableGroupTraitTest.php b/tests/SortableGroupTraitTest.php index e0f6388..abc5711 100644 --- a/tests/SortableGroupTraitTest.php +++ b/tests/SortableGroupTraitTest.php @@ -34,7 +34,7 @@ public function testPosition() $categories = ['first', 'second', 'third']; /** @var SortableEntity[] $entities */ - $entities = array(); + $entities = []; for ($i = 0; $i < 30; ++$i) { $category = $categories[array_rand($categories)]; $entity = new SortableEntityGroup(); @@ -62,8 +62,8 @@ public function testFixedEntities($entityId, $relativeEntityId, $method, $countT { /** @var SortableEntity[] $entities */ - $entities = array(); - $fixedEntities = array(); + $entities = []; + $fixedEntities = []; for ($i = 1; $i <= $countTotal; ++$i) { $entities[$i] = new SortableEntityGroup(); $entities[$i]->category = 'first_category'; @@ -110,8 +110,8 @@ public function generateEntities($count) { /** @var SortableEntity[] $entities */ - $entities = array(); - $fixedEntities = array(); + $entities = []; + $fixedEntities = []; for ($i = 1; $i <= $count; ++$i) { $entities[$i] = new SortableEntityGroup(); $entities[$i]->category = 'first_category'; @@ -287,43 +287,43 @@ public function testInvalidBeforeMove() */ public function fixedEntitiesProvider() { - return array( - array(2, 5, 'before', 30), - array(1, 6, 'before', 30), - array(1, 7, 'before', 30), - array(3, 5, 'before', 30), - array(5, 10, 'before', 30), - array(7, 9, 'before', 30), - array(15, 30, 'before', 30), - array(16, 30, 'before', 30), - array(7, 1, 'before', 30), - array(6, 1, 'before', 30), - array(5, 3, 'before', 30), - array(9, 7, 'before', 30), - array(10, 5, 'before', 30), - array(30, 15, 'before', 30), - array(1, 1, 'before', 30), - array(7, 7, 'before', 30), - array(30, 30, 'before', 30), - - array(2, 5, 'after', 30), - array(1, 6, 'after', 30), - array(1, 7, 'after', 30), - array(3, 5, 'after', 30), - array(5, 10, 'after', 30), - array(7, 9, 'after', 30), - array(15, 30, 'after', 30), - array(16, 30, 'after', 30), - array(7, 1, 'after', 30), - array(6, 1, 'after', 30), - array(5, 3, 'after', 30), - array(9, 7, 'after', 30), - array(10, 5, 'after', 30), - array(30, 15, 'after', 30), - array(1, 1, 'after', 30), - array(7, 7, 'after', 30), - array(30, 30, 'after', 30), - ); + return [ + [2, 5, 'before', 30], + [1, 6, 'before', 30], + [1, 7, 'before', 30], + [3, 5, 'before', 30], + [5, 10, 'before', 30], + [7, 9, 'before', 30], + [15, 30, 'before', 30], + [16, 30, 'before', 30], + [7, 1, 'before', 30], + [6, 1, 'before', 30], + [5, 3, 'before', 30], + [9, 7, 'before', 30], + [10, 5, 'before', 30], + [30, 15, 'before', 30], + [1, 1, 'before', 30], + [7, 7, 'before', 30], + [30, 30, 'before', 30], + + [2, 5, 'after', 30], + [1, 6, 'after', 30], + [1, 7, 'after', 30], + [3, 5, 'after', 30], + [5, 10, 'after', 30], + [7, 9, 'after', 30], + [15, 30, 'after', 30], + [16, 30, 'after', 30], + [7, 1, 'after', 30], + [6, 1, 'after', 30], + [5, 3, 'after', 30], + [9, 7, 'after', 30], + [10, 5, 'after', 30], + [30, 15, 'after', 30], + [1, 1, 'after', 30], + [7, 7, 'after', 30], + [30, 30, 'after', 30], + ]; } /** @@ -331,14 +331,14 @@ public function fixedEntitiesProvider() */ public function moveWhenMovedEntityComesAfterRelativeEntityProvider() { - return array( - array(7, 1, 30), - array(6, 1, 30), - array(5, 3, 30), - array(9, 7, 30), - array(10, 5, 30), - array(30, 15, 30), - ); + return [ + [7, 1, 30], + [6, 1, 30], + [5, 3, 30], + [9, 7, 30], + [10, 5, 30], + [30, 15, 30], + ]; } /** @@ -346,16 +346,16 @@ public function moveWhenMovedEntityComesAfterRelativeEntityProvider() */ public function moveWhenMovedEntityComesBeforeRelativeEntityProvider() { - return array( - array(2, 5, 30), - array(1, 6, 30), - array(1, 7, 30), - array(3, 5, 30), - array(5, 10, 30), - array(7, 9, 30), - array(15, 30, 30), - array(16, 30, 30), - ); + return [ + [2, 5, 30], + [1, 6, 30], + [1, 7, 30], + [3, 5, 30], + [5, 10, 30], + [7, 9, 30], + [15, 30, 30], + [16, 30, 30], + ]; } /** @@ -363,10 +363,10 @@ public function moveWhenMovedEntityComesBeforeRelativeEntityProvider() */ public function moveWhenMovedEntityIsRelativeEntityProvider() { - return array( - array(1, 30), - array(7, 30), - array(30, 30), - ); + return [ + [1, 30], + [7, 30], + [30, 30], + ]; } } diff --git a/tests/SortableTestBase.php b/tests/SortableTestBase.php index e31c125..6c46000 100644 --- a/tests/SortableTestBase.php +++ b/tests/SortableTestBase.php @@ -8,7 +8,7 @@ public function setUp() $this->loadMigrationsFrom([ '--database' => 'testbench', - '--realpath' => realpath(__DIR__.'/migrations'), + '--realpath' => realpath(__DIR__ . '/migrations'), ]); } @@ -19,11 +19,11 @@ protected function getEnvironmentSetUp($app) $app['config']->set('database.default', 'testbench'); $app['config']->set( 'database.connections.testbench', - array( + [ 'driver' => 'sqlite', 'database' => ':memory:', 'prefix' => '', - ) + ] ); } @@ -31,5 +31,4 @@ protected function getPackageProviders($app) { return ['Orchestra\Database\ConsoleServiceProvider']; } - } diff --git a/tests/SortableTraitTest.php b/tests/SortableTraitTest.php index 79b2a09..d84040e 100644 --- a/tests/SortableTraitTest.php +++ b/tests/SortableTraitTest.php @@ -28,7 +28,7 @@ public function testPosition() { /** @var SortableEntity[] $entities */ - $entities = array(); + $entities = []; for ($i = 1; $i <= 30; ++$i) { $entities[$i] = new SortableEntity(); $entities[$i]->save(); @@ -49,7 +49,7 @@ public function testMoveAfterWhenMovedEntityComesBeforeRelativeEntity($entityId, // interavls: [1 .. $entityId - 1], [$entityId], [$entityId + 1 .. $relativeEntityId], [$relativeEntityId .. $countTotal] /** @var SortableEntity[] $entities */ - $entities = array(); + $entities = []; for ($i = 1; $i <= $countTotal; ++$i) { $entities[$i] = new SortableEntity(); $entities[$i]->save(); @@ -97,7 +97,7 @@ public function testMoveAfterWhenMovedEntityComesAfterRelativeEntity($entityId, // interavls: [1 .. $relativeEntityId], , [$relativeEntityId + 1 .. $entityId - 1], [$entityId], [$entityId + 1 .. $countTotal] /** @var SortableEntity[] $entities */ - $entities = array(); + $entities = []; for ($i = 1; $i <= $countTotal; ++$i) { $entities[$i] = new SortableEntity(); $entities[$i]->save(); @@ -141,7 +141,7 @@ public function testMoveAfterWhenMovedEntityIsRelativeEntity($entityId, $countTo { /** @var SortableEntity[] $entities */ - $entities = array(); + $entities = []; for ($i = 1; $i <= $countTotal; ++$i) { $entities[$i] = new SortableEntity(); $entities[$i]->save(); @@ -167,7 +167,7 @@ public function testMoveBeforeWhenMovedEntityComesBeforeRelativeEntity($entityId { /** @var SortableEntity[] $entities */ - $entities = array(); + $entities = []; for ($i = 1; $i <= $countTotal; ++$i) { $entities[$i] = new SortableEntity(); $entities[$i]->save(); @@ -212,7 +212,7 @@ public function testMoveBeforeWhenMovedEntityComesAfterRelativeEntity($entityId, { /** @var SortableEntity[] $entities */ - $entities = array(); + $entities = []; for ($i = 1; $i <= $countTotal; ++$i) { $entities[$i] = new SortableEntity(); $entities[$i]->save(); @@ -257,7 +257,7 @@ public function testMoveBeforeWhenMovedEntityIsRelativeEntity($entityId, $countT { /** @var SortableEntity[] $entities */ - $entities = array(); + $entities = []; for ($i = 1; $i <= $countTotal; ++$i) { $entities[$i] = new SortableEntity(); $entities[$i]->save(); @@ -276,7 +276,7 @@ public function testMoveBeforeWhenMovedEntityIsRelativeEntity($entityId, $countT public function testSortedScope() { /** @var SortableEntity[] $entities */ - $entities = array(); + $entities = []; for ($i = 1; $i <= 30; ++$i) { $entities[$i] = new SortableEntity(); $entities[$i]->save(); @@ -307,7 +307,7 @@ public function testSortedScope() public function testGetPrevious($entityId, $limit) { /** @var SortableEntity[] $entities */ - $entities = array(); + $entities = []; for ($i = 1; $i <= 30; ++$i) { $entities[$i] = new SortableEntity(); $entities[$i]->save(); @@ -344,7 +344,7 @@ public function testGetPrevious($entityId, $limit) public function testGetNext($entityId, $limit) { /** @var SortableEntity[] $entities */ - $entities = array(); + $entities = []; for ($i = 1; $i <= 30; ++$i) { $entities[$i] = new SortableEntity(); $entities[$i]->save(); @@ -381,7 +381,7 @@ public function testGetNext($entityId, $limit) */ public function testDefaultsPrevious($entityId, $limit) { - $entities = array(); + $entities = []; for ($i = 1; $i <= 30; ++$i) { $entities[$i] = new SortableEntity(); $entities[$i]->save(); @@ -405,7 +405,7 @@ public function testDefaultsPrevious($entityId, $limit) */ public function testDefaultsNext($entityId, $limit) { - $entities = array(); + $entities = []; for ($i = 1; $i <= 30; ++$i) { $entities[$i] = new SortableEntity(); $entities[$i]->save(); @@ -426,11 +426,11 @@ public function testDefaultsNext($entityId, $limit) */ public function moveWhenMovedEntityComesAfterRelativeEntityProvider() { - return array( - array(7, 1, 30), - array(9, 7, 30), - array(30, 15, 30), - ); + return [ + [7, 1, 30], + [9, 7, 30], + [30, 15, 30], + ]; } /** @@ -438,11 +438,11 @@ public function moveWhenMovedEntityComesAfterRelativeEntityProvider() */ public function moveWhenMovedEntityComesBeforeRelativeEntityProvider() { - return array( - array(1, 7, 30), - array(7, 9, 30), - array(15, 30, 30), - ); + return [ + [1, 7, 30], + [7, 9, 30], + [15, 30, 30], + ]; } /** @@ -450,11 +450,11 @@ public function moveWhenMovedEntityComesBeforeRelativeEntityProvider() */ public function moveWhenMovedEntityIsRelativeEntityProvider() { - return array( - array(1, 30), - array(7, 30), - array(30, 30), - ); + return [ + [1, 30], + [7, 30], + [30, 30], + ]; } /** @@ -462,16 +462,16 @@ public function moveWhenMovedEntityIsRelativeEntityProvider() */ public function getPreviousNextEntityProvider() { - return array( - array(5, 0), - array(5, 1), - array(1, 1), - array(10, 1), - array(30, 1), - array(5, 12), - array(1, 10), - array(10, 4), - array(30, 4), - ); + return [ + [5, 0], + [5, 1], + [1, 1], + [10, 1], + [30, 1], + [5, 12], + [1, 10], + [10, 4], + [30, 4], + ]; } } diff --git a/tests/SortableTraitWithChangedFieldTest.php b/tests/SortableTraitWithChangedFieldTest.php index 950e534..0b5fcaa 100644 --- a/tests/SortableTraitWithChangedFieldTest.php +++ b/tests/SortableTraitWithChangedFieldTest.php @@ -28,7 +28,7 @@ public function testPosition() { /** @var SortableEntity[] $entities */ - $entities = array(); + $entities = []; for ($i = 1; $i <= 30; ++$i) { $entities[$i] = new SortableEntityWithChangedField(); $entities[$i]->save(); @@ -49,7 +49,7 @@ public function testMoveAfterWhenMovedEntityComesBeforeRelativeEntity($entityId, // interavls: [1 .. $entityId - 1], [$entityId], [$entityId + 1 .. $relativeEntityId], [$relativeEntityId .. $countTotal] /** @var SortableEntity[] $entities */ - $entities = array(); + $entities = []; for ($i = 1; $i <= $countTotal; ++$i) { $entities[$i] = new SortableEntityWithChangedField(); $entities[$i]->save(); @@ -97,7 +97,7 @@ public function testMoveAfterWhenMovedEntityComesAfterRelativeEntity($entityId, // interavls: [1 .. $relativeEntityId], , [$relativeEntityId + 1 .. $entityId - 1], [$entityId], [$entityId + 1 .. $countTotal] /** @var SortableEntity[] $entities */ - $entities = array(); + $entities = []; for ($i = 1; $i <= $countTotal; ++$i) { $entities[$i] = new SortableEntityWithChangedField(); $entities[$i]->save(); @@ -141,7 +141,7 @@ public function testMoveAfterWhenMovedEntityIsRelativeEntity($entityId, $countTo { /** @var SortableEntity[] $entities */ - $entities = array(); + $entities = []; for ($i = 1; $i <= $countTotal; ++$i) { $entities[$i] = new SortableEntityWithChangedField(); $entities[$i]->save(); @@ -167,7 +167,7 @@ public function testMoveBeforeWhenMovedEntityComesBeforeRelativeEntity($entityId { /** @var SortableEntity[] $entities */ - $entities = array(); + $entities = []; for ($i = 1; $i <= $countTotal; ++$i) { $entities[$i] = new SortableEntityWithChangedField(); $entities[$i]->save(); @@ -212,7 +212,7 @@ public function testMoveBeforeWhenMovedEntityComesAfterRelativeEntity($entityId, { /** @var SortableEntity[] $entities */ - $entities = array(); + $entities = []; for ($i = 1; $i <= $countTotal; ++$i) { $entities[$i] = new SortableEntityWithChangedField(); $entities[$i]->save(); @@ -257,7 +257,7 @@ public function testMoveBeforeWhenMovedEntityIsRelativeEntity($entityId, $countT { /** @var SortableEntity[] $entities */ - $entities = array(); + $entities = []; for ($i = 1; $i <= $countTotal; ++$i) { $entities[$i] = new SortableEntityWithChangedField(); $entities[$i]->save(); @@ -276,7 +276,7 @@ public function testMoveBeforeWhenMovedEntityIsRelativeEntity($entityId, $countT public function testSortedScope() { /** @var SortableEntity[] $entities */ - $entities = array(); + $entities = []; for ($i = 1; $i <= 30; ++$i) { $entities[$i] = new SortableEntityWithChangedField(); $entities[$i]->save(); @@ -307,7 +307,7 @@ public function testSortedScope() public function testGetPrevious($entityId, $limit) { /** @var SortableEntity[] $entities */ - $entities = array(); + $entities = []; for ($i = 1; $i <= 30; ++$i) { $entities[$i] = new SortableEntityWithChangedField(); $entities[$i]->save(); @@ -344,7 +344,7 @@ public function testGetPrevious($entityId, $limit) public function testGetNext($entityId, $limit) { /** @var SortableEntity[] $entities */ - $entities = array(); + $entities = []; for ($i = 1; $i <= 30; ++$i) { $entities[$i] = new SortableEntityWithChangedField(); $entities[$i]->save(); @@ -381,7 +381,7 @@ public function testGetNext($entityId, $limit) */ public function testDefaultsPrevious($entityId, $limit) { - $entities = array(); + $entities = []; for ($i = 1; $i <= 30; ++$i) { $entities[$i] = new SortableEntityWithChangedField(); $entities[$i]->save(); @@ -405,7 +405,7 @@ public function testDefaultsPrevious($entityId, $limit) */ public function testDefaultsNext($entityId, $limit) { - $entities = array(); + $entities = []; for ($i = 1; $i <= 30; ++$i) { $entities[$i] = new SortableEntityWithChangedField(); $entities[$i]->save(); @@ -426,11 +426,11 @@ public function testDefaultsNext($entityId, $limit) */ public function moveWhenMovedEntityComesAfterRelativeEntityProvider() { - return array( - array(7, 1, 30), - array(9, 7, 30), - array(30, 15, 30), - ); + return [ + [7, 1, 30], + [9, 7, 30], + [30, 15, 30], + ]; } /** @@ -438,11 +438,11 @@ public function moveWhenMovedEntityComesAfterRelativeEntityProvider() */ public function moveWhenMovedEntityComesBeforeRelativeEntityProvider() { - return array( - array(1, 7, 30), - array(7, 9, 30), - array(15, 30, 30), - ); + return [ + [1, 7, 30], + [7, 9, 30], + [15, 30, 30], + ]; } /** @@ -450,11 +450,11 @@ public function moveWhenMovedEntityComesBeforeRelativeEntityProvider() */ public function moveWhenMovedEntityIsRelativeEntityProvider() { - return array( - array(1, 30), - array(7, 30), - array(30, 30), - ); + return [ + [1, 30], + [7, 30], + [30, 30], + ]; } /** @@ -462,16 +462,16 @@ public function moveWhenMovedEntityIsRelativeEntityProvider() */ public function getPreviousNextEntityProvider() { - return array( - array(5, 0), - array(5, 1), - array(1, 1), - array(10, 1), - array(30, 1), - array(5, 12), - array(1, 10), - array(10, 4), - array(30, 4), - ); + return [ + [5, 0], + [5, 1], + [1, 1], + [10, 1], + [30, 1], + [5, 12], + [1, 10], + [10, 4], + [30, 4], + ]; } }