Skip to content

Commit e23c833

Browse files
Fix. Code. Psalm errors fixed (#787)
* Fix. Psalm error fix * Fix. Psalm error fix --------- Co-authored-by: datorik <datorik@gmail.com>
1 parent 9a4535e commit e23c833

4 files changed

Lines changed: 6 additions & 9 deletions

File tree

cleantalk.php

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -2136,7 +2136,7 @@ function apbct_rc__install_plugin($_wp = null, $plugin = null)
21362136
die(
21372137
'FAIL ' . json_encode(array(
21382138
'error' => 'FAIL_TO_GET_LATEST_VERSION',
2139-
'details' => $result instanceof WP_Error ? $result->get_error_message() : '',
2139+
'details' => $result->get_error_message(),
21402140
))
21412141
);
21422142
}
@@ -2170,12 +2170,9 @@ function apbct_rc__activate_plugin($plugin)
21702170
$result = activate_plugins($plugin);
21712171

21722172
$result_array = array('success' => true);
2173-
$error_msg = '';
21742173

21752174
if (!$result || is_wp_error($result)) {
2176-
if ($result instanceof WP_Error) {
2177-
$error_msg = ' ' . $result->get_error_message();
2178-
}
2175+
$error_msg = ' ' . $result->get_error_message();
21792176
$result_array = array(
21802177
'error' => 'FAIL_TO_ACTIVATE',
21812178
'details' => $error_msg
@@ -2293,7 +2290,7 @@ function apbct_rc__uninstall_plugin($plugin = null)
22932290
$error_msg = '';
22942291

22952292
if (!$result || is_wp_error($result)) {
2296-
if ($result instanceof WP_Error) {
2293+
if (is_wp_error($result) && $result->get_error_message()) {
22972294
$error_msg = ' ' . $result->get_error_message();
22982295
}
22992296
$die_string = 'FAIL ' . json_encode(array(

lib/Cleantalk/ApbctWP/FindSpam/ListTable/BadUsers.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ public function prepare_items() // phpcs:ignore PSR1.Methods.CamelCapsMethodNam
2121

2222
$current_screen = get_current_screen();
2323
$per_page_option = !is_null($current_screen)
24-
? $current_screen->get_option('per_page', 'option')
24+
? ($current_screen->get_option('per_page', 'option') ?? '10')
2525
: '10';
2626
$per_page = get_user_meta(get_current_user_id(), $per_page_option, true);
2727
if ( ! $per_page ) {

lib/Cleantalk/ApbctWP/FindSpam/ListTable/CommentsScan.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ public function prepare_items() // phpcs:ignore PSR1.Methods.CamelCapsMethodName
1111

1212
$current_screen = get_current_screen();
1313
$per_page_option = !is_null($current_screen)
14-
? $current_screen->get_option('per_page', 'option')
14+
? ($current_screen->get_option('per_page', 'option') ?? '10')
1515
: '10';
1616
$per_page = get_user_meta(get_current_user_id(), $per_page_option, true);
1717
if ( ! $per_page ) {

lib/Cleantalk/ApbctWP/FindSpam/ListTable/UsersScan.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ public function prepare_items() // phpcs:ignore PSR1.Methods.CamelCapsMethodName
1010
{
1111
$current_screen = get_current_screen();
1212
$per_page_option = !is_null($current_screen)
13-
? $current_screen->get_option('per_page', 'option')
13+
? ($current_screen->get_option('per_page', 'option') ?? '10')
1414
: '10';
1515
$per_page = get_user_meta(get_current_user_id(), $per_page_option, true);
1616
if ( ! $per_page ) {

0 commit comments

Comments
 (0)