Skip to content

Commit 9cfc176

Browse files
Add php-stan annotations from code review.
Co-authored-by: Weston Ruter <westonruter@gmail.com>
1 parent b7bc9f1 commit 9cfc176

1 file changed

Lines changed: 3 additions & 2 deletions

File tree

src/wp-includes/collaboration/class-wp-collaboration-table-storage.php

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@
2323
*
2424
* @access private
2525
*
26-
* @phpstan-type AwarenessState array{client_id: string, state: array<string, mixed>, user_id: int, timestamp: int}
26+
* @phpstan-type AwarenessState array{client_id: string, state: array<mixed, mixed>, user_id: int, timestamp: int}
2727
*/
2828
class WP_Collaboration_Table_Storage {
2929
/**
@@ -225,7 +225,7 @@ public function get_updates_after_cursor( string $room, int $cursor ): array {
225225
*/
226226

227227
// Snapshot the current max ID and total row count in a single query.
228-
/** @var object{ max_id: int, total: int } $snapshot */
228+
/** @var object{ max_id: string, total: string } $snapshot */
229229
$snapshot = $wpdb->get_row(
230230
$wpdb->prepare(
231231
"SELECT COALESCE( MAX( collaboration_id ), 0 ) AS max_id, COUNT(*) AS total FROM {$wpdb->collaboration} WHERE room = %s AND type != 'awareness'",
@@ -398,6 +398,7 @@ public function set_awareness_state( string $room, string $client_id, array $sta
398398
*
399399
* In the event of a race condition, the latest row will be returned as the update target.
400400
*/
401+
/** @var object{ collaboration_id: string, date_gmt: string, data: string }|null $exists */
401402
$exists = $wpdb->get_row(
402403
$wpdb->prepare(
403404
"SELECT collaboration_id, date_gmt, data FROM {$wpdb->collaboration} WHERE room = %s AND type = 'awareness' AND client_id = %s ORDER BY collaboration_id DESC LIMIT 1",

0 commit comments

Comments
 (0)