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
3 changes: 2 additions & 1 deletion classes/controllers/FrmDashboardController.php
Original file line number Diff line number Diff line change
Expand Up @@ -467,7 +467,7 @@ private static function inbox_clean_messages_cta( $cta ) {
/**
* Get the embed YouTube video from YouTube feed api. If there are 0 entries we show the welcome video otherwise latest video from FF YouTube channel is displayed.
*
* @param int $entries_count The total entries available.
* @param int|string $entries_count The total entries available.
*
* @return string|null The YouTube video ID.
*/
Expand All @@ -488,6 +488,7 @@ private static function get_youtube_embed_video( $entries_count ) {
if ( isset( $featured_video[0] ) ) {
return $featured_video[0]['video-id'];
}

return $featured_video['video-id'] ?? null;
}

Expand Down
6 changes: 3 additions & 3 deletions classes/controllers/FrmFormsController.php
Original file line number Diff line number Diff line change
Expand Up @@ -1291,9 +1291,9 @@ public static function hidden_columns( $hidden_columns ) {
}

/**
* @param mixed $save
* @param string $option
* @param int $value
* @param mixed $save
* @param string $option
* @param int|string $value
*
* @return mixed
*/
Expand Down
13 changes: 10 additions & 3 deletions classes/controllers/FrmXMLController.php
Original file line number Diff line number Diff line change
Expand Up @@ -460,8 +460,8 @@ public static function export_xml() {
}

/**
* @param string[] $type
* @param array $args
* @param array<string>|string $type
* @param array $args
*
* @psalm-param array{ids?: mixed} $args
*
Expand All @@ -472,6 +472,13 @@ public static function generate_xml( $type, $args = array() ) {

self::prepare_types_array( $type );

if ( ! is_array( $type ) ) {
// This shouldn't be possible.
// It is cast to array in prepare_types_array.
// This is just for static analysis.
return;
}

$tables = array(
'items' => $wpdb->prefix . 'frm_items',
'forms' => $wpdb->prefix . 'frm_forms',
Expand Down Expand Up @@ -608,7 +615,7 @@ public static function get_parent_terms_slugs( $terms ) {
/**
* Prepare the types array.
*
* @param array $type
* @param array<string>|string $type
*
* @return void
*/
Expand Down
8 changes: 4 additions & 4 deletions classes/helpers/FrmAppHelper.php
Original file line number Diff line number Diff line change
Expand Up @@ -2892,10 +2892,10 @@ public static function setup_edit_vars( $record, $table, $fields = '', $default
}

/**
* @param array $fields
* @param object $record
* @param array $values
* @param array $args
* @param array|string $fields
* @param object $record
* @param array $values
* @param array $args
*
* @return void
*/
Expand Down
2 changes: 1 addition & 1 deletion classes/helpers/FrmEntriesHelper.php
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ class FrmEntriesHelper {
const DRAFT_ENTRY_STATUS = 1;

/**
* @param array $fields
* @param mixed $fields
* @param object|string $form
* @param bool $reset
* @param array $args
Expand Down
6 changes: 3 additions & 3 deletions classes/helpers/FrmStylesHelper.php
Original file line number Diff line number Diff line change
Expand Up @@ -759,9 +759,9 @@ function ( $key ) use ( $defaults, $font_size, $base_font_size, &$settings ) {
*
* @since 6.14
*
* @param string $key Setting key.
* @param int $value Base font size value.
* @param array $defaults Default style settings.
* @param string $key Setting key.
* @param int|string $value Base font size value.
* @param array $defaults Default style settings.
*
* @return float
*/
Expand Down
4 changes: 2 additions & 2 deletions classes/helpers/FrmXMLHelper.php
Original file line number Diff line number Diff line change
Expand Up @@ -773,8 +773,8 @@ private static function migrate_placeholders( &$f ) {
*
* @since 4.0
*
* @param array $field
* @param string $type
* @param array|object $field
* @param string $type
*
* @return array
*/
Expand Down
3 changes: 2 additions & 1 deletion classes/models/FrmAddon.php
Original file line number Diff line number Diff line change
Expand Up @@ -742,7 +742,8 @@ private function last_checked() {
// Get string into array for existing values.
$last_checked = array( 'time' => $last_checked );
}
return $last_checked ? (array) $last_checked : array();

return $last_checked ? $last_checked : array();
}

/**
Expand Down
4 changes: 2 additions & 2 deletions classes/models/FrmDb.php
Original file line number Diff line number Diff line change
Expand Up @@ -677,8 +677,8 @@ public static function prepend_and_or_where( $starts_with = ' WHERE ', $where =
*
* @since 2.05.06
*
* @param array $settings
* @param string $group
* @param array|object $settings
* @param string $group
*
* @return int|WP_Error
*/
Expand Down
22 changes: 11 additions & 11 deletions classes/models/FrmEntry.php
Original file line number Diff line number Diff line change
Expand Up @@ -721,7 +721,7 @@ public static function getAll( $where, $order_by = '', $limit = '', $meta = fals
}

/**
* @param int $field_id
* @param int|string $field_id
*
* @return string
*/
Expand Down Expand Up @@ -1052,7 +1052,7 @@ private static function insert_entry_into_database( $new_values ) {
*
* @since 2.0.16
*
* @param int $entry_id
* @param int|string $entry_id
*
* @return void
*/
Expand All @@ -1071,8 +1071,8 @@ private static function add_new_entry_to_frm_vars( $entry_id ) {
*
* @since 2.0.16
*
* @param array $values
* @param int $entry_id
* @param array $values
* @param int|string $entry_id
*
* @return void
*/
Expand Down Expand Up @@ -1170,9 +1170,9 @@ private static function after_insert_entry_in_database( $values, $new_values, $e
*
* @since 2.0.16
*
* @param int $id
* @param array $values
* @param string $update_type
* @param int|string $id
* @param array $values
* @param string $update_type
*
* @return bool $update
*/
Expand Down Expand Up @@ -1239,10 +1239,10 @@ private static function package_entry_to_update( $id, $values ) {
*
* @since 2.0.16
*
* @param bool|int $query_results
* @param int $id
* @param array $values
* @param array $new_values
* @param bool|int $query_results
* @param int|string $id
* @param array $values
* @param array $new_values
*
* @return void
*/
Expand Down
2 changes: 1 addition & 1 deletion classes/models/FrmEntryMeta.php
Original file line number Diff line number Diff line change
Expand Up @@ -392,7 +392,7 @@ public static function get_entry_meta_info( $entry_id ) {
* @param string $limit
* @param bool $stripslashes
*
* @return array
* @return mixed
*/
public static function getAll( $where = array(), $order_by = '', $limit = '', $stripslashes = false ) {
global $wpdb;
Expand Down
2 changes: 1 addition & 1 deletion classes/models/FrmFieldFormHtml.php
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ class FrmFieldFormHtml {
private $field_id;

/**
* @var array
* @var array|object
*/
private $form = array();

Expand Down
2 changes: 1 addition & 1 deletion classes/models/FrmFieldOption.php
Original file line number Diff line number Diff line change
Expand Up @@ -93,7 +93,7 @@ public function print_single_option( $selected_value, $truncate, $use_value_as_l
}

if ( $use_value_as_label && '' === trim( $this->option_label ) ) {
$label = '' !== (string) $this->saved_value ? $this->saved_value : FrmAppHelper::get_no_label_text();
$label = '' !== $this->saved_value ? $this->saved_value : FrmAppHelper::get_no_label_text();
} else {
$label = $this->option_label;
}
Expand Down
4 changes: 2 additions & 2 deletions classes/models/FrmForm.php
Original file line number Diff line number Diff line change
Expand Up @@ -831,7 +831,7 @@ public static function get_id_by_key( $key ) {
/**
* @since 3.0
*
* @param int $id
* @param int|string $id
*
* @return string form key
*/
Expand Down Expand Up @@ -1007,7 +1007,7 @@ public static function get_count() {
return $counts;
}

$results = (array) FrmDb::get_results(
$results = FrmDb::get_results(
'frm_forms',
array(
'or' => 1,
Expand Down
2 changes: 1 addition & 1 deletion classes/models/FrmMigrate.php
Original file line number Diff line number Diff line change
Expand Up @@ -554,7 +554,7 @@ private function migrate_to_86() {

$fields = $this->get_fields_with_size();

foreach ( (array) $fields as $f ) {
foreach ( $fields as $f ) {
FrmAppHelper::unserialize_or_decode( $f->field_options );
$size = $f->field_options['size'];
$this->maybe_convert_migrated_size( $size );
Expand Down
2 changes: 1 addition & 1 deletion classes/models/FrmNotification.php
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@ private static function print_recipients( $atts ) {
$sent_to = array_filter( $sent_to );

$temp = str_replace( '<', '&lt;', $sent_to );
echo ' ' . FrmAppHelper::kses( implode( ', ', (array) $temp ) ); // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped
echo ' ' . FrmAppHelper::kses( implode( ', ', $temp ) ); // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped
}
}
}
8 changes: 4 additions & 4 deletions classes/models/FrmPersonalData.php
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,7 @@ public function export_data( $email, $page = 1 ) {
return $data_to_export;
}

foreach ( (array) $entries as $entry ) {
foreach ( $entries as $entry ) {
Comment thread
Crabcyborg marked this conversation as resolved.
$data_to_export['data'][] = array(
'group_id' => 'formidable',
'group_label' => __( 'Form Submissions', 'formidable' ),
Expand Down Expand Up @@ -117,7 +117,7 @@ public function erase_data( $email, $page = 1 ) {

// TODO: Add an option to anonymize the entries with wp_privacy_anonymize_data( 'email', 'e@e.com' );

foreach ( (array) $entries as $entry ) {
foreach ( $entries as $entry ) {
$removed = FrmEntry::destroy( $entry );

if ( $removed ) {
Expand All @@ -138,7 +138,7 @@ public function erase_data( $email, $page = 1 ) {
*
* @param string $email
*
* @return array of entry ids
* @return array Entry ids
*/
private function get_user_entries( $email ) {
$query_args = array(
Expand All @@ -159,7 +159,7 @@ private function get_user_entries( $email ) {

$entries_by_user = FrmDb::get_col( 'frm_items', array( 'user_id' => $user->ID ), 'id', $query_args );

$entry_ids = array_merge( (array) $entries_by_user, (array) $entries_by_email );
$entry_ids = array_merge( $entries_by_user, $entries_by_email );
Comment thread
Crabcyborg marked this conversation as resolved.
$entry_ids = array_unique( array_filter( $entry_ids ) );

return $entry_ids;
Expand Down
2 changes: 1 addition & 1 deletion classes/models/FrmStyle.php
Original file line number Diff line number Diff line change
Expand Up @@ -844,7 +844,7 @@ public function force_balanced_quotation( $value ) {
*
* @since 6.14
*
* @param int $style_id The post type "frm_styles" ID.
* @param int|string $style_id The post type "frm_styles" ID.
*
* @return string The json encoded template data
*/
Expand Down
3 changes: 1 addition & 2 deletions classes/models/FrmTableHTMLGenerator.php
Original file line number Diff line number Diff line change
Expand Up @@ -94,8 +94,7 @@ class FrmTableHTMLGenerator {
* @param array $atts
*/
public function __construct( $type, $atts = array() ) {

$this->type = (string) $type;
$this->type = $type;

if ( isset( $atts['cell_padding'] ) ) {
$this->cell_padding = $atts['cell_padding'];
Expand Down
2 changes: 1 addition & 1 deletion classes/models/fields/FrmFieldType.php
Original file line number Diff line number Diff line change
Expand Up @@ -166,7 +166,7 @@ protected function set_field_id() {
/**
* @param string $column
*
* @return array|string
* @return array|object|string
*/
public function get_field_column( $column ) {
$field_val = '';
Expand Down
2 changes: 1 addition & 1 deletion classes/widgets/FrmShowForm.php
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ public function form( $instance ) {
'form' => false,
'description' => false,
);
$instance = wp_parse_args( (array) $instance, $defaults );
$instance = wp_parse_args( $instance, $defaults );
?>
<p>
<label for="<?php echo esc_attr( $this->get_field_id( 'title' ) ); ?>">
Expand Down
1 change: 0 additions & 1 deletion phpstan.neon
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,6 @@ parameters:
strictRules:
disallowedLooseComparison: false
booleansInConditions: false
uselessCast: false
requireParentConstructorCall: false
strictCalls: false
noVariableVariables: false
Expand Down