fix(ns): root-qualify WP_* classes after PSR-4 move
Bare WP_REST_Server etc. resolve under AKSRT\* namespaces; prefix with \ for Balance REST and other type hints / constructors.
This commit is contained in:
1 parent
d3107a449b
commit
1e21911b03
9 files changed
+27
-27
No files matched your search
@@ -124,7 +124,7 @@ class CommentController extends ControllerBase {
|
||||
$args['search'] = $search;
|
||||
}
|
||||
|
||||
$query = new WP_Comment_Query($args);
|
||||
$query = new \WP_Comment_Query($args);
|
||||
|
||||
// Batch prefetch to avoid N+1 queries
|
||||
$user_ids = array_unique(array_filter(array_map(fn($c) => (int) $c->user_id, $query->comments)));
|
||||
@@ -151,7 +151,7 @@ class CommentController extends ControllerBase {
|
||||
$count_args = $args;
|
||||
unset($count_args['number'], $count_args['offset'], $count_args['orderby'], $count_args['order']);
|
||||
$count_args['count'] = true;
|
||||
$total = (int) (new WP_Comment_Query($count_args))->get_comments('count');
|
||||
$total = (int) (new \WP_Comment_Query($count_args))->get_comments('count');
|
||||
|
||||
return $this->success([
|
||||
'data' => $comments,
|
||||
@@ -341,7 +341,7 @@ class CommentController extends ControllerBase {
|
||||
'hierarchical' => 'threaded',
|
||||
];
|
||||
|
||||
$query = new WP_Comment_Query($args);
|
||||
$query = new \WP_Comment_Query($args);
|
||||
|
||||
// Batch prefetch users
|
||||
$user_ids = array_unique(array_filter(array_map(fn($c) => (int) $c->user_id, $query->comments)));
|
||||
@@ -374,7 +374,7 @@ class CommentController extends ControllerBase {
|
||||
/**
|
||||
* Format comment for admin views.
|
||||
*/
|
||||
private function format_comment(WP_Comment $comment, array $users_map = [], array $posts_map = []): array {
|
||||
private function format_comment(\WP_Comment $comment, array $users_map = [], array $posts_map = []): array {
|
||||
$uid = (int) $comment->user_id;
|
||||
$pid = (int) $comment->comment_post_ID;
|
||||
$user = $users_map[$uid] ?? ($uid ? get_userdata($uid) : null);
|
||||
@@ -398,7 +398,7 @@ class CommentController extends ControllerBase {
|
||||
/**
|
||||
* Format comment for public views (no email/IP).
|
||||
*/
|
||||
private function format_comment_public(WP_Comment $comment, array $users_map = []): array {
|
||||
private function format_comment_public(\WP_Comment $comment, array $users_map = []): array {
|
||||
$uid = (int) $comment->user_id;
|
||||
$user = $users_map[$uid] ?? ($uid ? get_userdata($uid) : null);
|
||||
return [
|
||||
|
||||
Reference in new issue
Block a user