Skip to content

Commit 33c8dd5

Browse files
committed
Add typing for Room request data
1 parent 9f3f6b9 commit 33c8dd5

1 file changed

Lines changed: 14 additions & 0 deletions

File tree

src/wp-includes/collaboration/class-wp-http-polling-collaboration-server.php

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,18 @@
1111
*
1212
* @since 7.0.0
1313
* @access private
14+
*
15+
* @phpstan-type Update array{
16+
* data: string,
17+
* type: 'compaction'|'sync_step1'|'sync_step2'|'update',
18+
* }
19+
* @phpstan-type Room array{
20+
* after: non-negative-int,
21+
* awareness: array<string, mixed>|null,
22+
* client_id: non-empty-string,
23+
* room: non-empty-string,
24+
* updates: Update[],
25+
* }
1426
*/
1527
class WP_HTTP_Polling_Collaboration_Server {
1628
/**
@@ -234,6 +246,7 @@ public function check_permissions( WP_REST_Request $request ) {
234246
);
235247
}
236248

249+
/** @var Room[] $rooms */
237250
$rooms = $request['rooms'];
238251
$wp_user_id = get_current_user_id();
239252

@@ -331,6 +344,7 @@ public function validate_request( WP_REST_Request $request ) {
331344
* @return WP_REST_Response|WP_Error Response object or error.
332345
*/
333346
public function handle_request( WP_REST_Request $request ) {
347+
/** @var Room[] $rooms */
334348
$rooms = $request['rooms'];
335349
$response = array(
336350
'rooms' => array(),

0 commit comments

Comments
 (0)