1111use OCA \Tables \Model \Permissions ;
1212use OCA \Tables \Model \SortRuleSet ;
1313use OCA \Tables \ResponseDefinitions ;
14- use OCA \Tables \Service \ValueObject \ViewColumnInformation ;
14+ use OCA \Tables \Service \ValueObject \ColumnOrderInformation ;
1515
1616/**
1717 * @psalm-suppress PropertyNotSetInConstructor
4444 * @method setRowsCount(int $rowsCount)
4545 * @method getColumnsCount(): int
4646 * @method setColumnsCount(int $columnsCount)
47- * @method getViews(): ?array
47+ * @method getViews(): ?array<TablesView>
4848 * @method setViews(array $views)
4949 * @method getColumns(): array
5050 * @method setColumns(array $columns)
@@ -126,27 +126,26 @@ private function getSharePermissions(): ?Permissions {
126126 }
127127
128128 /**
129- * @psalm-suppress MismatchingDocblockReturnType
130129 * @return TablesView[]
131130 */
132131 private function getViewsArray (): array {
133132 return $ this ->getViews () ?: [];
134133 }
135134
136135 /**
137- * @psalm-suppress MismatchingDocblockReturnType
138136 * @return int[]
139137 */
140138 public function getColumnOrderArray (): array {
141139 $ columnSettings = $ this ->getColumnOrderSettingsArray ();
142- usort ($ columnSettings , static function (ViewColumnInformation $ a , ViewColumnInformation $ b ) {
140+ usort ($ columnSettings , static function (ColumnOrderInformation $ a , ColumnOrderInformation $ b ) {
143141 return $ a ->getOrder () - $ b ->getOrder ();
144142 });
145- return array_map (static fn (ViewColumnInformation $ vci ): int => $ vci ->getId (), $ columnSettings );
143+ /** @var list<ColumnOrderInformation> $columnSettings */
144+ return array_map (static fn (ColumnOrderInformation $ vci ): int => $ vci ->getId (), $ columnSettings );
146145 }
147146
148147 /**
149- * @return array<ViewColumnInformation >
148+ * @return list<ColumnOrderInformation >
150149 */
151150 public function getColumnOrderSettingsArray (): array {
152151 $ columns = $ this ->getArray ($ this ->getColumnOrder ());
@@ -155,18 +154,17 @@ public function getColumnOrderSettingsArray(): array {
155154 }
156155
157156 if (is_array ($ columns [array_key_first ($ columns )] ?? null )) {
158- return array_values (array_map (static fn (array $ a ): ViewColumnInformation => ViewColumnInformation ::fromArray ($ a ), $ columns ));
157+ return array_values (array_map (static fn (array $ a ): ColumnOrderInformation => ColumnOrderInformation ::fromArray ($ a ), $ columns ));
159158 }
160159
161160 $ result = [];
162161 foreach ($ columns as $ index => $ columnId ) {
163- $ result [] = new ViewColumnInformation ( $ columnId , order: (int )$ index + 1 );
162+ $ result [] = new ColumnOrderInformation (( int ) $ columnId , order: (int )$ index + 1 );
164163 }
165164 return $ result ;
166165 }
167166
168167 /**
169- * @psalm-suppress MismatchingDocblockReturnType
170168 * @return list<array{columnId: int, mode: 'ASC'|'DESC'}>
171169 */
172170 public function getSortArray (): array {
@@ -176,9 +174,8 @@ public function getSortArray(): array {
176174
177175 private function getArray (?string $ json ): array {
178176 if ($ json !== '' && $ json !== null && $ json !== 'null ' ) {
179- return \json_decode ($ json , true );
180- } else {
181- return [];
177+ return \json_decode ($ json , true ) ?? [];
182178 }
179+ return [];
183180 }
184181}
0 commit comments