Skip to content

Commit ced2471

Browse files
authored
Fix #65: Remove label field from the Sort class
1 parent c70320e commit ced2471

File tree

2 files changed

+1
-11
lines changed

2 files changed

+1
-11
lines changed

src/Reader/Sort.php

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@
1313
* Sort represents information relevant to sorting according to one or multiple item fields.
1414
*
1515
* @template TSortFieldItem as array<string, int>
16-
* @template TConfigItem as array{asc: TSortFieldItem, desc: TSortFieldItem, default: string, label: string}
16+
* @template TConfigItem as array{asc: TSortFieldItem, desc: TSortFieldItem, default: string}
1717
* @template TConfig as array<string, TConfigItem>
1818
* @psalm-immutable
1919
*/
@@ -38,7 +38,6 @@ final class Sort
3838
* 'asc' => ['first_name' => SORT_ASC, 'last_name' => SORT_ASC],
3939
* 'desc' => ['first_name' => SORT_DESC, 'last_name' => SORT_DESC],
4040
* 'default' => 'desc',
41-
* 'label' => 'Name',
4241
* ],
4342
* ]
4443
* ```
@@ -51,7 +50,6 @@ final class Sort
5150
* 'asc' => ['age' => SORT_ASC],
5251
* 'desc' => ['age' => SORT_DESC],
5352
* 'default' => 'asc',
54-
* 'label' => Inflector::camel2words('age'),
5553
* ]
5654
* ```
5755
*
@@ -63,7 +61,6 @@ final class Sort
6361
* - `asc` - criteria for ascending sorting.
6462
* - `desc` - criteria for descending sorting.
6563
* - `default` - default sorting. Could be either `asc` or `desc`. If not specified, `asc` is used.
66-
* - `label` -
6764
* @psalm-var array<int, string>|array<string, array<string, int|string>> $config
6865
*/
6966
public function __construct(array $config)
@@ -84,7 +81,6 @@ public function __construct(array $config)
8481
'asc' => [$fieldName => SORT_ASC],
8582
'desc' => [$fieldName => SORT_DESC],
8683
'default' => 'asc',
87-
'label' => $fieldName,
8884
], $fieldConfig);
8985
}
9086

tests/Reader/SortTest.php

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,6 @@ public function testConfig(): void
3636
'asc' => ['first_name' => SORT_ASC, 'last_name' => SORT_ASC],
3737
'desc' => ['first_name' => SORT_DESC, 'last_name' => SORT_DESC],
3838
'default' => 'desc',
39-
'label' => 'Name',
4039
],
4140
]);
4241

@@ -49,7 +48,6 @@ public function testConfig(): void
4948
'a' => SORT_DESC,
5049
],
5150
'default' => 'asc',
52-
'label' => 'a',
5351
],
5452
'b' => [
5553
'asc' => [
@@ -59,13 +57,11 @@ public function testConfig(): void
5957
'b' => SORT_DESC,
6058
],
6159
'default' => 'desc',
62-
'label' => 'b',
6360
],
6461
'name' => [
6562
'asc' => ['first_name' => SORT_ASC, 'last_name' => SORT_ASC],
6663
'desc' => ['first_name' => SORT_DESC, 'last_name' => SORT_DESC],
6764
'default' => 'desc',
68-
'label' => 'Name',
6965
],
7066
];
7167
$this->assertSame($expected, $this->getInaccessibleProperty($sort, 'config'));
@@ -123,7 +119,6 @@ public function testGetCriteria(): void
123119
'asc' => ['bee' => SORT_ASC],
124120
'desc' => ['bee' => SORT_DESC],
125121
'default' => 'asc',
126-
'label' => 'B',
127122
],
128123
]))
129124
->withOrder([
@@ -143,7 +138,6 @@ public function testGetCriteriaDefaults(): void
143138
'asc' => ['bee' => SORT_ASC],
144139
'desc' => ['bee' => SORT_DESC],
145140
'default' => 'desc',
146-
'label' => 'B',
147141
],
148142
]))
149143
->withOrder([]);

0 commit comments

Comments
 (0)