Skip to content

Conversation

Crabcyborg
Copy link
Contributor

No description provided.

Copy link
Contributor

coderabbitai bot commented Sep 25, 2025

Warning

Rate limit exceeded

@Crabcyborg has exceeded the limit for the number of commits or files that can be reviewed per hour. Please wait 7 minutes and 40 seconds before requesting another review.

⌛ How to resolve this issue?

After the wait time has elapsed, a review can be triggered using the @coderabbitai review command as a PR comment. Alternatively, push new commits to this PR.

We recommend that you space out your commits to avoid hitting the rate limit.

🚦 How do rate limits work?

CodeRabbit enforces hourly rate limits for each developer per organization.

Our paid plans have higher rate limits than the trial, open-source and free plans. In all cases, we re-allow further reviews after a brief timeout.

Please see our FAQ for further information.

📥 Commits

Reviewing files that changed from the base of the PR and between 0a63174 and db3a6e6.

📒 Files selected for processing (4)
  • classes/helpers/FrmAppHelper.php (10 hunks)
  • classes/helpers/FrmFormsHelper.php (8 hunks)
  • classes/helpers/FrmOnSubmitHelper.php (3 hunks)
  • rector.php (3 hunks)

Walkthrough

Standardized static class references to self::class and replaced many isset/ternary expressions with the null coalescing operator (??) across controllers, helpers, models, views and Stripe files; also replaced rand/pow with random_int and exponentiation, and adjusted Rector and PHPStan configs for PHP 7.0.

Changes

Cohort / File(s) Summary
Static class reference updates
classes/controllers/FrmAddonsController.php, classes/controllers/FrmAntiSpamController.php, classes/controllers/FrmAppController.php, classes/controllers/FrmApplicationsController.php, classes/controllers/FrmDashboardController.php, classes/controllers/FrmEntriesController.php, classes/controllers/FrmFormTemplatesController.php, classes/controllers/FrmFormsController.php, classes/controllers/FrmOnboardingWizardController.php, classes/controllers/FrmSettingsController.php, stripe/controllers/FrmStrpLiteSettingsController.php, stripe/controllers/FrmTransLiteEntriesController.php, stripe/controllers/FrmTransLiteListsController.php, classes/models/FrmFormApi.php
Replaced __CLASS__ usages with self::class in hook/callback registrations and class-derived keys.
Global null-coalescing refactor (controllers)
classes/controllers/FrmAddonsController.php, classes/controllers/FrmDashboardController.php, classes/controllers/FrmEntriesController.php, classes/controllers/FrmFieldsController.php, classes/controllers/FrmFormsController.php
Replaced many isset/ternary fallbacks with ?? for array/object reads and defaults; no behavioral control-flow changes.
Helpers — ??, random_int, exponentiation
classes/helpers/FrmAppHelper.php, classes/helpers/FrmCSVExportHelper.php, classes/helpers/FrmEntriesHelper.php, classes/helpers/FrmFieldsHelper.php, classes/helpers/FrmFormsHelper.php, classes/helpers/FrmFormsListHelper.php, classes/helpers/FrmHtmlHelper.php, classes/helpers/FrmListHelper.php, classes/helpers/FrmOnSubmitHelper.php, classes/helpers/FrmSubmitHelper.php, classes/helpers/FrmTipsHelper.php, classes/helpers/FrmXMLHelper.php
Widespread replacement of isset/ternaries with ??; randrandom_int; pow**; small syntax cleanups.
Models — ?? and minor math/random changes
classes/models/FrmAddon.php, classes/models/FrmApplicationTemplate.php, classes/models/FrmCreateFile.php, classes/models/FrmEntry.php, classes/models/FrmEntryFormatter.php, classes/models/FrmEntryMeta.php, classes/models/FrmEntryValidate.php, classes/models/FrmEntryValues.php, classes/models/FrmField.php, classes/models/FrmFieldCaptchaSettings.php, classes/models/FrmFieldFormHtml.php, classes/models/FrmFieldOption.php, classes/models/FrmFieldValueSelector.php, classes/models/FrmForm.php, classes/models/FrmFormAction.php, classes/models/FrmFormMigrator.php, classes/models/FrmFormState.php, classes/models/FrmHoneypot.php, classes/models/FrmInbox.php, classes/models/FrmSettings.php, classes/models/FrmSolution.php, classes/models/FrmSpamCheckDenylist.php, classes/models/FrmStyle.php, classes/models/FrmTableHTMLGenerator.php, classes/models/FrmYoutubeFeedApi.php
Replaced isset/ternary patterns with ??; minor numeric/operator updates (e.g., 10 ** $decimals) and random_int usage; no signature changes.
Field types / field-level updates
classes/models/fields/FrmFieldCombo.php, classes/models/fields/FrmFieldName.php, classes/models/fields/FrmFieldNumber.php, classes/models/fields/FrmFieldType.php, classes/models/fields/FrmFieldUserID.php
Adopted ?? for defaults and simplified label/value resolution; numeric handling adjusted to use exponent operator where applicable.
Factory
classes/factories/FrmFieldFactory.php
Field type class lookup uses ?? for default.
Views — templates and rendering
classes/views/frm-entries/form.php, classes/views/frm-entries/new.php, classes/views/frm-fields/back-end/combo-field/sub-field-options.php, classes/views/frm-fields/back-end/default-value-setting.php, classes/views/frm-fields/front-end/combo-field/combo-field.php, classes/views/frm-form-actions/_action_inside.php, classes/views/frm-forms/form.php, classes/views/frm-forms/mb_html_tab.php, classes/views/frm-forms/settings.php, classes/views/frm-settings/payments.php, classes/views/shared/mb_adv_info.php, classes/views/shared/toggle.php, classes/views/solutions/_import.php, classes/views/summary-emails/stats-plain.php, classes/views/xml/import_form.php
Replaced isset/ternary fallbacks with ?? in rendering code; no structural/template changes.
Stripe module
stripe/controllers/FrmStrpLiteActionsController.php, stripe/controllers/FrmStrpLiteEventsController.php, stripe/controllers/FrmTransLiteActionsController.php, stripe/helpers/FrmStrpLiteConnectHelper.php, stripe/helpers/FrmStrpLiteSubscriptionHelper.php, stripe/helpers/FrmStrpLiteUrlParamHelper.php, stripe/helpers/FrmTransLiteAppHelper.php, stripe/models/FrmStrpLiteAuth.php
Adopted ?? for data extraction; some __CLASS__self::class; small data-default semantics adjustments in Stripe-related code.
Configuration / tooling
rector.php, phpstan.neon
Enabled PHP 7.0 set in Rector, added/removed/skipped specific Rector rules; added a few PHPStan ignore patterns for new constructs.

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~25 minutes

