diff --git a/classes/controllers/FrmFormActionsController.php b/classes/controllers/FrmFormActionsController.php index 96d486b778..e55a7cc8f9 100644 --- a/classes/controllers/FrmFormActionsController.php +++ b/classes/controllers/FrmFormActionsController.php @@ -4,6 +4,10 @@ } class FrmFormActionsController { + + /** + * @var string + */ public static $action_post_type = 'frm_form_actions'; /** @@ -779,6 +783,10 @@ public static function prevent_wpml_translations( $null, $post_type ) { } class Frm_Form_Action_Factory { + + /** + * @var array + */ public $actions = array(); public function __construct() { diff --git a/classes/helpers/FrmEntriesListHelper.php b/classes/helpers/FrmEntriesListHelper.php index f1aafe9b3f..999ec0941f 100644 --- a/classes/helpers/FrmEntriesListHelper.php +++ b/classes/helpers/FrmEntriesListHelper.php @@ -5,9 +5,10 @@ class FrmEntriesListHelper extends FrmListHelper { + /** + * @var string|null + */ protected $column_name; - protected $item; - protected $field; /** * @since 4.07 diff --git a/classes/helpers/FrmFieldGridHelper.php b/classes/helpers/FrmFieldGridHelper.php index c36acd67ad..a42d5aaff2 100644 --- a/classes/helpers/FrmFieldGridHelper.php +++ b/classes/helpers/FrmFieldGridHelper.php @@ -5,6 +5,9 @@ class FrmFieldGridHelper { + /** + * @var bool|string + */ private $parent_li; /** @@ -52,6 +55,9 @@ class FrmFieldGridHelper { */ private $section_size; + /** + * @var bool + */ private $section_is_open = false; /** diff --git a/classes/helpers/FrmFormsListHelper.php b/classes/helpers/FrmFormsListHelper.php index 70ba176f13..805799d5ae 100644 --- a/classes/helpers/FrmFormsListHelper.php +++ b/classes/helpers/FrmFormsListHelper.php @@ -4,6 +4,10 @@ } class FrmFormsListHelper extends FrmListHelper { + + /** + * @var string + */ public $status = ''; public $total_items = 0; diff --git a/classes/helpers/FrmListHelper.php b/classes/helpers/FrmListHelper.php index 2bf8ffd8b2..dc82be5e09 100644 --- a/classes/helpers/FrmListHelper.php +++ b/classes/helpers/FrmListHelper.php @@ -79,8 +79,14 @@ class FrmListHelper { */ protected $_column_headers; + /** + * @var array + */ protected $compat_fields = array( '_args', '_pagination_args', 'screen', '_actions', '_pagination' ); + /** + * @var array + */ protected $compat_methods = array( 'set_pagination_args', 'get_views', diff --git a/classes/helpers/FrmTipsHelper.php b/classes/helpers/FrmTipsHelper.php index 2de7aea0ae..cad9e98107 100644 --- a/classes/helpers/FrmTipsHelper.php +++ b/classes/helpers/FrmTipsHelper.php @@ -396,8 +396,12 @@ public static function get_import_tip() { * @return array */ public static function get_random_tip( $tips ) { - $random = random_int( 0, count( $tips ) - 1 ); + $count = count( $tips ); + if ( $count === 0 ) { + return array(); + } + $random = random_int( 0, $count - 1 ); return $tips[ $random ]; } diff --git a/classes/models/FrmAddon.php b/classes/models/FrmAddon.php index 377b827b41..e91c1641ed 100644 --- a/classes/models/FrmAddon.php +++ b/classes/models/FrmAddon.php @@ -5,20 +5,80 @@ /** @phpstan-consistent-constructor */ class FrmAddon { + + /** + * @var string + */ public $store_url = 'https://formidableforms.com'; + + /** + * @var int|string|null + */ public $download_id; + + /** + * @var string|null + */ public $plugin_file; + + /** + * @var string + */ public $plugin_folder; + + /** + * @var string + */ public $plugin_name; + + /** + * @var string + */ public $plugin_slug; + + /** + * @var string + */ public $option_name; + + /** + * @var string|null + */ public $version; - public $author = 'Strategy11'; + + /** + * @var string + */ + public $author = 'Strategy11'; + + /** + * @var bool + */ public $is_parent_licence = false; - public $needs_license = true; + + /** + * @var bool + */ + public $needs_license = true; + + /** + * @var bool + */ private $is_expired_addon = false; + + /** + * @var string|null + */ public $license; + + /** + * @var bool + */ protected $get_beta = false; + + /** + * @var array|null + */ protected $save_status; /** diff --git a/classes/models/FrmCreateFile.php b/classes/models/FrmCreateFile.php index e147249f4a..b82a1eba12 100644 --- a/classes/models/FrmCreateFile.php +++ b/classes/models/FrmCreateFile.php @@ -5,13 +5,44 @@ class FrmCreateFile { + /** + * @var string + */ public $folder_name; + + /** + * @var string + */ public $file_name; + + /** + * @var string + */ public $error_message; + + /** + * @var array + */ public $uploads; + + /** + * @var string + */ private $new_file_path; + + /** + * @var int + */ public $chmod_dir = 0755; + + /** + * @var int + */ public $chmod_file = 0644; + + /** + * @var bool + */ private $has_permission = false; /** diff --git a/classes/models/FrmDb.php b/classes/models/FrmDb.php index f9700defbf..d0edfc51f7 100644 --- a/classes/models/FrmDb.php +++ b/classes/models/FrmDb.php @@ -4,9 +4,33 @@ } class FrmDb { + + /** + * The table name for Formidable Fields. + * + * @var string + */ public $fields; + + /** + * The table name for Formidable Forms. + * + * @var string + */ public $forms; + + /** + * The table name for Formidable Entries. + * + * @var string + */ public $entries; + + /** + * The table name for Formidable Entry Metas. + * + * @var string + */ public $entry_metas; public function __construct() { diff --git a/classes/models/FrmField.php b/classes/models/FrmField.php index f0d00ab1f7..d164aa927f 100644 --- a/classes/models/FrmField.php +++ b/classes/models/FrmField.php @@ -5,7 +5,14 @@ class FrmField { + /** + * @var bool + */ public static $use_cache = true; + + /** + * @var int + */ public static $transient_size = 200; /** diff --git a/classes/models/FrmFieldFormHtml.php b/classes/models/FrmFieldFormHtml.php index 27bee1a964..f12cbffbf8 100644 --- a/classes/models/FrmFieldFormHtml.php +++ b/classes/models/FrmFieldFormHtml.php @@ -8,8 +8,14 @@ */ class FrmFieldFormHtml { + /** + * @var string + */ private $html; + /** + * @var string + */ private $html_id; /** @@ -17,10 +23,19 @@ class FrmFieldFormHtml { */ private $field_obj; + /** + * @var int|string + */ private $field_id; + /** + * @var array + */ private $form = array(); + /** + * @var array + */ private $pass_args = array(); /** diff --git a/classes/models/FrmFieldTypeOptionData.php b/classes/models/FrmFieldTypeOptionData.php index 756da81850..a2fc16c57c 100644 --- a/classes/models/FrmFieldTypeOptionData.php +++ b/classes/models/FrmFieldTypeOptionData.php @@ -12,6 +12,9 @@ */ class FrmFieldTypeOptionData { + /** + * @var array + */ private static $data = array(); /** diff --git a/classes/models/FrmFormMigrator.php b/classes/models/FrmFormMigrator.php index 1e7c09c87b..71ffb238d8 100644 --- a/classes/models/FrmFormMigrator.php +++ b/classes/models/FrmFormMigrator.php @@ -5,17 +5,49 @@ abstract class FrmFormMigrator { + /** + * @var bool + */ public $source_active; + /** + * @var string + */ public $slug; + + /** + * @var string + */ public $path; + + /** + * @var string + */ public $name; + /** + * @var array + */ public $response = array(); + + /** + * @var string + */ public $tracking = 'frm_forms_imported'; + /** + * @var array + */ protected $fields_map = array(); + + /** + * @var mixed + */ protected $current_source_form; + + /** + * @var array + */ protected $current_section = array(); /** diff --git a/classes/models/FrmFormTemplateApi.php b/classes/models/FrmFormTemplateApi.php index 4268615045..cc3ce1b951 100644 --- a/classes/models/FrmFormTemplateApi.php +++ b/classes/models/FrmFormTemplateApi.php @@ -5,10 +5,19 @@ class FrmFormTemplateApi extends FrmFormApi { + /** + * @var string + */ protected static $code_option_name = 'frm_free_license_code'; + /** + * @var string + */ private static $base_api_url = 'https://formidableforms.com/wp-json/form-templates/v1/'; + /** + * @var string|null + */ protected static $free_license; /** diff --git a/classes/models/FrmInbox.php b/classes/models/FrmInbox.php index 4dfda0ea89..e526f2f37f 100644 --- a/classes/models/FrmInbox.php +++ b/classes/models/FrmInbox.php @@ -10,8 +10,14 @@ class FrmInbox extends FrmFormApi { protected $cache_key; + /** + * @var string + */ private $option = 'frm_inbox'; + /** + * @var array|false + */ private static $messages = false; /** diff --git a/classes/models/FrmMigrate.php b/classes/models/FrmMigrate.php index b6b0e87786..b9171d0a97 100644 --- a/classes/models/FrmMigrate.php +++ b/classes/models/FrmMigrate.php @@ -4,9 +4,25 @@ } class FrmMigrate { + + /** + * @var string + */ public $fields; + + /** + * @var string + */ public $forms; + + /** + * @var string + */ public $entries; + + /** + * @var string + */ public $entry_metas; public function __construct() { diff --git a/classes/models/FrmOnSubmitAction.php b/classes/models/FrmOnSubmitAction.php index 59425404e8..59a13391ce 100644 --- a/classes/models/FrmOnSubmitAction.php +++ b/classes/models/FrmOnSubmitAction.php @@ -12,6 +12,9 @@ class FrmOnSubmitAction extends FrmFormAction { + /** + * @var string + */ public static $slug = 'on_submit'; public function __construct() { diff --git a/classes/models/FrmPersonalData.php b/classes/models/FrmPersonalData.php index 1e4e7351ce..65b46d22fa 100644 --- a/classes/models/FrmPersonalData.php +++ b/classes/models/FrmPersonalData.php @@ -5,8 +5,14 @@ class FrmPersonalData { + /** + * @var int + */ private $limit = 200; + /** + * @var int + */ private $page = 1; public function __construct() { diff --git a/classes/models/FrmReviews.php b/classes/models/FrmReviews.php index 95543221ce..9132e7e8bb 100644 --- a/classes/models/FrmReviews.php +++ b/classes/models/FrmReviews.php @@ -5,10 +5,19 @@ class FrmReviews { + /** + * @var string + */ private $option_name = 'frm_reviewed'; + /** + * @var array + */ private $review_status = array(); + /** + * @var string + */ private $inbox_key = 'review'; /** diff --git a/classes/models/FrmSettings.php b/classes/models/FrmSettings.php index a0af740556..8b7068587e 100644 --- a/classes/models/FrmSettings.php +++ b/classes/models/FrmSettings.php @@ -5,25 +5,90 @@ #[\AllowDynamicProperties] class FrmSettings { + + /** + * @var string + */ public $option_name = 'frm_options'; + + /** + * @var int + */ public $menu; + + /** + * @var int + */ public $mu_menu; + + /** + * @var int + */ public $fade_form; + + /** + * @var bool + */ public $admin_bar; + /** + * @var string + */ public $success_msg; + + /** + * @var string + */ public $blank_msg; + + /** + * @var string + */ public $unique_msg; + + /** + * @var string + */ public $invalid_msg; + + /** + * @var string + */ public $failed_msg; + + /** + * @var string + */ public $submit_value; + + /** + * @var string + */ public $login_msg; + + /** + * @var string + */ public $admin_permission; + /** + * @var string + */ public $email_to; + + /** + * @var string|null + */ public $load_style; + + /** + * @var bool|int|null + */ public $custom_style; + /** + * @var string|null + */ public $active_captcha; /** @@ -39,10 +104,30 @@ class FrmSettings { * @var string|null */ public $privkey; + + /** + * @var string|null + */ public $re_lang; + + /** + * @var string|null + */ public $re_type; + + /** + * @var string + */ public $re_msg; + + /** + * @var bool + */ public $re_multi; + + /** + * @var float|string|null + */ public $re_threshold; /** @@ -73,15 +158,49 @@ class FrmSettings { */ public $turnstile_privkey; + /** + * @var bool + */ public $no_ips; + + /** + * @var string + */ public $custom_header_ip; + + /** + * @var int + */ public $current_form = 0; + + /** + * @var bool + */ public $tracking; + + /** + * @var bool + */ public $summary_emails; + + /** + * @var string + */ public $summary_emails_recipients; + /** + * @var string|null + */ public $default_email; + + /** + * @var string + */ public $from_email; + + /** + * @var string|null + */ public $currency; /** @@ -91,10 +210,19 @@ class FrmSettings { */ public $custom_css; + /** + * @var string + */ public $honeypot; + /** + * @var bool + */ public $wp_spam_check; + /** + * @var bool + */ public $denylist_check; /** @@ -104,8 +232,14 @@ class FrmSettings { */ public $installed_after_welcome_tour_update; + /** + * @var string + */ public $disallowed_words; + /** + * @var string + */ public $allowed_words; /** diff --git a/classes/models/FrmSolution.php b/classes/models/FrmSolution.php index 826de12459..7d5ac48c49 100644 --- a/classes/models/FrmSolution.php +++ b/classes/models/FrmSolution.php @@ -13,8 +13,14 @@ class FrmSolution { + /** + * @var string + */ protected $plugin_slug = ''; + /** + * @var string + */ protected $plugin_file = ''; /** @@ -25,6 +31,9 @@ class FrmSolution { */ protected $page = ''; + /** + * @var string + */ protected $icon = 'frm_icon_font frm_settings_icon'; /** diff --git a/classes/models/FrmSpamCheckDenylist.php b/classes/models/FrmSpamCheckDenylist.php index ba185ec37a..9157c69218 100644 --- a/classes/models/FrmSpamCheckDenylist.php +++ b/classes/models/FrmSpamCheckDenylist.php @@ -16,8 +16,14 @@ class FrmSpamCheckDenylist extends FrmSpamCheck { const COMPARE_EQUALS = 'equals'; + /** + * @var array + */ protected $posted_fields; + /** + * @var array + */ protected $denylist; /** diff --git a/phpstan.neon b/phpstan.neon index f2f55edcf2..226f5fd88b 100644 --- a/phpstan.neon +++ b/phpstan.neon @@ -32,18 +32,14 @@ parameters: - '#expects (array|string|int|callable|object|stdClass|float|bool|resource)+#' - '#is always (false|true)+.#' - '#no value type specified.#' - - '#of echo cannot be converted to string.#' - '#only iterables are supported#' - '#results in an error.#' - '#should return#' - '#will always evaluate to#' - '#in isset\(\) does not exist.#' - '#is unused.#' - - '#is never read, only written#' - '#in empty\(\) is not falsy.#' - '#always exists and is not falsy.#' - - '#has no type specified.#' - - '#of function random_int expects lower number#' - '#get_gateway_for_action\(\) never returns array so it can be removed from the return type#' - "#on left side of ??#" - @@ -159,3 +155,18 @@ parameters: message: '#with no type specified#' paths: - stubs.php + - + message: '#in isset\(\) is not nullable#' + path: stripe/helpers/FrmTransLiteAppHelper.php + - + message: '#of echo cannot be converted to string.#' + paths: + - classes/controllers/FrmFormsController.php + - classes/controllers/FrmStylesController.php + - classes/helpers/FrmAppHelper.php + - classes/helpers/FrmListHelper.php + - classes/views/frm-entries/show.php + - classes/views/frm-forms/add_field.php + - + message: '#is never read, only written#' + path: classes/helpers/FrmFieldGridHelper.php diff --git a/psalm.xml b/psalm.xml index 697e2f78f3..0a3659aea6 100644 --- a/psalm.xml +++ b/psalm.xml @@ -473,6 +473,7 @@ + @@ -539,6 +540,7 @@ + diff --git a/square/controllers/FrmSquareLiteEventsController.php b/square/controllers/FrmSquareLiteEventsController.php index 22786af6ba..e85c43a4cf 100644 --- a/square/controllers/FrmSquareLiteEventsController.php +++ b/square/controllers/FrmSquareLiteEventsController.php @@ -10,6 +10,9 @@ class FrmSquareLiteEventsController { */ public static $events_to_skip_option_name = 'frm_square_events_to_skip'; + /** + * @var object|null + */ private $event; /** diff --git a/stripe/controllers/FrmStrpLiteEventsController.php b/stripe/controllers/FrmStrpLiteEventsController.php index cfc36295ca..6db8bb39dd 100644 --- a/stripe/controllers/FrmStrpLiteEventsController.php +++ b/stripe/controllers/FrmStrpLiteEventsController.php @@ -10,9 +10,24 @@ class FrmStrpLiteEventsController { */ public static $events_to_skip_option_name = 'frm_strp_events_to_skip'; + /** + * @var object|null + */ private $event; + + /** + * @var object|null + */ private $invoice; + + /** + * @var string|null + */ private $charge; + + /** + * @var string|null + */ private $status; /** diff --git a/stubs.php b/stubs.php index e0eb8ce05c..69d25ee5a8 100644 --- a/stubs.php +++ b/stubs.php @@ -165,6 +165,9 @@ class FrmProCurrencyHelper { public static function normalize_formatted_numbers( $field, $formatted_value ) {} } class FrmProDb { + /** + * @var string + */ public static $plug_version; } class FrmProStylesController extends FrmStylesController { @@ -329,6 +332,9 @@ public function __construct( $exceptions = null ) { } } class FrmPaymentsController { + /** + * @var string + */ public static $db_opt_name = 'frm_pay_db_version'; /** * @param array $cols