Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 10 additions & 7 deletions classes/helpers/FrmEntriesHelper.php
Original file line number Diff line number Diff line change
Expand Up @@ -878,17 +878,20 @@ public static function get_visible_unread_inbox_count() {
return 0;
}

if ( FrmAppHelper::pro_is_installed() && is_callable( 'FrmProAppHelper::get_settings' ) ) {
$settings = FrmProAppHelper::get_settings();
$inbox_badge_off = ! empty( $settings->inbox ) && ! isset( $settings->inbox['badge'] );
$inbox = new FrmInbox();
$inbox_count = count( $inbox->unread() );

if ( $inbox_badge_off ) {
// When the badge is disabled, the unread count is not included in the menu name.
if ( ! $inbox_count ) {
return 0;
}

if ( is_callable( 'FrmProSettingsController::inbox_badge' ) ) {
$inbox_count = FrmProSettingsController::inbox_badge( $inbox_count );
if ( ! $inbox_count ) {
return 0;
}
}

$inbox = new FrmInbox();
return count( $inbox->unread() );
return $inbox_count;
}
}
8 changes: 8 additions & 0 deletions stubs.php
Original file line number Diff line number Diff line change
Expand Up @@ -416,6 +416,14 @@ class FrmTransListsController {
public static function payment_columns( $columns = array() ) {
}
}
class FrmProSettingsController {
/**
* @param string $count
* @return string
*/
public static function inbox_badge( $count ) {
}
}
Comment on lines +419 to +426
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codebase verification

Type declarations in stubs.php should be updated to use integer types

The method signature in stubs.php should be changed to use int instead of string for both parameter and return types, as:

  • The method is called with an integer count from count($inbox->unread())
  • The return value is used in an integer context and returned by a method that declares @return int
🔗 Analysis chain

Verify the method signature.

The inbox_badge method signature indicates it takes a string parameter and returns a string, but it's being called with an integer in get_visible_unread_inbox_count. Please ensure the parameter and return type declarations match the actual usage.

Run the following script to verify the method usage:

🏁 Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# Description: Verify the usage of inbox_badge method.

# Test: Search for all calls to inbox_badge. Expect: Only occurrences of the new signature.
rg -A 5 $'inbox_badge'

Length of output: 1356


Script:

#!/bin/bash
# Find the context around $inbox_count in FrmEntriesHelper.php
rg -B 5 -A 5 "\$inbox_count" "classes/helpers/FrmEntriesHelper.php"

Length of output: 66


Script:

#!/bin/bash
# Find the complete method context in FrmEntriesHelper.php
rg -B 15 -A 15 "inbox_badge" "classes/helpers/FrmEntriesHelper.php"

Length of output: 623

}

namespace Elementor {
Expand Down