Skip to content

Commit 80d0130

Browse files
committed
Fix PHPStan error
1 parent 36fd613 commit 80d0130

1 file changed

Lines changed: 6 additions & 3 deletions

File tree

src/Media_Command.php

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1140,7 +1140,7 @@ private function find_duplicate_attachment( $basename ) {
11401140
);
11411141
}
11421142

1143-
$query = new \WP_Query(
1143+
$posts = get_posts(
11441144
array(
11451145
'post_type' => 'attachment',
11461146
'post_status' => 'any',
@@ -1153,8 +1153,11 @@ private function find_duplicate_attachment( $basename ) {
11531153
)
11541154
);
11551155

1156-
$posts = $query->posts;
1157-
return ! empty( $posts ) ? (int) $posts[0] : false;
1156+
if ( empty( $posts ) ) {
1157+
return false;
1158+
}
1159+
1160+
return $posts[0];
11581161
}
11591162

11601163
/**

0 commit comments

Comments
 (0)