Possibly related PRs

Suggested reviewers

  • lauramekaj1
  • shervElmi

Pre-merge checks and finishing touches

❌ Failed checks (1 warning, 1 inconclusive)
Check name Status Explanation Resolution
Description Check ⚠️ Warning The pull request has no description provided by the author, so there is no information about the changeset’s purpose or key modifications. Please add a concise description summarizing the objectives and main refactorings of this pull request so reviewers can easily understand its scope and intent.
Title Check ❓ Inconclusive The title “Run some rector changes” generically indicates refactoring via Rector but uses vague phrasing (“some”) and does not specify the nature or scope of the changes, making it unclear at a glance what was actually modified. Please refine the title to clearly and concisely summarize the primary refactoring performed, such as “Apply Rector null-coalescing and self::class callback refactorings,” so reviewers can understand the main scope at a glance.
✅ Passed checks (1 passed)
Check name Status Explanation
Docstring Coverage ✅ Passed Docstring coverage is 100.00% which is sufficient. The required threshold is 80.00%.

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

Copy link
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 11

Caution

Some comments are outside the diff and can’t be posted inline due to platform limitations.

⚠️ Outside diff range comments (2)
classes/helpers/FrmOnSubmitHelper.php (1)

141-143: Fix wp_cache_set() arguments (actions never cached; possible wrong-type return).

Second param must be the data; the cache group is the third. Currently storing the string 'frm_actions' as data breaks subsequent reads.

-		$actions = FrmFormAction::get_action_for_form( $form_id, FrmOnSubmitAction::$slug, array( 'post_status' => 'publish' ) );
-		wp_cache_set( $cache_key, 'frm_actions' );
+		$actions = FrmFormAction::get_action_for_form( $form_id, FrmOnSubmitAction::$slug, array( 'post_status' => 'publish' ) );
+		wp_cache_set( $cache_key, $actions, 'frm_actions' );
classes/controllers/FrmFormTemplatesController.php (1)

1-845: Add “Requires PHP: 7.0” header to main plugin file
The readme.txt specifies Requires PHP: 7.0, but formidable.php lacks this header—add it at the top of the plugin file to prevent syntax errors on older PHP versions.

🧹 Nitpick comments (14)
classes/models/FrmSpamCheckDenylist.php (1)

227-233: Harden input parsing: ensure string, trim, and split cross‑platform newlines

Prevents accidental TypeErrors if a non-string slips in, avoids treating '0' as empty, and supports CRLF.

This slightly changes behavior when the setting is "0" (previously treated as empty). Confirm this is acceptable.

-		if ( ! $words ) {
-			return array();
-		}
-		return array_filter(
-			array_map( 'trim', explode( "\n", $words ) )
-		);
+		if ( ! is_string( $words ) ) {
+			return array();
+		}
+		$words = trim( $words );
+		if ( $words === '' ) {
+			return array();
+		}
+		return array_filter(
+			array_map( 'trim', preg_split( "/\r\n|\r|\n/", $words ) )
+		);
classes/models/FrmEntryValidate.php (1)

917-923: Compare “Other” input against label as well as value

If options use separate values, the user-typed “Other” text will match the label, not the stored value. Falling back to label avoids false negatives.

Apply this diff:

-			$option_value = ! is_array( $option ) ? $option : ( $option['value'] ?? '' );
+			$option_value = ! is_array( $option ) ? $option : ( $option['value'] ?? ( $option['label'] ?? '' ) );
classes/helpers/FrmOnSubmitHelper.php (2)

113-119: Coalesce success_page_id in settings UI to prevent notices.

When the action is new/missing data, direct access can emit a notice.

-					'page_id'     => $args['form_action']->post_content['success_page_id'],
+					'page_id'     => $args['form_action']->post_content['success_page_id'] ?? 0,

228-229: Prefer using get_default_action_type() over magic string.

Keeps defaults consistent with the rest of the class.

-		$form_options[ $opt . 'action' ] = $action->post_content['success_action'] ?? 'message';
+		$form_options[ $opt . 'action' ] = $action->post_content['success_action'] ?? self::get_default_action_type();
stripe/helpers/FrmTransLiteAppHelper.php (1)

155-156: Avoid possible “illegal string offset” when post_content isn’t an array

get_action_settings may return $form_action->post_content, which in WP defaults to string. Cast before indexing to prevent notices and satisfy static analysis.

Apply this diff:

-		$settings = self::get_action_settings( $atts );
-		$value    = $settings[ $option ] ?? '';
+		$settings = (array) self::get_action_settings( $atts );
+		$value    = $settings[ $option ] ?? '';
stripe/controllers/FrmTransLiteActionsController.php (2)

390-391: Guard layout access when post_content might be a string

Mirror the array cast pattern to avoid possible “illegal string offset” and quiet static analysis.

Apply this diff:

-				'layout'     => $payment_action->post_content['layout'] ?? '',
+				'layout'     => ((array) $payment_action->post_content)['layout'] ?? '',

413-416: Avoid offset on non-array from FrmFieldsHelper::get_shortcodes

$shortcodes can be non-array; cast before indexing to avoid notices.

Apply this diff:

-		return $shortcodes[2] ?? -1;
+		return ((array) $shortcodes)[2] ?? -1;
classes/controllers/FrmOnboardingWizardController.php (1)

127-127: Prefer array callables over 'Class::method' strings in hooks

Array callables improve static analysis and reduce typo risks. Optional, no behavior change.

- add_action( 'admin_init', self::class . '::do_admin_redirects' );
+ add_action( 'admin_init', array( self::class, 'do_admin_redirects' ) );

