Skip to content

Commit 5e7b5e6

Browse files
karlitschekCarlSchwan
authored andcommitted
fix(stream): satisfy the docblock alignment rule on getDailyCounts
php-cs-fixer wants a multi-line @return description aligned under the description column, which for this signature meant indenting the wrap to column 68. The description belongs in the docblock body instead, so the @return line stays a single type and there is nothing to align. Reproduced and verified with php-cs-fixer 3.95.15, the version CI pins: 1 of 97 files before, 0 of 97 after. Assisted-by: ClaudeCode:claude-opus-5 Signed-off-by: Frank Karlitschek <karlitschek@users.noreply.github.com>
1 parent 5e34731 commit 5e7b5e6

4 files changed

Lines changed: 13 additions & 6 deletions

File tree

lib/Controller/APIv2Controller.php

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -186,6 +186,11 @@ public function getHistogram(
186186
} catch (InvalidSearchCriteriaException $e) {
187187
return new DataResponse(['message' => $e->getMessage()], Http::STATUS_BAD_REQUEST);
188188
}
189+
if (($object_type !== '' && $object_id === 0) || ($object_type === '' && $object_id !== 0)) {
190+
// Only allowed together (mirrors validateParameters())
191+
$object_type = '';
192+
$object_id = 0;
193+
}
189194

190195
// Window boundaries are resolved in the viewer's timezone so the last
191196
// column is their today, not UTC's

lib/Data.php

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -405,12 +405,14 @@ private function applyStreamConditions(
405405
* `affecteduser` and a timestamp range, which is exactly the
406406
* `activity_user_time` index.
407407
*
408+
* `counts` is keyed by `Y-m-d` and omits days with no activity, so its size
409+
* tracks real activity rather than the length of the window. `partialBefore`
410+
* is the date from which counts are known to be incomplete, or null.
411+
*
408412
* @param int $from Start of the window as a Unix timestamp, inclusive
409413
* @param int $to End of the window as a Unix timestamp, inclusive
410414
*
411-
* @return array{counts: array<string, int>, partialBefore: ?string} Counts
412-
* keyed by `Y-m-d`, omitting days with no activity, plus the date
413-
* from which counts are known to be incomplete, if any
415+
* @return array{counts: array<string, int>, partialBefore: ?string}
414416
*/
415417
public function getDailyCounts(
416418
UserSettings $userSettings,

src/components/ActivityHeatmap.vue

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -330,7 +330,7 @@ function select(from: string, to: string): void {
330330
}
331331
332332
/**
333-
*
333+
* Clear the current selection, emitting null for both bounds.
334334
*/
335335
function clearSelection(): void {
336336
emit('update:from', null)
@@ -462,7 +462,7 @@ async function loadHistogram(): Promise<void> {
462462
// the grid to exist before scrolling it.
463463
await nextTick()
464464
const element = scroller.value
465-
if (element !== undefined) {
465+
if (element) {
466466
element.scrollLeft = element.scrollWidth
467467
}
468468
} catch (error) {

tests/Controller/APIv2ControllerTest.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -479,9 +479,9 @@ public function testGetHistogramWindowEndsTodayAndSpansTheRequestedDays(): void
479479
return ['counts' => [], 'partialBefore' => null];
480480
});
481481

482+
$today = new \DateTimeImmutable('now', new \DateTimeZone('UTC'));
482483
$data = $this->controller->getHistogram('all', 7)->getData();
483484

484-
$today = new \DateTimeImmutable('now', new \DateTimeZone('UTC'));
485485
$this->assertSame($today->format('Y-m-d'), $data['to']);
486486
$this->assertSame($today->modify('-6 days')->format('Y-m-d'), $data['from']);
487487
// 7 days inclusive, from the first second to the last

0 commit comments

Comments
 (0)