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:
kate522 committed 2026-07-17 15:12:14 +08:00
1 parent d3107a449b
commit 1e21911b03
9 files changed
+27 -27

No files matched your search

+4 -4
View File
@@ -101,8 +101,8 @@ class Earn {
if ($on_approved) {
return;
}
$comment = $comment instanceof WP_Comment ? $comment : get_comment($comment_id);
if (!($comment instanceof WP_Comment) || (int) $comment->comment_approved !== 1) {
$comment = $comment instanceof \WP_Comment ? $comment : get_comment($comment_id);
if (!($comment instanceof \WP_Comment) || (int) $comment->comment_approved !== 1) {
return;
}
$this->reward_comment($comment);
@@ -110,13 +110,13 @@ class Earn {
public function on_comment_transition($new_status, $old_status, $comment): void {
unset($old_status);
if ($new_status !== 'approved' || !($comment instanceof WP_Comment)) {
if ($new_status !== 'approved' || !($comment instanceof \WP_Comment)) {
return;
}
$this->reward_comment($comment);
}
private function reward_comment(WP_Comment $comment): void {
private function reward_comment(\WP_Comment $comment): void {
$user_id = (int) $comment->user_id;
if ($user_id <= 0 || !class_exists('PointsFree')) {
return;