- add_filter( 'option_frm_inbox', self::class . '::add_wizard_to_floating_links' );
+ add_filter( 'option_frm_inbox', array( self::class, 'add_wizard_to_floating_links' ) );

- add_action( 'admin_menu', self::class . '::menu', 99 );
- add_action( 'admin_init', self::class . '::assign_properties' );
- add_action( 'admin_enqueue_scripts', self::class . '::enqueue_assets', 15 );
- add_action( 'admin_head', self::class . '::remove_menu' );
+ add_action( 'admin_menu', array( self::class, 'menu' ), 99 );
+ add_action( 'admin_init', array( self::class, 'assign_properties' ) );
+ add_action( 'admin_enqueue_scripts', array( self::class, 'enqueue_assets' ), 15 );
+ add_action( 'admin_head', array( self::class, 'remove_menu' ) );

- add_filter( 'admin_body_class', self::class . '::add_admin_body_classes', 999 );
+ add_filter( 'admin_body_class', array( self::class, 'add_admin_body_classes' ), 999 );

- array( self::class, 'render' )
+ array( self::class, 'render' )

Also applies to: 130-130, 207-213, 258-258

classes/models/FrmField.php (1)

380-383: Minor: default to empty string to avoid null key

If both field_key and name are missing, $key becomes null. Consider defaulting to '' to avoid passing null to get_unique_key.

Apply:

-        $key                     = $values['field_key'] ?? $values['name'];
+        $key                     = $values['field_key'] ?? ($values['name'] ?? '');
classes/controllers/FrmFormsController.php (1)

3008-3015: Suppress false positive on $submit “unused” (used by included view).

$submit is consumed in the included classes/views/frm-entries/new.php. Suppress PHPMD UnusedLocalVariable at the method level to keep analyzers green.

