Merge pull request 'Check PHPStan in addons' (#1592) from Art4/friendica-addons:fix-phpstan-error into develop

Reviewed-on: https://git.friendi.ca/friendica/friendica-addons/pulls/1592
Reviewed-by: Hypolite Petovan <hypolite@mrpetovan.com>
develop
Hypolite Petovan 2025-01-23 14:29:59 +01:00
commit 69e75ef88b
2 changed files with 10 additions and 6 deletions

View File

@ -56,6 +56,10 @@ steps:
- /tmp/drone-cache:/tmp/cache - /tmp/drone-cache:/tmp/cache
when: when:
event: pull_request event: pull_request
phpstan:
image: friendicaci/php8.3:php8.3.3
commands:
- ./bin/composer.phar run phpstan;
check: check:
image: friendicaci/php-cs image: friendicaci/php-cs
commands: commands:

View File

@ -231,13 +231,13 @@ FROM (
$reply_guy_result = $this->getReplyGuyRow($user['user_contact_uid']); $reply_guy_result = $this->getReplyGuyRow($user['user_contact_uid']);
if (DBA::isResult($reply_guy_result)) { if (DBA::isResult($reply_guy_result)) {
$reply_guy_result_row = DBA::fetch($reply_guy_result); $reply_guy_result_row = DBA::fetch($reply_guy_result);
$user['reply_count'] = $reply_guy_result_row['replies_total'] ?? 0; $user['reply_count'] = (int) $reply_guy_result_row['replies_total'] ?? 0;
$user['reply_likes'] = $reply_guy_result_row['like_total'] ?? 0; $user['reply_likes'] = (int) $reply_guy_result_row['like_total'] ?? 0;
$user['reply_respondee_likes'] = $reply_guy_result_row['target_like_total'] ?? 0; $user['reply_respondee_likes'] = (int) $reply_guy_result_row['target_like_total'] ?? 0;
$user['reply_op_likes'] = $reply_guy_result_row['original_like_total'] ?? 0; $user['reply_op_likes'] = (int) $reply_guy_result_row['original_like_total'] ?? 0;
$denominator = intval($user['reply_likes']) + intval($user['reply_respondee_likes']) + intval($user['reply_op_likes']); $denominator = $user['reply_likes'] + $user['reply_respondee_likes'] + $user['reply_op_likes'];
if ($user['reply_count'] == 0) { if ($user['reply_count'] === 0) {
$user['reply_guy'] = false; $user['reply_guy'] = false;
$user['reply_guy_score'] = 0; $user['reply_guy_score'] = 0;
} elseif ($denominator == 0) { } elseif ($denominator == 0) {