diff --git a/build/followers/render.php b/build/followers/render.php index bcc5cbcfbd..cb0e8e3a09 100644 --- a/build/followers/render.php +++ b/build/followers/render.php @@ -64,9 +64,7 @@ function ( $follower ) { return array( 'handle' => '@' . $username, 'icon' => $actor->get_icon(), - // phpcs:ignore Universal.Operators.DisallowShortTernary.Found 'name' => $actor->get_name() ?: $username, - // phpcs:ignore Universal.Operators.DisallowShortTernary.Found 'url' => object_to_uri( $actor->get_url() ) ?: $actor->get_id(), ); }, diff --git a/includes/class-avatars.php b/includes/class-avatars.php index ce7fceca3d..19aefe78c6 100644 --- a/includes/class-avatars.php +++ b/includes/class-avatars.php @@ -43,7 +43,7 @@ public static function pre_get_avatar_data( $args, $id_or_email ) { * @param array $allowed_comment_types Array of allowed comment types. */ $allowed_comment_types = \apply_filters( 'get_avatar_comment_types', array( 'comment' ) ); - if ( ! \in_array( $id_or_email->comment_type ?: 'comment', $allowed_comment_types, true ) ) { // phpcs:ignore Universal.Operators.DisallowShortTernary + if ( ! \in_array( $id_or_email->comment_type ?: 'comment', $allowed_comment_types, true ) ) { return $args; } diff --git a/includes/class-moderation.php b/includes/class-moderation.php index 0ba86f8b4d..c17f8cd412 100644 --- a/includes/class-moderation.php +++ b/includes/class-moderation.php @@ -116,7 +116,7 @@ public static function add_user_block( $user_id, $type, $value ) { case self::TYPE_DOMAIN: case self::TYPE_KEYWORD: - $blocks = \get_user_meta( $user_id, self::USER_META_KEYS[ $type ], true ) ?: array(); // phpcs:ignore Universal.Operators.DisallowShortTernary.Found + $blocks = \get_user_meta( $user_id, self::USER_META_KEYS[ $type ], true ) ?: array(); if ( ! \in_array( $value, $blocks, true ) ) { /** @@ -152,7 +152,7 @@ public static function remove_user_block( $user_id, $type, $value ) { case self::TYPE_DOMAIN: case self::TYPE_KEYWORD: - $blocks = \get_user_meta( $user_id, self::USER_META_KEYS[ $type ], true ) ?: array(); // phpcs:ignore Universal.Operators.DisallowShortTernary.Found + $blocks = \get_user_meta( $user_id, self::USER_META_KEYS[ $type ], true ) ?: array(); $key = \array_search( $value, $blocks, true ); if ( false !== $key ) { @@ -183,8 +183,8 @@ public static function remove_user_block( $user_id, $type, $value ) { public static function get_user_blocks( $user_id ) { return array( 'actors' => \wp_list_pluck( Blocked_Actors::get_many( $user_id ), 'guid' ), - 'domains' => \get_user_meta( $user_id, self::USER_META_KEYS[ self::TYPE_DOMAIN ], true ) ?: array(), // phpcs:ignore Universal.Operators.DisallowShortTernary.Found - 'keywords' => \get_user_meta( $user_id, self::USER_META_KEYS[ self::TYPE_KEYWORD ], true ) ?: array(), // phpcs:ignore Universal.Operators.DisallowShortTernary.Found + 'domains' => \get_user_meta( $user_id, self::USER_META_KEYS[ self::TYPE_DOMAIN ], true ) ?: array(), + 'keywords' => \get_user_meta( $user_id, self::USER_META_KEYS[ self::TYPE_KEYWORD ], true ) ?: array(), ); } diff --git a/includes/class-move.php b/includes/class-move.php index 0cd538979b..c7afca6461 100644 --- a/includes/class-move.php +++ b/includes/class-move.php @@ -172,7 +172,6 @@ public static function internally( $from, $to ) { * @param string $from The current account URL. */ private static function update_user_also_known_as( $user_id, $from ) { - // phpcs:ignore Universal.Operators.DisallowShortTernary.Found $also_known_as = \get_user_option( 'activitypub_also_known_as', $user_id ) ?: array(); $also_known_as[] = $from; diff --git a/includes/collection/class-inbox.php b/includes/collection/class-inbox.php index b57f90aa25..c88639438b 100644 --- a/includes/collection/class-inbox.php +++ b/includes/collection/class-inbox.php @@ -143,11 +143,9 @@ private static function get_object_title( $activity_object ) { return $post_id ? \get_the_title( $post_id ) : ''; } - // phpcs:ignore Universal.Operators.DisallowShortTernary.Found $title = $activity_object->get_name() ?: $activity_object->get_content(); if ( ! $title && $activity_object->get_object() instanceof Base_Object ) { - // phpcs:ignore Universal.Operators.DisallowShortTernary.Found $title = $activity_object->get_object()->get_name() ?: $activity_object->get_object()->get_content(); } diff --git a/includes/collection/class-outbox.php b/includes/collection/class-outbox.php index 1d2d063265..2864335780 100644 --- a/includes/collection/class-outbox.php +++ b/includes/collection/class-outbox.php @@ -385,11 +385,9 @@ private static function get_object_title( $activity_object ) { return $post_id ? get_the_title( $post_id ) : ''; } - // phpcs:ignore Universal.Operators.DisallowShortTernary.Found $title = $activity_object->get_name() ?: $activity_object->get_content(); if ( ! $title && $activity_object->get_object() instanceof Base_Object ) { - // phpcs:ignore Universal.Operators.DisallowShortTernary.Found $title = $activity_object->get_object()->get_name() ?: $activity_object->get_object()->get_content(); } diff --git a/includes/collection/class-remote-actors.php b/includes/collection/class-remote-actors.php index e0172be089..c63ae2fa54 100644 --- a/includes/collection/class-remote-actors.php +++ b/includes/collection/class-remote-actors.php @@ -527,7 +527,6 @@ private static function prepare_custom_post_type( $actor ) { return array( 'guid' => \esc_url_raw( $actor->get_id() ), - // phpcs:ignore Universal.Operators.DisallowShortTernary.Found 'post_title' => \wp_strip_all_tags( \wp_slash( $actor->get_name() ?: $actor->get_preferred_username() ) ), 'post_author' => 0, 'post_type' => self::POST_TYPE, diff --git a/includes/model/class-user.php b/includes/model/class-user.php index 92e820ab38..a987d5b8fd 100644 --- a/includes/model/class-user.php +++ b/includes/model/class-user.php @@ -452,7 +452,6 @@ public function get_also_known_as() { $this->get_alternate_url(), ); - // phpcs:ignore Universal.Operators.DisallowShortTernary.Found $also_known_as = array_merge( $also_known_as, \get_user_option( 'activitypub_also_known_as', $this->_id ) ?: array() ); return array_unique( $also_known_as ); diff --git a/includes/transformer/class-post.php b/includes/transformer/class-post.php index e6a2cf7b94..cf0bd96dcc 100644 --- a/includes/transformer/class-post.php +++ b/includes/transformer/class-post.php @@ -891,7 +891,7 @@ protected function get_context() { */ protected function get_post_content_template() { $content = \get_option( 'activitypub_custom_post_content', ACTIVITYPUB_CUSTOM_POST_CONTENT ); - $template = $content ?: ACTIVITYPUB_CUSTOM_POST_CONTENT; // phpcs:ignore Universal.Operators.DisallowShortTernary.Found + $template = $content ?: ACTIVITYPUB_CUSTOM_POST_CONTENT; $post_format_setting = \get_option( 'activitypub_object_type', ACTIVITYPUB_DEFAULT_OBJECT_TYPE ); $type = $this->get_type(); diff --git a/includes/wp-admin/table/class-blocked-actors.php b/includes/wp-admin/table/class-blocked-actors.php index 0228bbc2e9..1118bc6392 100644 --- a/includes/wp-admin/table/class-blocked-actors.php +++ b/includes/wp-admin/table/class-blocked-actors.php @@ -231,10 +231,8 @@ public function prepare_items() { $this->items[] = array( 'id' => $blocked_actor_post->ID, 'icon' => object_to_uri( $actor->get_icon() ?? ACTIVITYPUB_PLUGIN_URL . 'assets/img/mp.jpg' ), - // phpcs:ignore Universal.Operators.DisallowShortTernary.Found 'post_title' => $actor->get_name() ?: $actor->get_preferred_username(), 'username' => $actor->get_preferred_username(), - // phpcs:ignore Universal.Operators.DisallowShortTernary.Found 'url' => object_to_uri( $actor->get_url() ?: $actor->get_id() ), 'webfinger' => Remote_Actors::get_acct( $blocked_actor_post->ID ), 'identifier' => $actor->get_id(), diff --git a/includes/wp-admin/table/class-followers.php b/includes/wp-admin/table/class-followers.php index 9f5914910c..196e74bbc5 100644 --- a/includes/wp-admin/table/class-followers.php +++ b/includes/wp-admin/table/class-followers.php @@ -283,10 +283,8 @@ public function prepare_items() { $this->items[] = array( 'id' => $follower->ID, 'icon' => object_to_uri( $actor->get_icon() ?? ACTIVITYPUB_PLUGIN_URL . 'assets/img/mp.jpg' ), - // phpcs:ignore Universal.Operators.DisallowShortTernary.Found 'post_title' => $actor->get_name() ?: $actor->get_preferred_username(), 'username' => $actor->get_preferred_username(), - // phpcs:ignore Universal.Operators.DisallowShortTernary.Found 'url' => object_to_uri( $actor->get_url() ?: $actor->get_id() ), 'webfinger' => Remote_Actors::get_acct( $follower->ID ), 'identifier' => $actor->get_id(), diff --git a/includes/wp-admin/table/class-following.php b/includes/wp-admin/table/class-following.php index 2e5dbf0db6..9a653b7396 100644 --- a/includes/wp-admin/table/class-following.php +++ b/includes/wp-admin/table/class-following.php @@ -251,10 +251,8 @@ public function prepare_items() { $this->items[] = array( 'id' => $following->ID, 'icon' => object_to_uri( $actor->get_icon() ?? ACTIVITYPUB_PLUGIN_URL . 'assets/img/mp.jpg' ), - // phpcs:ignore Universal.Operators.DisallowShortTernary.Found 'post_title' => $actor->get_name() ?: $actor->get_preferred_username(), 'username' => $actor->get_preferred_username(), - // phpcs:ignore Universal.Operators.DisallowShortTernary.Found 'url' => object_to_uri( $actor->get_url() ?: $actor->get_id() ), 'webfinger' => Remote_Actors::get_acct( $following->ID ), 'status' => Following_Collection::check_status( $this->user_id, $following->ID ), diff --git a/integration/class-classic-editor.php b/integration/class-classic-editor.php index a25f3b746c..b7260bb90f 100644 --- a/integration/class-classic-editor.php +++ b/integration/class-classic-editor.php @@ -131,7 +131,7 @@ public static function render_meta_box( $post ) { $content_warning = \get_post_meta( $post->ID, 'activitypub_content_warning', true ); $max_image_attachments = \get_post_meta( $post->ID, 'activitypub_max_image_attachments', true ); $content_visibility = self::get_default_visibility( $post ); - $quote_interaction = \get_post_meta( $post->ID, 'activitypub_interaction_policy_quote', true ) ?: ACTIVITYPUB_INTERACTION_POLICY_ANYONE; // phpcs:ignore Universal.Operators.DisallowShortTernary + $quote_interaction = \get_post_meta( $post->ID, 'activitypub_interaction_policy_quote', true ) ?: ACTIVITYPUB_INTERACTION_POLICY_ANYONE; ?>
diff --git a/integration/class-wp-rest-cache.php b/integration/class-wp-rest-cache.php
index b7b987feb7..464cf66a6e 100644
--- a/integration/class-wp-rest-cache.php
+++ b/integration/class-wp-rest-cache.php
@@ -126,7 +126,7 @@ public static function transition_comment_status( $new_status, $old_status, $com
$comment_types = Comment::get_comment_type_slugs();
$comment_types[] = 'comment';
- if ( ! \in_array( $comment->comment_type ?: 'comment', $comment_types, true ) ) { // phpcs:ignore Universal.Operators.DisallowShortTernary
+ if ( ! \in_array( $comment->comment_type ?: 'comment', $comment_types, true ) ) {
return;
}
diff --git a/phpcs.xml b/phpcs.xml
index 48e03d9f31..16df9a6561 100644
--- a/phpcs.xml
+++ b/phpcs.xml
@@ -14,14 +14,14 @@