Apply this diff:

 /**
  * Show an empty form
  *
  * @since 2.05
+ * @SuppressWarnings(PHPMD.UnusedLocalVariable) // $submit is used in the included view template.
  */
 private static function show_form_after_submit( $args ) {

Optionally, add a clarifying inline comment:

-		$submit       = $form->options['submit_value'] ?? $frm_settings->submit_value;
+		$submit       = $form->options['submit_value'] ?? $frm_settings->submit_value; // Used by new.php template.

Also applies to: 3029-3031

classes/controllers/FrmFieldsController.php (1)

187-189: Consider normalizing the type for parent_form_id

Optional: cast to int to make the intent explicit.

- $field_object->parent_form_id = $values['id'] ?? $field_object->form_id;
+ $field_object->parent_form_id = isset( $values['id'] ) ? (int) $values['id'] : (int) $field_object->form_id;
classes/controllers/FrmAppController.php (1)

1031-1037: Prefer array callables over string callables for REST routes

Improves static analysis and reduces typos; aligns with modern PHP style.

- $args = array(
-   'methods'             => 'GET',
-   'callback'            => 'FrmAppController::api_install',
-   'permission_callback' => self::class . '::can_update_db',
- );
+ $args = array(
+   'methods'             => 'GET',
+   'callback'            => [ self::class, 'api_install' ],
+   'permission_callback' => [ self::class, 'can_update_db' ],
+ );
classes/helpers/FrmFieldsHelper.php (1)

602-603: $html_id is intentionally defined for included templates

PHPMD “UnusedLocalVariable” here is a false positive; single-option.php relies on $html_id from this scope. Consider a brief comment to silence the warning.

- $html_id   = $field['html_id'] ?? self::get_html_id( $field );
+ // Intentionally used by included template (single-option.php).
+ $html_id   = $field['html_id'] ?? self::get_html_id( $field );

Also applies to: 646-647

classes/models/FrmForm.php (1)

283-286: Consider casting custom_style to int.

custom_style is effectively boolean-ish. Casting improves consistency and avoids surprises from stringy truthy values.

Apply this diff:

-		$options['custom_style'] = $values['options']['custom_style'] ?? 0;
+		$options['custom_style'] = (int) ( $values['options']['custom_style'] ?? 0 );
📜 Review details

Configuration used: CodeRabbit UI

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between ac3d591 and 6c44f14.

📒 Files selected for processing (84)
  • classes/controllers/FrmAddonsController.php (7 hunks)
  • classes/controllers/FrmAntiSpamController.php (1 hunks)
  • classes/controllers/FrmAppController.php (1 hunks)
  • classes/controllers/FrmApplicationsController.php (2 hunks)
  • classes/controllers/FrmDashboardController.php (2 hunks)
  • classes/controllers/FrmEntriesController.php (2 hunks)
  • classes/controllers/FrmFieldsController.php (4 hunks)
  • classes/controllers/FrmFormTemplatesController.php (2 hunks)
  • classes/controllers/FrmFormsController.php (5 hunks)
  • classes/controllers/FrmOnboardingWizardController.php (3 hunks)
  • classes/controllers/FrmSettingsController.php (5 hunks)
  • classes/controllers/FrmUsageController.php (1 hunks)
  • classes/factories/FrmFieldFactory.php (1 hunks)
  • classes/helpers/FrmAppHelper.php (10 hunks)
  • classes/helpers/FrmCSVExportHelper.php (1 hunks)
  • classes/helpers/FrmEntriesHelper.php (5 hunks)
  • classes/helpers/FrmFieldsHelper.php (11 hunks)
  • classes/helpers/FrmFormsHelper.php (10 hunks)
  • classes/helpers/FrmFormsListHelper.php (1 hunks)
  • classes/helpers/FrmHtmlHelper.php (1 hunks)
  • classes/helpers/FrmListHelper.php (1 hunks)
  • classes/helpers/FrmOnSubmitHelper.php (4 hunks)
  • classes/helpers/FrmSubmitHelper.php (1 hunks)
  • classes/helpers/FrmTipsHelper.php (1 hunks)
  • classes/helpers/FrmXMLHelper.php (3 hunks)
  • classes/models/FrmAddon.php (2 hunks)
  • classes/models/FrmApplicationTemplate.php (1 hunks)
  • classes/models/FrmCreateFile.php (1 hunks)
  • classes/models/FrmEntry.php (3 hunks)
  • classes/models/FrmEntryFormatter.php (1 hunks)
  • classes/models/FrmEntryMeta.php (1 hunks)
  • classes/models/FrmEntryValidate.php (2 hunks)
  • classes/models/FrmEntryValues.php (1 hunks)
  • classes/models/FrmField.php (2 hunks)
  • classes/models/FrmFieldCaptchaSettings.php (1 hunks)
  • classes/models/FrmFieldFormHtml.php (2 hunks)
  • classes/models/FrmFieldOption.php (1 hunks)
  • classes/models/FrmFieldValueSelector.php (1 hunks)
  • classes/models/FrmForm.php (6 hunks)
  • classes/models/FrmFormAction.php (2 hunks)
  • classes/models/FrmFormApi.php (1 hunks)
  • classes/models/FrmFormMigrator.php (1 hunks)
  • classes/models/FrmFormState.php (1 hunks)
  • classes/models/FrmHoneypot.php (1 hunks)
  • classes/models/FrmInbox.php (1 hunks)
  • classes/models/FrmSettings.php (2 hunks)
  • classes/models/FrmSolution.php (2 hunks)
  • classes/models/FrmSpamCheckDenylist.php (1 hunks)
  • classes/models/FrmStyle.php (3 hunks)
  • classes/models/FrmTableHTMLGenerator.php (1 hunks)
  • classes/models/FrmYoutubeFeedApi.php (1 hunks)
  • classes/models/fields/FrmFieldCombo.php (3 hunks)
  • classes/models/fields/FrmFieldName.php (1 hunks)
  • classes/models/fields/FrmFieldNumber.php (1 hunks)
  • classes/models/fields/FrmFieldType.php (6 hunks)
  • classes/models/fields/FrmFieldUserID.php (1 hunks)
  • classes/views/frm-entries/form.php (1 hunks)
  • classes/views/frm-entries/new.php (1 hunks)
  • classes/views/frm-fields/back-end/combo-field/sub-field-options.php (2 hunks)
  • classes/views/frm-fields/back-end/default-value-setting.php (1 hunks)
  • classes/views/frm-fields/front-end/combo-field/combo-field.php (1 hunks)
  • classes/views/frm-form-actions/_action_inside.php (1 hunks)
  • classes/views/frm-forms/form.php (1 hunks)
  • classes/views/frm-forms/mb_html_tab.php (1 hunks)
  • classes/views/frm-forms/settings.php (1 hunks)
  • classes/views/frm-settings/payments.php (2 hunks)
  • classes/views/shared/mb_adv_info.php (1 hunks)
  • classes/views/shared/toggle.php (1 hunks)
  • classes/views/solutions/_import.php (1 hunks)
  • classes/views/summary-emails/stats-plain.php (1 hunks)
  • classes/views/xml/import_form.php (2 hunks)
  • classes/widgets/FrmShowForm.php (1 hunks)
  • rector.php (3 hunks)
  • stripe/controllers/FrmStrpLiteActionsController.php (1 hunks)
  • stripe/controllers/FrmStrpLiteEventsController.php (1 hunks)
  • stripe/controllers/FrmStrpLiteSettingsController.php (1 hunks)
  • stripe/controllers/FrmTransLiteActionsController.php (6 hunks)
  • stripe/controllers/FrmTransLiteEntriesController.php (1 hunks)
  • stripe/controllers/FrmTransLiteListsController.php (1 hunks)
  • stripe/helpers/FrmStrpLiteConnectHelper.php (1 hunks)
  • stripe/helpers/FrmStrpLiteSubscriptionHelper.php (1 hunks)
  • stripe/helpers/FrmStrpLiteUrlParamHelper.php (1 hunks)
  • stripe/helpers/FrmTransLiteAppHelper.php (4 hunks)
  • stripe/models/FrmStrpLiteAuth.php (1 hunks)
🧰 Additional context used
🧬 Code graph analysis (12)
classes/models/FrmFieldValueSelector.php (1)
classes/helpers/FrmAppHelper.php (1)
  • truncate (2789-2836)
classes/models/FrmForm.php (2)
classes/helpers/FrmFormsHelper.php (3)
  • FrmFormsHelper (6-1999)
  • fill_form_options (438-444)
  • get_default_html (449-472)
classes/helpers/FrmFieldsHelper.php (2)
  • get_default_html (504-514)
  • FrmFieldsHelper (6-2508)
classes/views/shared/toggle.php (2)
classes/helpers/FrmAppHelper.php (1)
  • checked (2229-2233)
classes/controllers/FrmFieldsController.php (1)
  • input_html (509-534)
classes/helpers/FrmAppHelper.php (1)
classes/helpers/FrmFormsHelper.php (2)
  • FrmFormsHelper (6-1999)
  • get_default_html (449-472)
classes/models/FrmStyle.php (1)
classes/controllers/FrmStylesController.php (1)
  • custom_css (785-791)
classes/helpers/FrmEntriesHelper.php (1)
classes/helpers/FrmAppHelper.php (2)
  • FrmAppHelper (6-4623)
  • get_param (635-671)
classes/controllers/FrmAntiSpamController.php (1)
classes/models/FrmSpamCheck.php (1)
  • is_spam (31-41)
classes/controllers/FrmEntriesController.php (1)
classes/helpers/FrmAppHelper.php (2)
  • FrmAppHelper (6-4623)
  • human_time_diff (2932-2980)
classes/controllers/FrmAddonsController.php (1)
classes/helpers/FrmAppHelper.php (2)
  • FrmAppHelper (6-4623)
  • is_admin_page (408-420)
classes/helpers/FrmFieldsHelper.php (2)
classes/helpers/FrmFormsHelper.php (1)
  • get_default_html (449-472)
classes/models/fields/FrmFieldType.php (1)
  • html_id (348-350)
classes/helpers/FrmFormsHelper.php (1)
classes/helpers/FrmAppHelper.php (4)
  • FrmAppHelper (6-4623)
  • kses_icon (1274-1283)
  • truncate (2789-2836)
  • get_param (635-671)
classes/views/frm-entries/new.php (1)
classes/controllers/FrmFormsController.php (1)
  • message_placement (3043-3059)
🪛 GitHub Check: PHPStan
classes/helpers/FrmTipsHelper.php

[failure] 394-394:
Parameter #1 $min (0) of function random_int expects lower number than parameter #2 $max (int<-1, max>).

classes/models/fields/FrmFieldNumber.php

[failure] 135-135:
Only numeric types are allowed in **, int|false given on the right side.

classes/models/FrmStyle.php

[failure] 214-214:
Variable $new_value on left side of ?? always exists and is not nullable.

stripe/controllers/FrmTransLiteActionsController.php

[failure] 113-113:
Offset 'gateway' on string on left side of ?? does not exist.

🪛 PHPMD (2.15.0)
classes/controllers/FrmFormsController.php

3029-3029: Avoid unused local variables such as '$submit'. (undefined)

(UnusedLocalVariable)

classes/models/fields/FrmFieldType.php

292-292: Avoid unused local variables such as '$read_only'. (undefined)

(UnusedLocalVariable)

classes/helpers/FrmFieldsHelper.php

602-602: Avoid unused local variables such as '$html_id'. (undefined)

(UnusedLocalVariable)


646-646: Avoid unused local variables such as '$html_id'. (undefined)

(UnusedLocalVariable)

🪛 GitHub Actions: PHP Syntax Check
rector.php

[error] 64-64: PHP Parse error: syntax error, unexpected ':' in ./rector.php on line 64

⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (6)
  • GitHub Check: Cypress
  • GitHub Check: Cypress
  • GitHub Check: PHP 7.4 tests in WP trunk
  • GitHub Check: PHP 8 tests in WP trunk
  • GitHub Check: PHP 7.4 tests in WP trunk
  • GitHub Check: PHP 8 tests in WP trunk
🔇 Additional comments (133)
classes/views/shared/mb_adv_info.php (1)

252-257: LGTM on the null-coalescing update

The switch to ?? keeps behavior identical while tightening the syntax. Looks good.

classes/views/solutions/_import.php (1)

15-15: Null coalescing swap looks good

The new ?? '' keeps the original default behavior while shortening the expression. No concerns here.

classes/views/frm-forms/mb_html_tab.php (1)

11-18: LGTM.

Simpler null coalescing reads cleanly and retains the prior fallback behavior.

classes/views/frm-form-actions/_action_inside.php (1)

46-46: Null fallback is clean and consistent.

The ?? swap keeps the escaping intact and avoids notices when a label is missing—nice tidy-up.

classes/helpers/FrmListHelper.php (1)

174-181: Null coalescing refactor looks good

This keeps the original fallback behavior while trimming the boilerplate. Thanks for the tidy-up.

classes/models/FrmFieldValueSelector.php (1)

282-282: Good call on leveraging null coalescing.

Switching to $this->truncate ?? 25 keeps the existing fallback intact while simplifying the check. Looks great.

classes/models/fields/FrmFieldName.php (1)

141-143: LGTM – behavior preserved with null coalescing

The switch to ?? '' keeps the original fallback semantics without triggering notices when the key is missing. Nicely aligned with the broader Rector pass.

stripe/helpers/FrmStrpLiteUrlParamHelper.php (1)

32-33: LGTM—null coalescing here is safe

Switching to ?? false keeps the prior semantics without triggering notices, so this cleanup looks good to me.

classes/models/FrmFormApi.php (1)

206-208: Consistent class reference update looks good

Switching to self::class keeps behavior intact while aligning with the Rector rollout. No issues spotted.

classes/views/frm-fields/back-end/default-value-setting.php (1)

18-21: Null coalescing preserves prior fallback semantics.

The ?? '' keeps the same behavior as the earlier isset(...)?...:'' while tightening the expression. Looks good.

stripe/controllers/FrmStrpLiteSettingsController.php (1)

16-16: Consistent use of self::class looks good

Matches the Rector sweep and keeps the settings registration uniform. ✅

classes/models/FrmEntryValues.php (1)

275-276: LGTM – null coalescing keeps the fallback intact

Switching to ?? preserves the empty-string fallback when referrer is undefined, and reads cleaner. 👍

classes/factories/FrmFieldFactory.php (1)

115-116: Null coalescing matches prior semantics

Switching to $type_classes[ $field_type ] ?? '' keeps behavior identical to the old isset/ternary while aligning with the broader Rector pass in this PR. Looks good.

classes/models/FrmFormMigrator.php (1)

600-600: Null coalescing keeps behavior intact.

Good swap to ??; it preserves the previous fallback semantics with less noise. ✅

classes/helpers/FrmFormsListHelper.php (1)

358-359: LGTM!

The null-coalescing swap perfectly preserves the previous fallback behavior without introducing notices, and keeps the code concise.

classes/models/FrmInbox.php (1)

502-503: Null coalesce swap keeps behavior intact

Good call switching to ??; it preserves the fallback for missing or null keys without the verbosity of isset.

classes/models/fields/FrmFieldUserID.php (1)

58-64: Null coalescing refactor keeps behavior intact

?? mirrors the previous nested isset/ternary chain here, so we retain the same fallback order while trimming the noise. Looks good.

classes/models/FrmApplicationTemplate.php (1)

134-135: Null coalescing keeps behavior while simplifying

Returning self::$categories ?? array() preserves the previous fallback semantics while trimming the boilerplate. Looks good.

classes/views/frm-fields/back-end/combo-field/sub-field-options.php (1)

50-50: Null coalescing operator keeps the same safe fallback

The ?? '' swap cleanly mirrors the prior isset(...)?...:'' logic for both inputs, so we avoid undefined index notices while tightening the syntax. Looks good.

Also applies to: 82-82

classes/models/FrmHoneypot.php (1)

277-278: LGTM: null coalescing handles missing meta

Using ?? keeps the behavior while avoiding notices when the honeypot key is absent—nice cleanup.

classes/helpers/FrmHtmlHelper.php (1)

32-35: Null coalescing refactor looks good

Keeps the same defaulting behavior while avoiding undefined-index notices. All good here.

classes/models/FrmTableHTMLGenerator.php (1)

109-109: Nice use of null coalescing.

Thanks for tightening this default assignment—semantics stay intact while shaving off the boilerplate.

classes/models/FrmEntryFormatter.php (1)

899-901: Separator default handling looks good

Using the null coalescing operator keeps the previous fallback behavior intact while simplifying the code. 👍

stripe/helpers/FrmStrpLiteConnectHelper.php (1)

178-178: Good cleanup with ??. Using $body->data ?? array() keeps the fallback behavior while matching the Rector style of coalescing defaults. Looks solid.

classes/views/frm-forms/settings.php (1)

50-51: Null-coalescing fallback preserves original behavior.

The switch from isset(...) ? ... : ... to ?? here keeps the callable resolution identical while trimming noise. All good.

stripe/helpers/FrmStrpLiteSubscriptionHelper.php (1)

50-51: LGTM – null coalescing keeps the original fallback semantics.

Switching to ?? '' maintains the empty-string default when sub_id is unset, lines up with the Rector-wide cleanup, and stays compatible with our PHP 7 baseline.

classes/models/FrmEntryMeta.php (1)

227-227: Null coalescing keeps behavior intact while simplifying the branch. Clean conversion—same fallback semantics without the extra isset check.

classes/models/FrmSolution.php (2)

362-368: Null coalescing keeps the original behavior.

Defaulting to an empty string here is still correct and the new syntax is cleaner.


495-499: LGTM on the links fallback.

The null coalescing operator preserves the previous default array and avoids redundant isset checks.

stripe/controllers/FrmStrpLiteEventsController.php (1)

523-524: LGTM – safe null coalesce upgrade.

This maintains the previous fallback semantics while tightening the syntax. No behavior change detected.

classes/models/FrmFieldCaptchaSettings.php (1)

175-178: Null coalescing update looks good.

This keeps the previous default behavior while cleanly avoiding notices when the setting is missing—nice tidy improvement.

classes/views/summary-emails/stats-plain.php (1)

27-29: LGTM

Switching to ?? keeps the original fallback behavior while matching the Rector pass—no issues spotted.

classes/views/frm-settings/payments.php (2)

16-16: Good call on the null coalesce swap.

This keeps the original fallback-to-ucfirst( $key ) behavior intact while trimming the boilerplate.


77-77: Tidy callback fallback.

Wrapping the ?? expression maintains the previous callable resolution without the verbosity of isset/ternary.

classes/models/FrmFieldOption.php (1)

53-53: LGTM — null coalescing keeps behavior intact.
Swapping the ternary for ?? preserves the original fallback semantics and simplifies the expression.

stripe/models/FrmStrpLiteAuth.php (1)

279-279: LGTM on the null-coalescing cleanup.

Switching to ?? keeps the previous fallback behavior while matching the Rector-driven modernization across the codebase.

classes/models/FrmFieldFormHtml.php (2)

233-234: Null-coalescing here keeps the behavior tight.

The swap to ?? false preserves the original fallback while avoiding extra isset noise. Looks good.


390-391: Clean adoption of ?? for the optional class attribute.

This keeps the default empty string without the redundant isset check—nice and tidy.

classes/views/xml/import_form.php (2)

83-84: LGTM – null coalescing keeps the fallback intact.


190-195: LGTM – same default handling with cleaner syntax.

classes/views/frm-forms/form.php (1)

71-71: Null coalescing keeps default intact

Switching to ?? preserves the earlier fallback semantics while trimming the boilerplate ternary, and the result still flows through esc_html(). Looks good.

classes/views/shared/toggle.php (1)

17-26: Null coalescing cleanup looks solid.

The switch to ?? keeps the previous defaults intact while trimming the isset boilerplate—nice tidy win here.

classes/widgets/FrmShowForm.php (1)

24-27: Null coalescing fallback keeps prior behavior

The switch to ?? mirrors the former isset checks while tightening the syntax, so defaults remain intact and the code reads cleaner.

classes/models/FrmCreateFile.php (1)

17-21: Null coalescing update reads cleaner

The switch to ?? preserves behavior for missing/null keys and improves clarity.

classes/views/frm-fields/front-end/combo-field/combo-field.php (1)

63-64: Double-check null-handling for the value attribute.

$field_value[ $name ] ?? '' will now yield null when the key exists but is explicitly set to null, whereas the previous isset fallback always produced an empty string. Please confirm that FrmAppHelper::array_to_html_params() still renders value="" (or an equivalent empty value) in that scenario so we don’t inadvertently drop the attribute or end up with the literal string “null”.

classes/models/FrmYoutubeFeedApi.php (1)

42-44: Nice move adopting ?? for the cache lookup.

Keeps the same fallback semantics while trimming the conditional and aligns with the Rector sweep toward null-coalescing defaults.

stripe/controllers/FrmStrpLiteActionsController.php (1)

619-619: Null-coalescing preserves the original fallback

$field->temp_id ?? $field->id matches the prior isset/ternary behavior and keeps the lookup concise. Looks good.

classes/models/fields/FrmFieldType.php (1)

141-147: LGTM – null coalescing keeps the original fallback behavior.
This is a clean win for readability with no change to the runtime semantics.

classes/models/FrmSpamCheckDenylist.php (1)

226-226: LGTM: Using null coalescing here is correct

$frm_settings->$setting_key ?? '' mirrors the prior isset/ternary behavior and avoids notices for undefined/null settings.

classes/helpers/FrmSubmitHelper.php (1)

81-81: Approve null coalescing; plugin minimum PHP 7.0+

classes/models/FrmStyle.php (2)

46-46: Good upgrade to random_int for slug generation

CSPRNG-based IDs are preferable. Please confirm minimum supported PHP version is >= 7.0 in the plugin (random_int availability) and that a rare CSPRNG failure throwing Exception is acceptable here.


103-103: Use of null coalescing (??) is appropriate here

Semantics match the prior isset/ternary and avoid notices for missing keys.

classes/models/FrmEntryValidate.php (1)

133-137: LGTM on ??; confirm item_meta is always an array

This is equivalent to the previous isset/ternary and reads cleaner. Just ensure $values['item_meta'] is reliably an array here to avoid offset warnings on non-arrays.

classes/helpers/FrmOnSubmitHelper.php (3)

333-348: Good use of null coalescing for migration defaults.

The changes reduce boilerplate and avoid notices when options are missing.


153-154: LGTM: safer default for action type.

Null coalescing here reads clearly and is safe.


122-123: No functional change.

PHP tag placement tweak is fine.

stripe/controllers/FrmTransLiteListsController.php (1)

19-20: Callback reference modernization — LGTM

Using self::class for hook callbacks is correct and keeps behavior identical to CLASS here.

stripe/controllers/FrmTransLiteEntriesController.php (1)

21-21: Hook callback via self::class — LGTM

Consistent with the project-wide refactor; no behavior change.

stripe/helpers/FrmTransLiteAppHelper.php (3)

69-70: Null-coalescing for status mapping — LGTM

Safe fallback to raw status; no side effects.


130-131: Initialize meta_value with ?? — LGTM

Prevents undefined index and keeps type stable as array.


406-406: Filter callback via self::class — LGTM

Consistent with other updates; correct for add_filter/remove_filter pairing.

stripe/controllers/FrmTransLiteActionsController.php (3)

126-127: Null-coalescing for nested response error — LGTM

Safe on missing keys; no behavior change.


151-152: Null-coalescing on frm_vars chain — LGTM

Appropriate and prevents undefined index notices.


469-469: Null-coalescing on previous entry — LGTM

Safe and idempotent.

classes/models/fields/FrmFieldCombo.php (2)

384-388: Good use of null coalescing for classes.

This is a clear, safe simplification. The array-join fallback is preserved.


420-422: Correct initialization with null coalescing.

Behavior matches the prior isset/ternary pattern and avoids notices.

classes/models/FrmFormAction.php (1)

438-438: Good use of null coalescing for array offset.

Semantics match the prior isset/ternary. No behavior change.

classes/helpers/FrmCSVExportHelper.php (1)

594-594: LGTM: Safe null-coalescing default

Using ?? avoids notices on missing keys and preserves prior semantics (null maps to false).

classes/controllers/FrmAntiSpamController.php (1)

31-36: LGTM: Use self::class for static callbacks

Clearer and consistent with modern PHP; behavior unchanged.

classes/views/frm-entries/new.php (1)

16-16: LGTM: Safe default for message placement

Using ?? avoids undefined var notices and keeps existing flow.

classes/controllers/FrmApplicationsController.php (1)

31-31: LGTM: self::class callables are correct here

Menu callback and array_reduce callback both properly reference static methods.

Also applies to: 135-135

classes/views/frm-entries/form.php (1)

11-11: LGTM: Use of ?? for shortcode preservation

Matches prior isset/ternary semantics and avoids undefined index notices.

classes/controllers/FrmUsageController.php (1)

43-47: Declare PHP ≥7.0 support: random_int requires PHP 7.0+, but no PHP requirement is specified in the plugin header or composer.json. Verify and add a Requires PHP: 7.0 header or composer.json constraint.

classes/controllers/FrmFormTemplatesController.php (2)

144-151: Switch to self::class for callbacks looks good

Using self::class for static callbacks is correct and consistent. No behavior change.


171-172: Submenu callback refactor is correct

array(self::class, 'render') is equivalent to the prior form and safer for refactors.

classes/controllers/FrmDashboardController.php (1)

24-25: Null coalescing and callback refactors are safe

  • self::class usage in hooks is fine.
  • Using ?? avoids undefined index notices for ['video-id'] in both welcome and featured branches.

Also applies to: 465-466, 471-472

classes/models/FrmSettings.php (2)

305-308: Safe access to reCAPTCHA options

$recaptcha_opt[...] ?? ... avoids notices if the option is missing or not an array. Good simplification.


449-453: Role defaults via ?? are clearer

Casting to array and defaulting to 'administrator' ensures stable capability updates. Good.

classes/models/FrmEntry.php (4)

416-417: Entry name resolution simplified correctly

Using $values['item_name'] ?? $values['name'] ?? $default matches prior logic and avoids notices.


811-812: updated_by fallback via ?? is correct

Defaults to the user_id when updated_by is absent. Matches intent.


816-818: get_entry_value uses ?? appropriately

Removes boilerplate while preserving defaults.


1111-1112: Update path updated_by fallback is correct

Defaults to current user when not provided; aligns with previous behavior.

classes/models/FrmAddon.php (2)

299-300: Capability roles default via ?? is fine

Ensures 'administrator' is included and avoids undefined property checks.


555-558: checked_recently simplified

$last_checked['time'] ?? false is equivalent to prior isset check; logic remains intact.

classes/models/FrmField.php (1)

1386-1388: Option fetch with ?? is fine

$field->field_options[$option] ?? '' avoids undefined index notices. Assumes field_options is an array, which upstream code ensures.

classes/controllers/FrmAddonsController.php (7)

32-39: Hook registration updates look good

self::class for callbacks modernizes references without behavior change.


147-148: License type extraction hardened

$addons['error']['type'] ?? '' prevents notices when the type is absent. Good.


418-419: Pro download URL fallback

Returning $pro['url'] ?? '' is appropriate.


456-457: Direct pro addon fetch via ??

Safe default to empty array if index is missing.


481-493: License expiry check simplified correctly

$version_info['error']['expires'] ?? 0 preserves logic and reduces conditionals. Rate-limit guard retained.


552-554: Plugin version lookup hardened

Defaults avoid undefined index issues in environments with partial plugin data.


633-639: Download ID fallback via ??

Prevents undefined index in mixed API responses. Good.

classes/controllers/FrmSettingsController.php (3)

62-66: Consistent use of self::class in settings tabs

Standardizes static references across tabs; no behavior change. Good cleanup.

Also applies to: 68-72, 74-78, 83-84, 98-102, 157-158


206-207: uksort callback updated

array(self::class, 'payment_sections_sort_callback') is correct and clearer.


243-244: Null coalescing in call_user_func fallback

$section['function'] ?? $section keeps BC and avoids notices.

classes/helpers/FrmEntriesHelper.php (5)

46-49: LGTM on using null coalescing for defaults.

Defaulting parent_form_id and in_embed_form via ?? matches previous isset logic without notices.


198-199: LGTM: safer read from metas.

Using ?? false avoids undefined index warnings and preserves prior behavior.


226-227: LGTM: safe child values fetch.

Null coalescing protects against missing embedded_field_id metas.


311-312: LGTM: default exclude_cat.

Keeps behavior while avoiding notices on missing option.


642-644: LGTM: id fallback via FrmAppHelper.

Clean defaulting with correct sanitization on fallback.

classes/helpers/FrmAppHelper.php (2)

59-60: plugin_path updated to dirname(..., 2) is fine for this structure.

This resolves to the plugin root from classes/helpers reliably on PHP 7+. No concerns.


129-133: LGTM: broad adoption of ?? to avoid notices.

All these switches to null coalescing preserve prior semantics and harden against undefined indexes.

Also applies to: 666-667, 1027-1029, 1834-1840, 2597-2600, 2625-2625, 2654-2654, 2758-2759

classes/controllers/FrmEntriesController.php (1)

103-104: LGTM: modernized callback reference and safe default for trash_time.

self::class usage is clearer for static callbacks, and ?? preserves behavior for missing trash_time.

Also applies to: 518-521

classes/controllers/FrmFormsController.php (2)

1414-1415: LGTM: self::class for settings tab callbacks.

Consistent and future-proof static references.

Also applies to: 1447-1449, 1485-1487


3120-3123: LGTM: safer defaults for success option and message.

Using ?? keeps defaults robust when options are missing.

classes/controllers/FrmFieldsController.php (3)

677-681: Placeholder defaulting looks good

Using null coalescing here is clear and safe.


1002-1005: Safer option selection with null coalescing

This simplifies the previous nested checks without changing behavior.


1013-1014: Label fallback is correct

The fallback to reset($opt) preserves previous behavior.

classes/helpers/FrmXMLHelper.php (2)

711-714: Option value fallback is correct

Null coalescing keeps prior semantics for option arrays.


1707-1733: Autoresponder defaults streamlined correctly

Using ?? for ar_* fields preserves behavior when keys are missing or null.

classes/helpers/FrmFormsHelper.php (9)

365-367: Edit vars fallback is correct

Coalescing to record values is concise and safe.


441-442: Form options fill is cleaner

Directly coalescing from $values avoids nested checks.


616-619: insert_opt_html: safe defaults

Using ?? avoids undefined index notices when type metadata is missing.


655-655: insert_opt_html: id_label fallback is good

Keeps a sensible default when a custom label isn’t provided.


662-662: insert_opt_html: key_label fallback is good

Truncation with a safe default is preserved.


978-979: Top-label detection fallback is correct

Preferring original_type when present improves accuracy.


1224-1224: Label selection fallback is fine

Keeps existing behavior while simplifying the code.


1437-1445: Template icon defaults are robust

Graceful fallback when a mapping or bg color is missing.


1981-1981: actions_dropdown: id fallback is fine

Uses GET param as a safe default when $atts['id'] is absent.

classes/helpers/FrmFieldsHelper.php (9)

74-76: custom_html fallback is correct

Keeps default HTML when not present in field options.


125-125: original_type fallback is good

Ensures consistent typing for downstream logic.


175-181: Default option filling simplified

Coalescing maintains semantics and reduces noise.


537-543: run_wpautop default is sensible

Defaults to true and remains filterable.


1101-1103: Separator default is appropriate

Using ', ' as default preserves output expectations.


1177-1178: [get] shortcode default handling improved

Respects default when provided, else uses prev_val.


1203-1205: get_unfiltered_display_value: atts fallback is safe

Works for both compacted and raw arrays.


1239-1240: User property fallback is safe

Avoids notices when a property is missing.


2465-2467: AI options: data-fid fallback is correct

Uses likert_id when present; otherwise falls back to field id.

classes/models/FrmFormState.php (1)

77-79: LGTM: concise state access

Null coalescing is the right choice here.

classes/models/FrmForm.php (4)

359-360: LGTM: safer defaults for field options.

Null-coalescing avoids notices and keeps defaults tight.


493-496: LGTM: resilient fallback for custom_html.

Cleanly prefers posted value, then existing field option, then type default.


519-521: LGTM: concise defaulting for field column updates.

Keeps prior value unless explicitly provided.


1177-1180: LGTM: get_option now null-safe.

Using ?? removes undefined index notices and respects provided defaults.

Copy link
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 1

🧹 Nitpick comments (2)
phpstan.neon (2)

49-49: Fix get_gateway_for_action()’s return contract instead of hiding the warning.

If PHPStan proves the method never returns an array, the DocBlock—or the implementation—should be adjusted. Masking the notice keeps the type declaration misleading for anyone calling the method. Please resolve the mismatch or scope the ignore to the single file once the contract is corrected.


50-50: Avoid a global ignore for “on left side of ??:” diagnostics.

This pattern will silence every future report about invalid operands to the null‑coalescing operator, making it easy to miss real bugs introduced later. Instead, address the specific expressions PHPStan is complaining about (or scope the ignore narrowly if it’s a false positive tied to a single file).

📜 Review details

Configuration used: CodeRabbit UI

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 6c44f14 and 0a63174.

📒 Files selected for processing (3)
  • classes/models/FrmStyle.php (3 hunks)
  • classes/models/fields/FrmFieldNumber.php (1 hunks)
  • phpstan.neon (1 hunks)
🚧 Files skipped from review as they are similar to previous changes (1)
  • classes/models/FrmStyle.php
🧰 Additional context used
🧬 Code graph analysis (1)
classes/models/fields/FrmFieldNumber.php (1)
classes/helpers/FrmAppHelper.php (2)
  • FrmAppHelper (6-4623)
  • count_decimals (4308-4320)
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (3)
  • GitHub Check: Cypress
  • GitHub Check: PHP 8 tests in WP trunk
  • GitHub Check: PHP 7.4 tests in WP trunk
🔇 Additional comments (1)
classes/models/fields/FrmFieldNumber.php (1)

132-136: Nice fix on the decimal casting.

Casting the max() result to int before applying the exponent operator removes the int|false risk and keeps PHPStan happy.

@Crabcyborg Crabcyborg merged commit 56bb23c into master Sep 25, 2025
16 checks passed
@Crabcyborg Crabcyborg deleted the run_some_rector_changes branch September 25, 2025 13:37
@coderabbitai coderabbitai bot mentioned this pull request Oct 2, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant