Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion includes/class-avatars.php
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}

Expand Down
8 changes: 4 additions & 4 deletions includes/class-moderation.php
Original file line number Diff line number Diff line change
Expand Up @@ -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 ) ) {
/**
Expand Down Expand Up @@ -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 ) {
Expand Down Expand Up @@ -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(),
);
}

Expand Down
1 change: 0 additions & 1 deletion includes/class-move.php
Original file line number Diff line number Diff line change
Expand Up @@ -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;

Expand Down
2 changes: 0 additions & 2 deletions includes/collection/class-inbox.php
Original file line number Diff line number Diff line change
Expand Up @@ -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();
}

Expand Down
1 change: 0 additions & 1 deletion includes/model/class-user.php
Original file line number Diff line number Diff line change
Expand Up @@ -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 );
Expand Down
2 changes: 1 addition & 1 deletion includes/transformer/class-post.php
Original file line number Diff line number Diff line change
Expand Up @@ -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();
Expand Down
2 changes: 1 addition & 1 deletion integration/class-classic-editor.php
Original file line number Diff line number Diff line change
Expand Up @@ -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;

?>
<p>
Expand Down
2 changes: 1 addition & 1 deletion integration/class-wp-rest-cache.php
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}

Expand Down
5 changes: 5 additions & 0 deletions phpcs.xml
Original file line number Diff line number Diff line change
Expand Up @@ -31,4 +31,9 @@
</property>
</properties>
</rule>

<!-- Allow short ternary operators (Elvis operator) -->
<rule ref="WordPress">
<exclude name="Universal.Operators.DisallowShortTernary" />
</rule>
</ruleset>
Loading