Skip to content

Commit 3d55d27

Browse files
committed
Improvements from static analysis
1 parent 466a3f4 commit 3d55d27

File tree

3 files changed

+4
-5
lines changed

3 files changed

+4
-5
lines changed

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

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -190,7 +190,7 @@ public function check_permissions( WP_REST_Request $request ) {
190190

191191
$entity_kind = $type_parts[0];
192192
$entity_name = $object_parts[0];
193-
$object_id = isset( $object_parts[1] ) ? (int) $object_parts[1] : null;
193+
$object_id = $object_parts[1] ?? null;
194194

195195
if ( ! $this->can_user_sync_entity_type( $entity_kind, $entity_name, $object_id ) ) {
196196
return new WP_Error(
@@ -411,7 +411,6 @@ private function process_sync_update( string $room, int $client_id, int $cursor,
411411
* All updates are stored persistently.
412412
*/
413413
return $this->add_update( $room, $client_id, $type, $data );
414-
break;
415414
}
416415

417416
return new WP_Error(
@@ -430,7 +429,7 @@ private function process_sync_update( string $room, int $client_id, int $cursor,
430429
* @param int $client_id Client identifier.
431430
* @param string $type Update type (sync_step1, sync_step2, update, compaction).
432431
* @param string $data Base64-encoded update data.
433-
* @return bool|WP_Error True on success, WP_Error on storage failure.
432+
* @return true|WP_Error True on success, WP_Error on storage failure.
434433
*/
435434
private function add_update( string $room, int $client_id, string $type, string $data ) {
436435
$update = array(

src/wp-includes/collaboration/class-wp-sync-post-meta-storage.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -264,7 +264,7 @@ public function get_update_count( string $room ): int {
264264
*
265265
* @param string $room Room identifier.
266266
* @param int $cursor Return updates after this cursor.
267-
* @return array Sync updates.
267+
* @return array<int, mixed> Sync updates.
268268
*/
269269
public function get_updates_after_cursor( string $room, int $cursor ): array {
270270
$all_updates = $this->get_all_updates( $room );

src/wp-includes/collaboration/interface-wp-sync-storage.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,7 @@ public function get_update_count( string $room ): int;
5858
*
5959
* @param string $room Room identifier.
6060
* @param int $cursor Return updates after this cursor.
61-
* @return array Sync updates.
61+
* @return array<int, mixed> Sync updates.
6262
*/
6363
public function get_updates_after_cursor( string $room, int $cursor ): array;
6464

0 commit comments

Comments
 (0)