diff --git a/src/Grid/Grid.php b/src/Grid/Grid.php index e1b88b0..309ed89 100644 --- a/src/Grid/Grid.php +++ b/src/Grid/Grid.php @@ -1102,7 +1102,7 @@ public function getTweaks(): array return $this->tweaks; } - public function getAllTweaks(): ?array + public function getAllTweaks(): array { return $this->tweaks; } @@ -1382,7 +1382,7 @@ public function setDefaultTweak(?string $tweakId): self return $this; } - public function getDefaultTweak(): ?string + public function getDefaultTweak(): string { return $this->defaultTweak; } diff --git a/src/Grid/Row.php b/src/Grid/Row.php index 4231d31..bb8742b 100644 --- a/src/Grid/Row.php +++ b/src/Grid/Row.php @@ -31,7 +31,7 @@ class Row public function __construct() { $this->fields = []; - $this->color = ''; + $this->color = ''; } public function setRepository(EntityRepository $repository): self diff --git a/src/Grid/Source/Vector.php b/src/Grid/Source/Vector.php index 4eb1818..cba8ac7 100644 --- a/src/Grid/Source/Vector.php +++ b/src/Grid/Source/Vector.php @@ -58,18 +58,18 @@ public function initialise(ManagerRegistry $doctrine, Manager $mapping): void protected function guessColumns(): void { $guessedColumns = []; - $dataColumnIds = array_keys(reset($this->data)); + $dataColumnIds = array_keys(reset($this->data)); foreach ($dataColumnIds as $id) { if (!$this->hasColumn($id)) { - $params = [ - 'id' => $id, - 'title' => $id, - 'source' => true, + $params = [ + 'id' => $id, + 'title' => $id, + 'source' => true, 'filterable' => true, - 'sortable' => true, - 'visible' => true, - 'field' => $id, + 'sortable' => true, + 'visible' => true, + 'field' => $id, ]; $guessedColumns[] = new UntypedColumn($params); } @@ -85,7 +85,7 @@ protected function guessColumns(): void continue; } - $i = 0; + $i = 0; $fieldTypes = []; foreach ($this->data as $row) { @@ -195,14 +195,7 @@ public function getTotalCount(?int $maxResults = null): ?int public function getHash(): ?string { - return __CLASS__ . md5( - implode( - '', - array_map(function ($c) { - return $c->getId(); - }, $this->columns) - ) - ); + return __CLASS__ . md5(implode('', array_map(fn($c) => $c->getId(), $this->columns))); } public function setId(string|array $id) diff --git a/tests/Grid/Column/ColumnTest.php b/tests/Grid/Column/ColumnTest.php index 5278067..7d36d14 100644 --- a/tests/Grid/Column/ColumnTest.php +++ b/tests/Grid/Column/ColumnTest.php @@ -1007,9 +1007,12 @@ public function testGetFiltersBtweWithoutFrom(): void $mock = $this->getMockForAbstractClass(Column::class); $mock->setData(['operator' => Column::OPERATOR_BTWE, 'to' => 10]); - $this->assertEquals([ - new Filter(Column::OPERATOR_LTE, 10), - ], $mock->getFilters('aSource')); + $this->assertEquals( + [ + new Filter(Column::OPERATOR_LTE, 10), + ], + $mock->getFilters('aSource') + ); } public function testGetFiltersBtweWithoutTo(): void @@ -1030,10 +1033,13 @@ public function testGetFiltersBtwe(): void $mock = $this->getMockForAbstractClass(Column::class); $mock->setData(['operator' => Column::OPERATOR_BTWE, 'from' => 1, 'to' => 10]); - $this->assertEquals([ - new Filter(Column::OPERATOR_GTE, 1), - new Filter(Column::OPERATOR_LTE, 10), - ], $mock->getFilters('aSource')); + $this->assertEquals( + [ + new Filter(Column::OPERATOR_GTE, 1), + new Filter(Column::OPERATOR_LTE, 10), + ], + $mock->getFilters('aSource') + ); } public function testGetFiltersNullNoNull(): void