Skip to content

Add type comments#2604

Merged
Crabcyborg merged 33 commits into
masterfrom
phpcs_force_type_comments
Nov 27, 2025
Merged

Add type comments#2604
Crabcyborg merged 33 commits into
masterfrom
phpcs_force_type_comments

Conversation

@Crabcyborg
Copy link
Copy Markdown
Contributor

@Crabcyborg Crabcyborg commented Nov 26, 2025

This PR adds missing @param comments for every function.

And the PHPCS rule is no longer ignored 🎉.

@coderabbitai
Copy link
Copy Markdown
Contributor

coderabbitai Bot commented Nov 26, 2025

Walkthrough

Widespread PHPDoc additions across controllers, helpers, models, fields, and view components; removal of deprecated FrmInboxController::dismiss_all_button; added methods FrmAppHelper::post_edit_link and FrmSettings::update_setting; two method signatures simplified (FrmSettingsController::settings_cta, FrmFormsController::update_form_builder_fields); adjusted a hook registration and added a phpstan.neon ignore.

Changes

Cohort / File(s) Summary
Controllers
classes/controllers/FrmStylesController.php, classes/controllers/FrmAppController.php, classes/controllers/FrmDashboardController.php, classes/controllers/FrmInboxController.php, classes/controllers/FrmSettingsController.php, classes/controllers/FrmUsageController.php, classes/controllers/FrmXMLController.php, classes/controllers/FrmTransLiteAppController.php, stripe/controllers/FrmTransLiteListsController.php
Added/expanded PHPDoc for many controller methods; removed deprecated FrmInboxController::dismiss_all_button; changed FrmSettingsController::settings_cta signature (removed $view).
Hook registration
classes/controllers/FrmHooksController.php
Adjusted frm_fields_in_form_builder registration to omit explicit priority/arg count (previously 10, 2), impacting how many args the callback receives.
Helpers (core & integrations)
classes/helpers/FrmAppHelper.php, classes/helpers/FrmEntriesHelper.php, classes/helpers/FrmFieldsHelper.php, classes/helpers/FrmStylesHelper.php, classes/helpers/FrmCSVExportHelper.php, classes/helpers/FrmDashboardHelper.php, classes/helpers/FrmEntriesListHelper.php, classes/helpers/FrmFormsListHelper.php, classes/helpers/FrmListHelper.php, classes/helpers/FrmFormMigratorsHelper.php, classes/helpers/FrmOnSubmitHelper.php, classes/helpers/FrmXMLHelper.php, stripe/helpers/FrmStrpLiteAppHelper.php, stripe/helpers/FrmStrpLiteConnectHelper.php, stripe/helpers/FrmTransLiteListHelper.php, square/helpers/FrmSquareLiteAppHelper.php, square/helpers/FrmSquareLiteConnectHelper.php
Extensive PHPDoc additions/clarifications; added FrmAppHelper::post_edit_link($post_id) and minor mb_* function-preference hinting.
Models — core & DB
classes/models/FrmFieldValueSelector.php, classes/models/FrmForm.php, classes/models/FrmDb.php, classes/models/FrmAddon.php, classes/models/FrmFormApi.php, classes/models/FrmField.php, classes/models/FrmEntryFormatter.php, classes/models/FrmEntryValidate.php, classes/models/FrmMigrate.php, classes/models/FrmCreateFile.php, classes/models/FrmEntry.php, classes/models/FrmUsage.php, classes/models/FrmReviews.php, classes/models/FrmSolution.php, classes/models/FrmOnSubmitAction.php, classes/models/FrmFormAction.php, classes/models/FrmFormMigrator.php, classes/models/FrmEntryMeta.php, classes/models/FrmStyle.php
Added/expanded PHPDoc across many methods and constructors; mostly documentation-only changes (minor variable/whitespace tweaks in a few places).
Models — settings & personal data
classes/models/FrmSettings.php, classes/models/FrmPersonalData.php
Added FrmSettings::update_setting($key, $value, $sanitize); expanded docblocks for export_data/erase_data in FrmPersonalData.
Models — fields
classes/models/fields/* (e.g., FrmFieldEmail.php, FrmFieldType.php, FrmFieldUserID.php, FrmFieldName.php, FrmFieldNumber.php, FrmFieldPhone.php, FrmFieldUrl.php, FrmFieldCaptcha.php, FrmFieldHTML.php, FrmFieldCheckbox.php, FrmFieldDefault.php, FrmFieldRadio.php, FrmFieldSelect.php, classes/models/fields/FrmFieldFormHtml.php)
Added/refined PHPDoc @param annotations for field methods (sanitize_value, get_field_value, prepare_import_value, load_field_scripts, after_replace_html_shortcodes, etc.); no signature changes.
Views — style components & view actions
classes/views/styles/components/* (e.g., FrmAlignStyleComponent.php, FrmBackgroundImageStyleComponent.php, FrmColorpickerStyleComponent.php, FrmDirectionStyleComponent.php, FrmDropdownStyleComponent.php, FrmFieldShapeStyleComponent.php, FrmPrimaryColorStyleComponent.php, FrmTextToggleStyleComponent.php, classes/views/frm-form-actions/email_action.php)
Added constructor/method PHPDoc parameter annotations; no executable or signature changes.
Forms bootstrap, factories & misc controllers/helpers
classes/factories/FrmFieldFactory.php, formidable.php, classes/controllers/FrmFormsController.php, classes/helpers/FrmFormsHelper.php, classes/helpers/FrmFormActionsHelper.php, classes/controllers/FrmFormActionsController.php, classes/controllers/FrmFieldsController.php, classes/controllers/FrmEntriesController.php, classes/controllers/FrmAddonsController.php, classes/controllers/FrmSMTPController.php
Wide PHPDoc updates; API changes: FrmFormsController::update_form_builder_fields( $fields, $form )update_form_builder_fields( $fields ), added maybe_update_form_builder_message(&$message), and FrmFormActionsController::trigger_create_actions now includes form_id in filter args; small defer_script_loading strict comparison tweak.
Static analysis config
phpstan.neon
Added ignore rule for PHPStan message about FrmFormAction::prepare_action() in classes/models/FrmFormAction.php.
Tests
tests/cypress/e2e/Forms/formPageDataValidation.cy.js, tests/cypress/e2e/admin-a11y.cy.js
E2E test updates: broadened allowed upgrade banner heading text; added a baseline a11y rule to ignore region.

Sequence Diagram(s)

(omitted)

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~25 minutes

  • Areas needing extra attention:
    • Callers and filters for FrmFormsController::update_form_builder_fields — ensure all call sites handle the reduced arg list.
    • Removal of FrmInboxController::dismiss_all_button — search for usages/deprecations.
    • New FrmSettings::update_setting — verify sanitizer invocation and key validation logic.
    • New FrmAppHelper::post_edit_link and any mb_* selection behavior affecting multibyte handling.
    • Hook change in FrmHooksController affecting filter argument delivery.

Possibly related PRs

Suggested reviewers

  • lauramekaj1

Pre-merge checks and finishing touches

✅ Passed checks (3 passed)
Check name Status Explanation
Title check ✅ Passed The title 'Add type comments' directly aligns with the primary objective of the changeset, which adds @param type annotations across numerous functions and PHPDoc blocks.
Description check ✅ Passed The description 'This PR adds missing @param comments for every function' and mentions that the PHPCS rule is no longer ignored, which accurately reflects the extensive PHPDoc additions throughout the codebase.
Docstring Coverage ✅ Passed Docstring coverage is 97.96% which is sufficient. The required threshold is 80.00%.
✨ Finishing touches
  • 📝 Generate docstrings
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment
  • Commit unit tests in branch phpcs_force_type_comments

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
Copy Markdown
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

📜 Review details

Configuration used: CodeRabbit UI

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 006d247 and 31f3d3a.

⛔ Files ignored due to path filters (1)
  • phpcs.xml is excluded by !**/*.xml
📒 Files selected for processing (17)
  • classes/controllers/FrmStylesController.php (2 hunks)
  • classes/helpers/FrmAppHelper.php (5 hunks)
  • classes/models/FrmFieldValueSelector.php (1 hunks)
  • classes/models/FrmForm.php (2 hunks)
  • classes/models/fields/FrmFieldEmail.php (1 hunks)
  • classes/models/fields/FrmFieldType.php (8 hunks)
  • classes/models/fields/FrmFieldUserID.php (2 hunks)
  • classes/views/styles/components/FrmAlignStyleComponent.php (1 hunks)
  • classes/views/styles/components/FrmBackgroundImageStyleComponent.php (1 hunks)
  • classes/views/styles/components/FrmColorpickerStyleComponent.php (1 hunks)
  • classes/views/styles/components/FrmDirectionStyleComponent.php (1 hunks)
  • classes/views/styles/components/FrmDropdownStyleComponent.php (1 hunks)
  • classes/views/styles/components/FrmFieldShapeStyleComponent.php (1 hunks)
  • classes/views/styles/components/FrmPrimaryColorStyleComponent.php (1 hunks)
  • classes/views/styles/components/FrmTextToggleStyleComponent.php (1 hunks)
  • stripe/controllers/FrmTransLiteAppController.php (1 hunks)
  • stripe/models/FrmTransLiteDb.php (1 hunks)
🧰 Additional context used
🪛 GitHub Actions: Inspections
classes/models/FrmForm.php

[error] 1-1: PHP-CS-Fixer reported 1 issue: phpdoc_types_order would fix in FrmForm.php. Exit code 8 from fixer (dry-run).

⏰ 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: PHP 7.4 tests in WP trunk
  • GitHub Check: PHP 8 tests in WP trunk
  • GitHub Check: Cypress
  • GitHub Check: PHP 8 tests in WP trunk
  • GitHub Check: PHP 7.4 tests in WP trunk
  • GitHub Check: Cypress
🔇 Additional comments (30)
classes/views/styles/components/FrmPrimaryColorStyleComponent.php (1)

20-23: LGTM!

The parameter documentation is accurate and enhances code clarity for this constructor.

classes/views/styles/components/FrmBackgroundImageStyleComponent.php (1)

19-21: LGTM!

The parameter documentation is accurate and consistent with the other style components in this PR.

classes/views/styles/components/FrmDropdownStyleComponent.php (1)

20-23: LGTM!

The parameter documentation is accurate and follows the established pattern.

classes/views/styles/components/FrmAlignStyleComponent.php (1)

20-23: LGTM!

The parameter documentation is accurate and maintains consistency across style components.

classes/models/FrmForm.php (2)

229-236: LGTM!

The parameter documentation for the update method is clear and accurate.


73-81: The rewritten review comment is complete and ready. The verification has been finished. Please note that the sandbox environment does not have the php-cs-fixer binary available, but the issue has been confirmed through inspection of the source code and project configuration.

stripe/controllers/FrmTransLiteAppController.php (1)

9-13: LGTM!

The method documentation clearly describes the purpose and parameter, with the mixed type appropriately covering the false default and other possible version values.

classes/views/styles/components/FrmColorpickerStyleComponent.php (1)

20-24: LGTM!

The parameter documentation is accurate and consistent with the other style component updates.

classes/views/styles/components/FrmFieldShapeStyleComponent.php (1)

20-23: LGTM!

The PHPDoc annotations accurately document the constructor parameters with clear descriptions.

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

439-442: LGTM!

The parameter documentation for show_options accurately describes the method's arguments.


481-482: LGTM!

Clear documentation added for the show_field_options method parameters.


602-603: LGTM!

Appropriate parameter documentation for show_single_option.


620-622: LGTM!

The parameter and return type documentation for has_field_choices is accurate.


632-634: LGTM!

The parameter documentation for displayed_field_type correctly describes the field argument.


731-732: LGTM!

Good documentation noting that $default_value is passed by reference, which is important for developers to understand.


909-910: LGTM!

Clear parameter documentation added for get_field_scripts_hook.


1437-1438: LGTM!

Correctly documents that $value is passed by reference, which is important information for implementers.

classes/views/styles/components/FrmDirectionStyleComponent.php (1)

20-23: LGTM!

The constructor parameter documentation is accurate and follows consistent patterns across similar style component classes.

classes/models/FrmFieldValueSelector.php (1)

89-90: LGTM!

The constructor parameter documentation clearly describes the expected arguments with appropriate type hints.

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

60-60: LGTM!

The parameter documentation correctly notes that the email value is passed by reference, which is important information for developers using this method.

classes/views/styles/components/FrmTextToggleStyleComponent.php (1)

21-24: LGTM!

Constructor parameter documentation is clear and consistent with the pattern used across other style components.

classes/controllers/FrmStylesController.php (2)

1199-1200: LGTM!

The enhanced parameter descriptions for get_style_val provide better clarity on what each parameter represents.


1242-1243: LGTM!

The added parameter documentation for do_accordion_sections clearly describes the expected screen and context arguments.

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

57-58: LGTM!

The parameter documentation for get_field_value accurately describes the arguments passed to the method.


136-137: LGTM!

The parameter documentation correctly notes that the value is passed by reference, which is essential information for understanding the method's behavior.

classes/helpers/FrmAppHelper.php (5)

912-913: LGTM! Clear documentation for pass-by-reference parameter.

The added parameter documentation accurately describes that $value is passed by reference and can be of mixed type, which matches the function implementation that handles both arrays and other types.


933-933: LGTM! Clear documentation for pass-by-reference parameter.

The added parameter documentation accurately describes that $string is passed by reference, which is helpful for understanding the function's behavior.


977-978: LGTM! Well-documented parameter descriptions.

The expanded parameter documentation clearly describes both parameters. The note that $allowed can accept 'all' for defaults is particularly helpful and matches the implementation.


1645-1646: LGTM! Clear and accurate parameter documentation.

The added parameter documentation accurately describes both parameters. The object|null type annotation correctly reflects the nullable parameter with its default value.


2972-2974: LGTM! Enhanced parameter documentation with clear descriptions.

The refined parameter documentation accurately describes all three parameters. The type annotations correctly reflect that $to and $levels can accept multiple types, and the description for $levels helpfully explains it can be either a number of units or a specific unit name.

Comment thread stripe/models/FrmTransLiteDb.php
Copy link
Copy Markdown
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: 0

🧹 Nitpick comments (1)
classes/models/fields/FrmFieldType.php (1)

1742-1750: Optionally clarify pass‑by‑reference in sanitize_value PHPDoc for consistency

This method also mutates $value by reference. For consistency with nearby hooks, you could mirror the “passed by reference” note in the @param line.

 	/**
 	 * @since 4.0.04
 	 *
-	 * @param array|string $value
+	 * @param array|string $value Value passed by reference.
 	 * @return void
 	 */
 	public function sanitize_value( &$value ) {
📜 Review details

Configuration used: CodeRabbit UI

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 31f3d3a and 0dbd127.

📒 Files selected for processing (7)
  • classes/models/FrmForm.php (2 hunks)
  • classes/models/fields/FrmFieldEmail.php (1 hunks)
  • classes/models/fields/FrmFieldName.php (1 hunks)
  • classes/models/fields/FrmFieldNumber.php (1 hunks)
  • classes/models/fields/FrmFieldPhone.php (1 hunks)
  • classes/models/fields/FrmFieldType.php (9 hunks)
  • classes/models/fields/FrmFieldUrl.php (1 hunks)
✅ Files skipped from review due to trivial changes (2)
  • classes/models/fields/FrmFieldPhone.php
  • classes/models/fields/FrmFieldName.php
🚧 Files skipped from review as they are similar to previous changes (2)
  • classes/models/FrmForm.php
  • classes/models/fields/FrmFieldEmail.php
⏰ 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). (1)
  • GitHub Check: Cypress
🔇 Additional comments (9)
classes/models/fields/FrmFieldUrl.php (1)

109-109: LGTM! Documentation improvement aligns with codebase patterns.

The array|string type annotation is appropriate, as the prepare_display_value method at line 91 iterates over (array) $value, confirming the field can handle both single URLs and arrays of URLs.

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

178-178: LGTM! PHPDoc enhancement improves code documentation.

The array|string type annotation documents the parameter's accepted types. This is consistent with the broader pattern of type comment additions across field classes mentioned in the PR summary.

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

437-444: Docblock for show_options correctly documents all three array parameters

$field, $display, and $values are all treated as arrays in the body, so the types and brief descriptions here are accurate.


479-485: show_field_options $args description matches how it’s used

Noting that $args includes field, display, and values aligns with the keys accessed in this method and the included template.


600-607: show_single_option $args summary is compatible with current usage

Describing $args as including field configuration is consistent with the method only needing $args['field'] to delegate to FrmFieldsHelper::show_single_option().


620-635: Types for has_field_choices() and displayed_field_type() align with implementation

Accepting array|object for $field and returning an array from displayed_field_type() matches the way field types are probed and filtered here.


729-735: default_value_to_string doc now correctly calls out by-reference behavior

The mixed type plus “Default value passed by reference” note matches the logic that mutates $default_value in place based on whether it’s an array or scalar.


909-915: get_field_scripts_hook $args description is appropriately scoped

Treating $args as generic field rendering arguments fits its current usage (access to form and optional parent_form_id) without over-specifying structure.


1435-1441: maybe_trim_excess_values doc correctly highlights reference semantics

The mixed type and “Value passed by reference” indication match this hook’s contract for subclasses that may mutate $value.

Copy link
Copy Markdown
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

Caution

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

⚠️ Outside diff range comments (1)
square/helpers/FrmSquareLiteConnectHelper.php (1)

388-392: $key annotation in get_square_connect_option_name is incomplete.

This method is also called with 'merchant_location_id' and 'merchant_currency', so the current list of possible $key values is misleading.

You could either generalize or expand the list. For example:

-	 * @param string $key  'merchant_id', 'client_password', 'server_password'.
+	 * @param string $key  Option key, such as 'merchant_id', 'merchant_location_id',
+	 *                     'merchant_currency', 'client_password', or 'server_password'.
🧹 Nitpick comments (3)
square/helpers/FrmSquareLiteAppHelper.php (1)

55-55: Doc summary still references Stripe instead of Square

Minor naming inconsistency: the comment says "Add education about Stripe fees." in a Square helper. Consider updating to “Square fees” for clarity.

classes/helpers/FrmStylesHelper.php (2)

259-264: Consider documenting the return type for hex2rgba

The new @param types for $hex and $a look correct and align with how they’re used. For completeness with the rest of the file, you might also add @return string here.


716-721: Minor naming clarity for get_base_font_size_scale doc

The types and parameter order in the docblock match the function signature. You might consider renaming the $value description to “Base font size” (to mirror $base_font_size at the call site) for slightly clearer intent, but it’s already correct as-is.

📜 Review details

Configuration used: CodeRabbit UI

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 0dbd127 and 99a20a5.

📒 Files selected for processing (7)
  • classes/helpers/FrmEntriesHelper.php (4 hunks)
  • classes/helpers/FrmFieldsHelper.php (1 hunks)
  • classes/helpers/FrmStylesHelper.php (10 hunks)
  • classes/models/FrmMigrate.php (2 hunks)
  • square/helpers/FrmSquareLiteAppHelper.php (1 hunks)
  • square/helpers/FrmSquareLiteConnectHelper.php (4 hunks)
  • stripe/helpers/FrmStrpLiteAppHelper.php (1 hunks)
✅ Files skipped from review due to trivial changes (2)
  • stripe/helpers/FrmStrpLiteAppHelper.php
  • classes/helpers/FrmFieldsHelper.php
⏰ 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 (17)
square/helpers/FrmSquareLiteAppHelper.php (1)

57-59: PHPDoc types and descriptions match implementation

The new @param annotations correctly reflect the method signature and how $medium and $gateway are used (string and array|false|string respectively). No functional risk introduced.

classes/helpers/FrmEntriesHelper.php (4)

417-419: LGTM! Improved parameter documentation.

The enhanced PHPDoc correctly documents the by-reference parameters and provides clearer descriptions for each parameter.


458-460: LGTM! Consistent documentation improvement.

The PHPDoc accurately documents the by-reference parameters, maintaining consistency with similar methods in the class.


645-647: LGTM! Accurate return type documentation.

The @return void annotation correctly reflects that this method outputs HTML directly without returning a value.


681-684: LGTM! Clear and accurate documentation.

The PHPDoc provides helpful descriptions for parameters and correctly documents the array return type.

classes/models/FrmMigrate.php (1)

579-580: LGTM!

The PHPDoc additions accurately document the parameter (correctly noting it's passed by reference) and the void return type.

square/helpers/FrmSquareLiteConnectHelper.php (3)

276-278: Docblock matches parameter type and behavior for maybe_fix_wpml_url.

$url is always treated as a string and returned as such; the new description is accurate and improves clarity.


372-375: Mode annotation for get_location_id_option_name is accurate and consistent.

The doc now clearly states the allowed $mode values ('auto', 'live', 'test'), matching usage patterns elsewhere in this helper.


548-552: Enhanced get_location_id docblock correctly reflects signature and return type.

The $force and $mode descriptions match how the method is implemented, and false|string is accurate for the return value.

classes/helpers/FrmStylesHelper.php (8)

135-143: Docblock for icon_key_to_class matches implementation

The new @param annotations (int|string key, string icon/type) and @return string accurately describe current usage and behavior.


421-423: fill_hex by-ref parameter doc looks accurate

The @param string $color plus “passed by reference” comment and @return void correctly match fill_hex( &$color ) and its behavior.


432-435: get_css_vars param/return docs align with usage

Documenting $vars as an array of CSS variable keys and @return array matches the implementation (apply_filters + array_unique).


443-447: output_vars docs correctly describe settings/defaults/vars

The new annotations for $settings, $defaults, and $vars, plus @return void, are consistent with how output_vars is called and how it only echoes CSS.


675-678: update_base_font_size defaults doc is consistent

Adding @param array $defaults Default style settings. matches the actual second argument and its use when scaling font sizes.


732-736: prepare_color_output by-ref and flag docs look good

The docs now clearly state $settings is passed by reference and $allow_transparent controls transparent overrides, with @return void, all matching the implementation.


784-788: get_color_output param docs match behavior

Describing $default as the fallback color and $color as a by-ref value that may be normalized or prefixed is consistent with how this helper is used.


832-835: Return type for description_margin_for_screensize is accurate

The false|string union in the doc correctly reflects that the function either returns a breakpoint string like '800px' or false when no adjustment is needed.

Comment thread classes/models/FrmMigrate.php Outdated
Copy link
Copy Markdown
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: 2

🧹 Nitpick comments (3)
stripe/helpers/FrmStrpLiteConnectHelper.php (1)

534-536: LGTM! Documentation correctly added.

The PHPDoc correctly documents the parameter and return types for the strip_lang_from_url method. The types match the implementation.

Optionally, the parameter description could be slightly more descriptive:

-	 * @param string $url URL.
+	 * @param string $url URL to strip language parameter from.
classes/models/FrmAddon.php (2)

467-475: Optional: narrow object type for $version_info

$version_info is always a decoded object (e.g., stdClass) when passed into clear_old_plugin_version, and may be set to false by reference.

If you want tighter static analysis, consider documenting this as a union and a concrete class:

-	 * @param object $version_info The version info for the plugin.
+	 * @param \stdClass|false $version_info The version info object; may be set to false when expired.

This is just for tooling clarity; behavior is already correct.


486-494: Optional: mirror union type for $version_info in maybe_use_beta_url

maybe_use_beta_url currently receives an object, but given how $version_info flows through prepare_update_details, you might want to mirror the more precise union suggested for clear_old_plugin_version:

-	 * @param object $version_info The version info for the plugin.
+	 * @param \stdClass $version_info The version info for the plugin.

Here the parameter is never false at call time, so \stdClass would be a bit clearer than bare object. Existing behavior is fine either way.

📜 Review details

Configuration used: CodeRabbit UI

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 99a20a5 and 41be327.

📒 Files selected for processing (26)
  • classes/controllers/FrmAppController.php (1 hunks)
  • classes/controllers/FrmDashboardController.php (1 hunks)
  • classes/controllers/FrmInboxController.php (0 hunks)
  • classes/factories/FrmFieldFactory.php (1 hunks)
  • classes/helpers/FrmCSVExportHelper.php (1 hunks)
  • classes/helpers/FrmDashboardHelper.php (1 hunks)
  • classes/helpers/FrmEntriesHelper.php (6 hunks)
  • classes/helpers/FrmEntriesListHelper.php (1 hunks)
  • classes/helpers/FrmFormsListHelper.php (1 hunks)
  • classes/helpers/FrmListHelper.php (3 hunks)
  • classes/models/FrmAddon.php (7 hunks)
  • classes/models/FrmDb.php (10 hunks)
  • classes/models/FrmEntryFormatter.php (1 hunks)
  • classes/models/FrmEntryValidate.php (3 hunks)
  • classes/models/FrmField.php (6 hunks)
  • classes/models/FrmForm.php (11 hunks)
  • classes/models/FrmFormApi.php (3 hunks)
  • classes/models/FrmMigrate.php (2 hunks)
  • classes/models/FrmOnSubmitAction.php (1 hunks)
  • classes/models/FrmPersonalData.php (2 hunks)
  • classes/models/FrmReviews.php (1 hunks)
  • classes/models/FrmSettings.php (2 hunks)
  • classes/models/FrmSolution.php (7 hunks)
  • square/helpers/FrmSquareLiteConnectHelper.php (5 hunks)
  • stripe/helpers/FrmStrpLiteConnectHelper.php (1 hunks)
  • stripe/helpers/FrmTransLiteListHelper.php (1 hunks)
💤 Files with no reviewable changes (1)
  • classes/controllers/FrmInboxController.php
✅ Files skipped from review due to trivial changes (9)
  • classes/helpers/FrmListHelper.php
  • classes/models/FrmEntryFormatter.php
  • classes/models/FrmField.php
  • classes/models/FrmSolution.php
  • classes/models/FrmPersonalData.php
  • classes/models/FrmMigrate.php
  • classes/models/FrmReviews.php
  • classes/controllers/FrmDashboardController.php
  • classes/models/FrmFormApi.php
🚧 Files skipped from review as they are similar to previous changes (1)
  • square/helpers/FrmSquareLiteConnectHelper.php
🧰 Additional context used
🧬 Code graph analysis (1)
classes/models/FrmAddon.php (1)
classes/controllers/FrmAddonsController.php (1)
  • get_addon (697-707)
🪛 GitHub Actions: Inspections
classes/models/FrmForm.php

[warning] 1-1: phpdoc_types_order: PHPDoc types order should be corrected by php-cs-fixer.

🪛 GitHub Actions: Psalm Code Analysis
classes/models/FrmForm.php

[error] 715-715: InvalidParamDefault: Default value type '' for argument 1 of method FrmForm::scheduled_delete does not match the given type int (see https://psalm.dev/062)

🪛 GitHub Check: Psalm
classes/models/FrmForm.php

[failure] 715-715: InvalidParamDefault
classes/models/FrmForm.php:715:12: InvalidParamDefault: Default value type '' for argument 1 of method FrmForm::scheduled_delete does not match the given type int (see https://psalm.dev/062)

⏰ 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 (38)
classes/controllers/FrmAppController.php (1)

48-52: PHPDoc types for add_admin_class correctly reflect usage

$classes is used and returned as a string of CSS classes throughout the method, so @param string and @return string are accurate and improve static analysis without changing behavior. Looks good.

classes/helpers/FrmDashboardHelper.php (1)

363-364: LGTM! Documentation addition is correct and consistent.

The added PHPDoc annotations accurately describe the method signature and align with the documentation pattern used throughout the class.

classes/helpers/FrmFormsListHelper.php (1)

154-155: LGTM! Documentation improvement aligns with PR objective.

The @param string $which annotation correctly documents the parameter type, which is confirmed by the string comparison on line 159.

stripe/helpers/FrmTransLiteListHelper.php (1)

455-458: LGTM! Documentation improvement.

The addition of the @param annotation completes the PHPDoc block for the get_amount_column method, bringing it in line with similar methods in the class and improving PHPCS compliance.

classes/factories/FrmFieldFactory.php (1)

122-124: LGTM! Documentation improvement is accurate.

The added PHPDoc annotations correctly document the method parameters and return type. Using @return mixed is appropriately defensive given that apply_filters at line 130 can return any type depending on registered filter callbacks.

classes/models/FrmDb.php (7)

359-362: LGTM!

PHPDoc annotations accurately document the parameters and void return type for maybe_remove_prefix. The "passed by reference" note is helpful for understanding the method's behavior.


455-457: LGTM!

Documentation correctly describes the by-reference array parameter and void return type for esc_query_args.


526-528: LGTM!

Accurate documentation for esc_order_by with proper indication of the by-reference parameter.


567-570: LGTM!

PHPDoc correctly documents both parameters and the string return type for prepare_array_values.


669-669: LGTM!

The @param int $time annotation correctly documents the cache expiration parameter.


698-703: LGTM!

Complete and accurate PHPDoc block for set_cache with all parameters properly typed.


717-720: LGTM!

All remaining PHPDoc additions for cache-related methods (add_key_to_group_cache, get_group_cached_keys, delete_cache_and_transient, cache_delete_group) accurately reflect their signatures and return types.

Also applies to: 730-732, 746-748, 761-761

classes/helpers/FrmEntriesListHelper.php (1)

218-226: search_box PHPDoc matches method signature and parent expectations

The new docblock correctly documents both parameters as strings and the return type as void, aligning with the search_box( $text, $input_id ) signature and the intended no-op implementation here.

classes/helpers/FrmEntriesHelper.php (6)

354-365: Docblock for set_parent_field_posted_value accurately reflects usage

The new annotations (object $field, mixed $value, array $args, @return void) match how the method uses these parameters and the fact that it only mutates $_POST without returning a value.


405-413: get_posted_meta PHPDoc is consistent with implementation

Documenting $field_id as int|string, $args as array, and the return type as mixed aligns with the way the method reads from $_POST['item_meta'] and can return either scalars or arrays (or an empty string).


423-432: maybe_set_other_validation parameter docs match by-reference behavior

The updated PHPDoc correctly marks $field as an object and $value/$args as array|string/array passed by reference, which mirrors the function signature and how those variables are mutated for “Other” option handling.


464-473: set_other_repeating_vals PHPDoc correctly describes repeating “Other” handling

The new @param annotations for $field, $value, and $args (including by-reference semantics in the descriptions) are accurate given the function’s role in adjusting values for repeating sections.


654-660: actions_dropdown annotations are accurate for attributes array

Documenting $atts as an array and the method as @return void matches the implementation, which expects an attributes array (including entry and optional id) and only echoes markup.


690-697: get_action_links PHPDoc matches parameter types and return shape

The docblock correctly notes $id as an int, $entry as array|object (it’s treated as an object with form_id), and @return array for the action definitions passed through the frm_entry_actions_dropdown filter.

classes/models/FrmOnSubmitAction.php (1)

42-44: LGTM!

The PHPDoc annotations correctly document the method parameters with appropriate types.

classes/helpers/FrmCSVExportHelper.php (1)

660-664: LGTM!

The PHPDoc block appropriately documents the private static method's parameters and return type.

classes/models/FrmEntryValidate.php (3)

323-325: LGTM!

The PHPDoc correctly documents the method parameters.


596-596: LGTM!

Parameter documentation added appropriately.


627-629: LGTM!

The PHPDoc block properly documents the parameters and return type for this private method.

classes/models/FrmSettings.php (3)

360-361: LGTM!

Parameter documentation added appropriately.


449-450: LGTM!

Parameter type annotation correctly added.


485-496: Based on my verification, I can now provide the rewritten review comment:


The primary concern about sanitize_value() return value is incorrect; the implementation is sound.

FrmAppHelper::sanitize_value() accepts $value as a reference parameter (&$value), modifying it in place rather than returning a sanitized value. The code at lines 492–493 correctly calls this function without capturing a return value. This pattern is used consistently throughout the codebase.

The secondary observation about database persistence is accurate: update_setting() modifies the property in memory only. Callers must explicitly invoke store() to persist changes to the database, as shown in FrmOnboardingWizardController::ajax_consent_tracking(). This is by design.

classes/models/FrmForm.php (6)

73-79: LGTM!

The PHPDoc clearly documents all parameters for the duplicate() method.


229-234: LGTM!

Parameter documentation appropriately added.


318-319: LGTM!

The PHPDoc correctly documents the method parameters.


508-511: LGTM!

Parameter documentation properly added, including the by-reference indicator for $field.


620-622: LGTM!

Parameter documentation correctly added to both methods.

Also applies to: 671-673


748-750: LGTM!

The PHPDoc annotations appropriately document the method parameters and return types.

Also applies to: 877-880, 997-998, 1212-1214

classes/models/FrmAddon.php (5)

338-347: Docblock for maybe_show_license_message matches hook usage

The new @param string $file and @param array $plugin annotations, plus @return void, line up with how after_plugin_row_* passes arguments and how this method is used. No issues here.


357-361: Docblock for show_license_message is accurate

Parameter and return types (string $file, array $plugin, void return) correctly describe the method’s usage and side‑effect‑only behavior.


443-450: Return type for get_api_info is consistent with usage

Annotating $license as string and the return value as array matches how $addon is consumed (array access and (object) casting). This looks correct.


637-643: activate_license_for_plugin annotations look good

Typing both parameters as string and the return as array matches how the method is called from activate() and what activate_license() returns. No functional concerns.


649-652: activate_license docblock matches implementation

$license as string and the array return type align with the shape produced by get_license_status() and the response structure consumed by callers. Looks correct.

Comment thread classes/models/FrmAddon.php
Comment thread classes/models/FrmForm.php Outdated
Copy link
Copy Markdown
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: 0

🧹 Nitpick comments (5)
classes/controllers/FrmUsageController.php (1)

55-62: Docblock additions are correct and consistent with the method signature

The new @param array $schedules and @return array annotations correctly describe the current signature and usage of add_schedules and align with the rest of the file’s style.

If you want to go a step further (purely optional), you could document the expected shape of $schedules using WordPress-style array docs, e.g.:

/**
 * @param array $schedules {
 *     @type int    $interval Interval in seconds.
 *     @type string $display  Human-readable label.
 * }
 * @return array
 */

But as-is, this is already an improvement and perfectly acceptable.

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

22-27: Documentation addition looks good.

The PHPDoc correctly documents the method parameters and return type. The generic object type for $form_action is valid, though specifying the actual class type (if known) would provide better IDE support and clarity.

If the specific class type for $form_action is known, consider updating:

 /**
- * @param object $form_action
+ * @param FrmFormAction $form_action
  * @param array  $args
  *
  * @return void
  */
classes/controllers/FrmXMLController.php (2)

156-178: Docblock for override_url matches usage; optional tightening

The new @param array $form / @param string $url annotations line up with how override_url() is called from install_template() and how $url is built. If you want to help static analysis a bit more, you could narrow these in the future to something like array<string,mixed> for $form and document that $url is passed by reference (e.g. string &$url in the description), but this is not required for this PR.


582-599: prepare_types_array param type is fine; consider aligning with caller

The new @param array $type is consistent with the way generate_xml() calls this method (where $type is documented as string[]). Since this method is private and only used there, you could optionally tighten this to @param string[] $type to better reflect the actual values, but the current array annotation is acceptable.

classes/models/FrmUsage.php (1)

481-487: Consider updating maybe_json() return type for accuracy

@param mixed $value is correct, but the function may return a non-string scalar when $value is not an array. To keep the PHPDoc accurate, consider widening the return type:

 /**
  * @since 3.06.04
  *
  * @param mixed $value Value.
  *
- * @return string
+ * @return mixed
  */
 private function maybe_json( $value ) {

This keeps behavior unchanged while making the type comment precise.

📜 Review details

Configuration used: CodeRabbit UI

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 41be327 and 51da525.

📒 Files selected for processing (18)
  • classes/controllers/FrmSettingsController.php (1 hunks)
  • classes/controllers/FrmUsageController.php (1 hunks)
  • classes/controllers/FrmXMLController.php (3 hunks)
  • classes/helpers/FrmAppHelper.php (23 hunks)
  • classes/helpers/FrmFieldsHelper.php (9 hunks)
  • classes/helpers/FrmFormMigratorsHelper.php (1 hunks)
  • classes/helpers/FrmOnSubmitHelper.php (1 hunks)
  • classes/models/FrmCreateFile.php (4 hunks)
  • classes/models/FrmEntry.php (3 hunks)
  • classes/models/FrmForm.php (11 hunks)
  • classes/models/FrmUsage.php (4 hunks)
  • classes/models/fields/FrmFieldCaptcha.php (1 hunks)
  • classes/models/fields/FrmFieldHTML.php (1 hunks)
  • classes/models/fields/FrmFieldType.php (11 hunks)
  • classes/views/frm-form-actions/email_action.php (1 hunks)
  • formidable.php (2 hunks)
  • stripe/controllers/FrmTransLiteListsController.php (1 hunks)
  • stripe/models/FrmStrpLiteAuth.php (1 hunks)
✅ Files skipped from review due to trivial changes (6)
  • stripe/models/FrmStrpLiteAuth.php
  • classes/helpers/FrmOnSubmitHelper.php
  • classes/models/fields/FrmFieldCaptcha.php
  • classes/helpers/FrmFormMigratorsHelper.php
  • stripe/controllers/FrmTransLiteListsController.php
  • classes/models/FrmEntry.php
🚧 Files skipped from review as they are similar to previous changes (3)
  • classes/helpers/FrmFieldsHelper.php
  • classes/models/fields/FrmFieldType.php
  • classes/helpers/FrmAppHelper.php
⏰ 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 (24)
formidable.php (2)

61-66: Accurate @param annotation for frm_forms_autoloader

@param string $class_name correctly reflects how the autoloader is invoked and will help IDEs/static analysis without affecting runtime. Looks good.


75-85: Clear, correct parameter docs for frm_class_autoloader

The added @param string $class_name and @param string $filepath match the function’s usage (class name and base directory), and the existing @since/@return remain consistent. Good incremental improvement to type clarity.

classes/models/FrmCreateFile.php (4)

32-33: LGTM! Documentation accurately describes the parameter.

The @param array $atts annotation correctly reflects that the method expects an associative array.


67-68: LGTM! Documentation accurately describes the parameter.

The @param string $file_content annotation is consistent with how the parameter is used in string operations.


105-106: LGTM! Documentation accurately describes the return type.

The @return string annotation correctly reflects that this method returns the file contents as a string.


120-123: LGTM! Documentation accurately describes the parameter and return type.

Both the @param string $file and @return string annotations correctly reflect the method signature and behavior.

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

44-51: Docblock for after_replace_html_shortcodes matches implementation.

The added @param and @return annotations accurately describe the current usage ($args as array, $html as string, returning string) and don’t affect runtime behavior. This aligns well with the PR’s goal of improving type documentation.

classes/controllers/FrmXMLController.php (1)

657-727: Expanded csv docblock accurately reflects parameter behavior

The added param types for csv() (false|int|string $form_id, string $search, string $fid) match the defaults and how these values are read from request parameters. The docblock now gives a clear contract for callers and looks good as-is.

classes/controllers/FrmSettingsController.php (2)

421-422: LGTM! Docblock improvement aligns with PR objectives.

The @return void annotation improves documentation quality and accurately reflects the function's return type.


424-424: The parameter removal is not a breaking change; the original review comment is incorrect.

The $view parameter was never actually passed at runtime. The hook is called via do_action( 'frm_after_settings_tabs' ) with no additional parameters (verified in classes/views/frm-settings/form.php:63), and WordPress only passes parameters when they're included in the do_action() call. The method is registered as a callback via string reference only, with no direct calls in the codebase. Removing the unused parameter is safe and improves code clarity.

Likely an incorrect or invalid review comment.

classes/models/FrmUsage.php (3)

46-52: Docblock for uuid() is accurate and consistent

@param bool $regenerate matches how the flag is used (simple truthy check) and aligns with the existing default value. Looks good.


389-395: form_field_count() parameter annotation matches usage

@param int|string $form_id reflects how IDs can be passed around in WP, and @return int matches the FrmDb::get_count result. No issues here.


410-416: form_action_count() parameter annotation is appropriate

Same pattern as form_field_count(): int|string for $form_id and int return type both align with usage and the count() call.

classes/models/FrmForm.php (11)

73-79: PHPDoc for duplicate() is precise and helpful.

Parameter types and descriptions for $id, $template, $copy_keys, and $blog_id correctly reflect how they’re used and clarify cross‑site behavior.


229-234: update() docblock correctly documents parameters.

The summary and types for $id, $values, and $create_link match the implementation and make the method’s intent clearer.


318-319: update_fields() parameter types look accurate.

Documenting $id as a form ID and $values as the form values array aligns with actual usage in the method.


509-511: get_settings_page_html() doc clarifies internal usage.

Adding parameter types and noting that $field is passed by reference makes this internal helper safer to call and refactor.


620-620: trash() now documents accepting both int and string IDs.

Allowing int|string in the docblock matches how $id is passed into getOne() and keeps static analysis happy when IDs may originate as strings.


671-671: destroy() docblock correctly reflects ID flexibility.

The int|string type is consistent with getOne() usage and the normalization to $form->id inside the method.


715-715: scheduled_delete() union type resolves the previous default mismatch.

Documenting $delete_timestamp as int|string matches the '' default and the later numeric comparison, addressing the earlier static‑analysis complaint without changing behavior.


748-748: getName() docblock correctly allows ID or key.

Typing $id as int|string and clarifying “Form ID or key” matches the branching on is_numeric( $id ) in the implementation.


877-879: getAll() parameter types now match the flexible API.

The array|string $where and int|string $limit accurately describe the two call patterns (structured conditions vs raw SQL fragments / numeric limits).


997-998: validate() input description aligns with current filter behavior.

Typing $values as an array of form values and documenting the returned errors array is consistent with the frm_validate_form filter usage.


1213-1214: get_option() doc documents the expected $atts shape.

Specifying $atts as an array containing form, option, and optional default clarifies the contract without over‑constraining the type.

Copy link
Copy Markdown
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

Caution

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

⚠️ Outside diff range comments (2)
classes/models/fields/FrmFieldNumber.php (1)

170-179: Fix the return type or logic to match the documented intent.

The @return float documentation doesn't match the actual implementation. When $value is already numeric (e.g., a numeric string like "123"), line 174's condition is false, so the value is returned as-is without casting to float. This contradicts both the return type documentation and the comment stating it should "force the value to be numeric."

Choose one of the following fixes:

Option 1 (Recommended): Always cast to float to match the documented return type:

 public function set_value_before_save( $value ) {
-	if ( ! is_numeric( $value ) ) {
-		$value = (float) $value;
-	}
-
-	return $value;
+	return (float) $value;
 }

Option 2: Update return type to reflect actual behavior:

 /**
  * Force the value to be numeric before it's saved in the DB
  *
  * @param array|string $value
- * @return float
+ * @return float|string|int
  */
classes/helpers/FrmXMLHelper.php (1)

434-446: Broaden $this_form parameter type in import_xml_fields docblock

$this_form can be false when maybe_get_form() doesn’t find a matching form, and the code branches on its emptiness. The docblock currently advertises only object, which is misleading for static analysis and readers.

Consider updating the annotation to reflect the actual usage, e.g.:

- * @param object           $this_form
+ * @param object|false     $this_form

(or a more specific union like FrmForm|false if you prefer).

🧹 Nitpick comments (6)
classes/models/FrmSpamCheckWPDisallowedWords.php (1)

57-62: Docblock types look correct; consider brief param descriptions.

The @param string types match how these values are built and forwarded to the WP spam APIs, so the annotation is accurate. If you want to further improve readability/IDE help, you could optionally add a short description per parameter (e.g., @param string $author Comment author name.), but this is non-blocking.

classes/controllers/FrmAddonsController.php (1)

749-754: prepare_addons param type is correct; consider narrowing array shape (optional)

@param array $addons matches usage. If you want to aid static analysis later, you could refine this to something like array<int|string, array<string,mixed>> $addons, but it’s not required for this PR.

classes/controllers/FrmFormActionsController.php (4)

118-126: Docblock for maybe_add_action_to_group is accurate; consider tighter array typing

The new @param array $action_controls / @param array $groups and @return void lines match the implementation. If you want stronger static analysis, you could narrow these to something like FrmFormAction[] for $action_controls and a structured array type (e.g. array<string, array{actions?: string[]}>) for $groups, but what you have is already correct for this PR’s goal.


474-480: fields_to_values docblock is correct but could name the concrete return type

The new docblock correctly documents $form_id as int|string and $values as an array passed by reference, and @return object is technically true. For better tooling support, you might consider using the concrete type (e.g. @return FrmForm) or FrmForm|null/FrmForm|false if FrmForm::getOne() can fail.


569-576: trigger_create_actions PHPDoc aligns with implementation

The added annotations for $entry_id, $form_id (int|string), $args (array), and @return void are consistent with how this method is used and how it forwards data into trigger_actions and the filter. If any callers ever pass an entry object instead of an ID, you may want to extend the param type to include FrmEntry, but as-is this matches current intent.


760-768: Condition in _register_actions looks inverted; worth a quick re-check

Unrelated to this PR, but while here: in Frm_Form_Action_Factory::_register_actions(), you build $keys = array_keys( $this->actions ); and then only call _register() when ! isset( $this->actions[ $key ] ). Since $key comes from the existing keys, isset will always be true, so _register() is never called. That seems opposite to the comment “don’t register new action if old action with the same id is already registered”. It might be intentional/legacy, but it’s worth double‑checking whether this should be if ( isset( $this->actions[ $key ] ) ) instead.

📜 Review details

Configuration used: CodeRabbit UI

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 51da525 and c1f1019.

📒 Files selected for processing (21)
  • classes/controllers/FrmAddonsController.php (6 hunks)
  • classes/controllers/FrmFieldsController.php (1 hunks)
  • classes/controllers/FrmFormActionsController.php (3 hunks)
  • classes/controllers/FrmFormsController.php (11 hunks)
  • classes/controllers/FrmSMTPController.php (2 hunks)
  • classes/helpers/FrmAppHelper.php (30 hunks)
  • classes/helpers/FrmFieldsHelper.php (9 hunks)
  • classes/helpers/FrmFormsHelper.php (6 hunks)
  • classes/helpers/FrmXMLHelper.php (14 hunks)
  • classes/models/FrmEntry.php (4 hunks)
  • classes/models/FrmFormAction.php (5 hunks)
  • classes/models/FrmFormMigrator.php (2 hunks)
  • classes/models/FrmSpamCheckWPDisallowedWords.php (1 hunks)
  • classes/models/FrmStyle.php (1 hunks)
  • classes/models/fields/FrmFieldCheckbox.php (2 hunks)
  • classes/models/fields/FrmFieldDefault.php (2 hunks)
  • classes/models/fields/FrmFieldNumber.php (3 hunks)
  • classes/models/fields/FrmFieldRadio.php (2 hunks)
  • classes/models/fields/FrmFieldSelect.php (1 hunks)
  • classes/models/fields/FrmFieldType.php (15 hunks)
  • classes/models/fields/FrmFieldUrl.php (2 hunks)
✅ Files skipped from review due to trivial changes (2)
  • classes/controllers/FrmFormsController.php
  • classes/controllers/FrmSMTPController.php
🚧 Files skipped from review as they are similar to previous changes (4)
  • classes/helpers/FrmFieldsHelper.php
  • classes/models/fields/FrmFieldUrl.php
  • classes/helpers/FrmAppHelper.php
  • classes/models/FrmEntry.php
🧰 Additional context used
🪛 GitHub Actions: Psalm Code Analysis
classes/models/FrmFormAction.php

[error] 351-351: Psalm: AssignmentToVoid: Cannot assign $post_id to type void (see https://psalm.dev/121)

⏰ 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 (35)
classes/models/FrmStyle.php (1)

69-73: Docblock update for duplicate() looks correct

The new @param int|string $id description matches how IDs are used elsewhere (including the constructor) and adds helpful context without changing behavior.

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

30-31: LGTM! Documentation improvement.

The added @param string $name annotation correctly documents the parameter type, which is consistent with the default value '' in the method signature.


52-53: LGTM! Documentation improvement.

The added @param array $shortcode_atts annotation correctly completes the parameter documentation for this method, following the existing PHPDoc conventions.

classes/controllers/FrmAddonsController.php (5)

513-519: Docblock for check_update matches behavior

@param mixed $transient and @return object are consistent with how $transient is normalized and returned from this method.


815-821: is_plugin_active param annotations look accurate

Both $file_name and $slug are used as strings, so the new docblock types are appropriate.


839-846: prepare_addon_link param type matches usage

$link is always treated and returned as a string; the new @param string $link is correct.


859-869: set_addon_status param annotation is consistent

$addon is an associative array mutated in-place; @param array $addon aligns with current usage.


1500-1509: get_addon_required_plan param/return types correctly documented

$addon_id can be an int or string array key, and the method always returns a string (empty or required plan), so the new docblock matches behavior.

classes/models/FrmFormMigrator.php (2)

162-165: LGTM! Clear documentation for import_form method.

The PHPDoc accurately documents the parameter type and return type for this method.


216-221: LGTM! Accurate documentation for prepare_fields method.

The PHPDoc correctly documents both array parameters and the void return type. The by-reference parameter is also properly indicated in the method signature.

classes/helpers/FrmFormsHelper.php (6)

309-312: LGTM! Documentation is accurate.

The PHPDoc correctly documents the parameter type and return type for this method.


363-368: LGTM! Documentation is accurate.

The PHPDoc correctly documents all parameter types and the return type for this method.


802-808: LGTM! Documentation is accurate.

The PHPDoc correctly documents all parameter types. The function modifies parameters by reference and doesn't return a value, which is correctly reflected by the absence of a @return tag.


910-912: LGTM! Documentation is accurate.

The PHPDoc correctly documents the flexible parameter type and the return type, which matches the implementation.


230-234: LGTM! Documentation is accurate.

The PHPDoc correctly documents the parameter types and return type for this method.


551-554: LGTM! Documentation is accurate.

The PHPDoc correctly documents the parameter types and void return type for this method.

classes/controllers/FrmFieldsController.php (1)

703-705: LGTM! Documentation improvement adds clarity.

The added @param array|object $field annotation accurately reflects that this method accepts both array and object representations of field data, which is consistent with the usage of FrmField::get_option() and similar patterns elsewhere in the codebase (e.g., line 794).

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

52-54: LGTM! Type comments are accurate.

The added parameter type documentation correctly reflects the method signature and usage.


184-184: LGTM! Type comment is appropriate.

The parameter type documentation correctly reflects that the method accepts and sanitizes array or string values via reference.

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

62-71: Docblock for displayed_field_type correctly reflects flexible $field type

Annotating $field as array|object matches how field data is typically passed around and brings this method in line with similar field classes, without changing behavior.


88-96: show_priority_field_choices annotations align with actual usage

The new @param array $args and @return void accurately describe the method signature and side-effect-only behavior (including a view), improving static analysis without impacting runtime.

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

52-61: displayed_field_type $field param annotation is consistent and safe

Adding @param array|object $field aligns this select field with the other field types and matches the loose input shape actually accepted, with no behavioral change.

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

53-62: displayed_field_type docblock matches usage across field types

Documenting $field as array|object is appropriate for this loosely-typed input and keeps the radio implementation consistent with checkbox and select fields.


93-100: show_priority_field_choices annotations accurately describe the signature

The @param array $args and @return void tags align with the method’s actual signature and side-effect-only behavior (view include), and bring it in line with the checkbox implementation.

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

439-442: LGTM! Documentation improvement enhances code clarity.

The added PHPDoc comments properly document the method parameters with accurate type annotations.


481-482: LGTM! Consistent parameter documentation.

The PHPDoc additions across these methods provide clear parameter and return type information that aligns with the implementations.

Also applies to: 602-603, 620-622, 632-634


732-733: LGTM! Clear documentation for method signatures.

The PHPDoc additions effectively document parameter types and behaviors, particularly the reference parameter notation which helps developers understand side effects.

Also applies to: 911-911, 974-979


1167-1170: LGTM! Thorough parameter and return type documentation.

The PHPDoc additions correctly document parameter types, including reference parameters, and return types that match the method implementations.

Also applies to: 1179-1181, 1280-1285, 1299-1302


1360-1365: LGTM! Comprehensive documentation coverage.

The final set of PHPDoc additions completes the documentation effort with accurate type information and clear descriptions, improving IDE support and code maintainability.

Also applies to: 1467-1468, 1774-1776

classes/controllers/FrmFormActionsController.php (1)

462-468: should_show_log_message PHPDoc matches usage

The added @param string $action_type and @return bool accurately reflect how this helper is used and what it returns. No further changes needed here.

classes/models/FrmFormAction.php (1)

182-187: PHPDoc additions for constructors and callbacks look consistent

The new @param and @return annotations for the PHP4-style constructor (FrmFormAction), prepare_new, duplicate_form_actions, and update_callback match how these methods are actually used (including the false|int|string union for $form_id and the array|null return for update_callback). These should help static analysis without changing behavior.

Also applies to: 270-273, 313-317, 420-427

classes/helpers/FrmXMLHelper.php (4)

358-363: Docblock for delete_removed_fields matches implementation

$form_fields is treated purely as an array and the method has no return value, so @param array and @return void are accurate.


560-565: Field default/required helper docblocks are consistent with usage

For set_default_value, maybe_add_required, maybe_update_in_section_variable, and maybe_update_get_values_form_setting, the new @param array (and @param int $in_section) plus @return void annotations accurately match the function signatures and how the parameters are used.

Also applies to: 589-596, 603-610, 653-660


673-680: Field migration helper annotations look correct

The updated docblocks for run_field_migrations, migrate_placeholders, and migrate_field_placeholder correctly document array parameters and the return value (array for migrate_field_placeholder, void for the others). These line up with the implementations and improve static tooling.

Also applies to: 686-691, 704-713


754-762: Form/field/style helper docblocks align with behavior

  • create_imported_field and maybe_update_field_ids now explicitly return void, which matches their side-effect-only implementations.
  • update_custom_style_setting_on_import and update_custom_style_setting_after_import correctly annotate $form as array and $form_id as int|string with void return.
  • clear_forms_style_caches’s @param array $imported_forms and @return void also match the implementation.

These annotations look accurate and help clarify intent.

Also applies to: 811-818, 852-860, 892-900, 1048-1053

Comment thread classes/models/FrmFormAction.php
Copy link
Copy Markdown
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: 2

Caution

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

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

1975-1989: Critical XSS vulnerability in post edit link.

The post_edit_link method constructs an HTML link but fails to properly escape the post title. While self::truncate() strips HTML tags (via wp_strip_all_tags()), it doesn't escape HTML entities. This means a post title like Test & <script> would become Test & <script> after tag stripping, but the & and other special characters remain unescaped in the HTML output, potentially allowing XSS attacks through carefully crafted post titles.

Apply this diff to fix the vulnerability:

 public static function post_edit_link( $post_id ) {
 	$post = get_post( $post_id );
 	if ( $post ) {
 		$post_url = admin_url( 'post.php?post=' . $post_id . '&action=edit' );
 
-		return '<a href="' . esc_url( $post_url ) . '">' . self::truncate( $post->post_title, 50 ) . '</a>';
+		return '<a href="' . esc_url( $post_url ) . '">' . esc_html( self::truncate( $post->post_title, 50 ) ) . '</a>';
 	}
 
 	return '';
 }
classes/models/FrmFormAction.php (1)

340-361: Complete the @return type annotation.

The maybe_create_action() method can return either int or WP_Error since it returns the result of save_settings() (line 354) or duplicate_one() (line 358), both of which return int|WP_Error. However, the docblock at line 348 only declares @return int.

Update the return type annotation:

 	/**
 	 * Check if imported action should be created or updated.
 	 *
 	 * @since 2.0
 	 *
 	 * @param array $action
 	 * @param array $forms
 	 *
-	 * @return int $post_id
+	 * @return int|WP_Error $post_id
 	 */
🧹 Nitpick comments (4)
classes/models/FrmFieldFormHtml.php (1)

168-184: Docblock for maybe_replace_description_shortcode matches signature; consider clarifying the flag meaning

The added @param bool $wp_processed and @return void correctly describe the method. For extra clarity, you might briefly document when $wp_processed is expected to be true (e.g., “true after process_wp_shortcodes() has run, false before”) since the flag controls subtle behavior for HTML vs non-HTML fields.

classes/models/FrmFormAction.php (2)

665-672: Consider broadening the type annotation for consistency.

Line 665 declares @param int $form_id, but other methods in this class use int|string for form ID parameters (e.g., duplicate_form_actions() at line 319, update_callback() at line 432). The underlying get_action_for_form() method also accepts form IDs as int|string.

For consistency across the codebase, consider:

-	 * @param int    $form_id
+	 * @param int|string $form_id
 	 * @param string $type

732-734: Consider using int|string for form_id parameter.

The annotation declares @param int $form_id, but this method is called with form IDs that may be either int or string (e.g., from line 575 via self::action_args( $form_id, $limit )). Other methods in this class use int|string for form ID parameters for consistency.

-	 * @param int $form_id
+	 * @param int|string $form_id
 	 * @param int $limit
classes/controllers/FrmFormsController.php (1)

1664-1700: Improved docs for advanced_helpers()

Annotating $atts as array and the return as array is consistent with calls via compact( 'fields', 'form_id' ) and the structure of $advanced_helpers. If desired, you could further narrow this to a shaped array, but not required.

📜 Review details

Configuration used: CodeRabbit UI

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between c1f1019 and 1fa36d5.

📒 Files selected for processing (16)
  • classes/controllers/FrmEntriesController.php (12 hunks)
  • classes/controllers/FrmFormActionsController.php (6 hunks)
  • classes/controllers/FrmFormsController.php (12 hunks)
  • classes/controllers/FrmHooksController.php (1 hunks)
  • classes/helpers/FrmAppHelper.php (31 hunks)
  • classes/helpers/FrmEmailSummaryHelper.php (1 hunks)
  • classes/helpers/FrmEntriesListHelper.php (3 hunks)
  • classes/helpers/FrmFormActionsHelper.php (1 hunks)
  • classes/helpers/FrmFormsHelper.php (12 hunks)
  • classes/helpers/FrmXMLHelper.php (32 hunks)
  • classes/models/FrmEntryMeta.php (3 hunks)
  • classes/models/FrmField.php (8 hunks)
  • classes/models/FrmFieldFormHtml.php (2 hunks)
  • classes/models/FrmFormAction.php (13 hunks)
  • classes/models/FrmSolution.php (8 hunks)
  • classes/views/styles/components/FrmSliderStyleComponent.php (1 hunks)
✅ Files skipped from review due to trivial changes (4)
  • classes/models/FrmEntryMeta.php
  • classes/views/styles/components/FrmSliderStyleComponent.php
  • classes/helpers/FrmEmailSummaryHelper.php
  • classes/controllers/FrmEntriesController.php
🚧 Files skipped from review as they are similar to previous changes (4)
  • classes/models/FrmField.php
  • classes/helpers/FrmFormsHelper.php
  • classes/models/FrmSolution.php
  • classes/helpers/FrmXMLHelper.php
🧰 Additional context used
🪛 PHPMD (2.15.0)
classes/helpers/FrmEntriesListHelper.php

224-224: Avoid unused parameters such as '$text'. (undefined)

(UnusedFormalParameter)


224-224: Avoid unused parameters such as '$input_id'. (undefined)

(UnusedFormalParameter)

⏰ 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: PHP 8 tests in WP trunk
  • GitHub Check: PHP 7.4 tests in WP trunk
  • GitHub Check: Cypress
🔇 Additional comments (33)
classes/models/FrmFieldFormHtml.php (1)

208-235: Docblock for add_element_id correctly types parameters and return

The new @param string $param, @param string $id, and @return void annotations align with how the method is used (description/error sections and generated IDs) and with its void behavior. No further changes needed.

classes/helpers/FrmEntriesListHelper.php (2)

219-226: LGTM!

The PHPDoc comments properly document the method signature. The unused parameters are expected for this stub method that's implemented in the pro version.


311-315: LGTM!

The PHPDoc comments properly document both parameters and the return type. The documentation is clear and accurate.

classes/helpers/FrmFormActionsHelper.php (1)

11-14: LGTM! Type annotations align with method signature.

The added parameter annotations correctly document the types and match the method's signature and default values.

classes/models/FrmFormAction.php (11)

365-368: LGTM! Return type correctly fixed.

The @return annotation was updated from void to int|WP_Error as requested in the previous review, correctly reflecting that duplicate_one() returns the result of save_settings().


184-186: LGTM! Constructor wrapper annotations are correct.

The added parameter annotations for the PHP4-style constructor wrapper match the method signature and align with the main __construct() method.


209-212: LGTM! Type annotations are accurate.

The annotations correctly document that get_group() accepts an array parameter and returns an array element from the $groups collection.


241-241: LGTM! Parameter annotation added.

The @param string $post_field annotation correctly documents the second parameter with its default value of 'post_content'.


276-277: LGTM! Union type correctly documents optional parameter.

The false|int|string union type accurately reflects that $form_id defaults to false but can accept integer or string form IDs.


319-321: LGTM! Parameter annotations match usage.

Both form ID parameters are correctly typed as int|string to handle the various form ID formats used throughout the codebase.


431-434: LGTM! Return type accurately reflects conditional returns.

The array|null return type correctly documents that the method returns an array of action IDs on success or null when returning early.


647-649: LGTM! Type annotations are precise.

The annotations correctly specify that $action_id is an integer and the method returns either false or a FrmFormAction instance.


675-680: LGTM! Complete PHPDoc block added.

The annotations accurately document all parameters and the return type, with the false|int|string union type properly reflecting the optional form ID parameter.


754-755: LGTM! WP_Post type annotations are correct.

The method receives a WP_Post object, modifies its properties, and returns the modified object, which is accurately reflected in the annotations.


783-785: LGTM! Parameter annotations match method signature.

The union type false|int|string for $form_id and string for $type correctly document the method's parameters and their defaults.

classes/controllers/FrmFormActionsController.php (7)

122-125: LGTM! Annotations correctly document the method.

The parameter and return type annotations accurately reflect the method signature and behavior, including the array parameters and void return.


231-231: LGTM! Parameter annotation added.

The @param array $action_controls correctly documents the array parameter used in the foreach loop.


330-334: LGTM! Method documentation is accurate.

The annotations correctly specify that list_actions() accepts a form object and values array, and returns void.


470-473: LGTM! Type annotations match the implementation.

The @param string and @return bool annotations accurately document the method's signature and return value from in_array().


480-485: LGTM! Complete PHPDoc block is well-formed.

The annotations correctly document the form ID as int|string, the array parameter passed by reference, and the object return type from FrmForm::getOne().


575-581: LGTM! Parameter types are appropriate.

The int|string union types for $entry_id and $form_id correctly accommodate the various ID formats used throughout the codebase.


600-606: LGTM! Complex parameter types are well-documented.

The annotations accurately capture that $form can be an int ID, string ID, or object, and $entry can be an int or string ID. This reflects the method's flexible signature for handling various input formats.

classes/controllers/FrmFormsController.php (10)

75-89: Docblock for prevent_divi_conflict matches usage

The added @param array $shortcodes and @return array annotations correctly describe how the filter is used and what it returns.


201-205: Typed PHPDoc for edit() reflects current usage

Declaring @param array|false $values and @return void aligns with how route() passes $vars and how edit() behaves; no functional impact.


281-285: update() param doc now constrained to array

@param array $values matches all in-file call sites (including create() and route()), which always pass arrays, so this tighter type hint is accurate.


632-646: Clarified PHPDoc for preview_page_title()

Adding @param string $title and @return string matches the filter signature and implementation and helps static analysis.


1703-1732: Return type doc for get_advanced_shortcodes()

The new @return array communicates intent and matches the associative array returned; no behavior change.


1734-1752: Return type doc for user_shortcodes()

The added @return array annotation matches the $options structure and downstream usage via apply_filters( 'frm_user_shortcodes', $options ).


1757-1793: PHPDoc tightened for get_shortcode_helpers() and its filter

Documenting @param bool $settings_tab and @return array plus the filter param docs ($entry_shortcodes, $settings_tab) aligns with current usage in mb_tags_box() and existing filter behavior.


1429-1437: Docblock for form_publish_button()

The new @param array $atts / @return void doc matches how $atts is used ($atts['values']) and the view include; this is accurate and non-breaking.


2151-2159: Docblock for no_reports()

Adding @param array $values is consistent with the route() call (self::no_reports( $vars )) even though it’s currently unused, and @return void matches behavior.


1336-1355: Filter hook argument mismatch creates silent data loss; verify intended behavior

Two related changes require clarification:

  1. update_form_builder_fields now accepts only $fields, but the filter hook at line 1318 passes two arguments: apply_filters( 'frm_fields_in_form_builder', $fields, compact( 'form' ) ). The hook registration (FrmHooksController.php:154) lacks a third accepted_args parameter, so it defaults to 1. This causes the second argument to be silently dropped for any filter callback. While no direct two-argument calls exist in the codebase, the filter hook mismatch means the compact( 'form' ) context is never received by this callback or any other callback on that filter. If that context is needed, either add accepted_args => 2 to the filter registration or remove the second argument from apply_filters.

  2. maybe_update_form_builder_message( &$message ) correctly maps message=form_duplicated to a friendly notice in get_edit_vars() (line 1325). The logic is sound. Consider adding if ( '' === $message ) guard to avoid overriding an explicit caller-provided message, though this is not critical in the current flow.

classes/controllers/FrmHooksController.php (1)

150-156: Filter registration updated to match new callback signature

Dropping the explicit (10, 2) on add_filter( 'frm_fields_in_form_builder', 'FrmFormsController::update_form_builder_fields' ) correctly aligns the hook with the new one-parameter update_form_builder_fields( $fields ). Other listeners on frm_fields_in_form_builder can still opt into the second argument by registering with $accepted_args = 2, so this should not affect third‑party filters.

Comment thread classes/helpers/FrmEntriesListHelper.php
Comment thread classes/helpers/FrmEntriesListHelper.php
Copy link
Copy Markdown
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: 4

🧹 Nitpick comments (2)
classes/models/fields/FrmFieldType.php (1)

910-917: Front‑end rendering and HTML helper docblocks look correct

For get_field_scripts_hook, after_replace_html_shortcodes, add_extra_html_atts, add_min_max, show_single_hidden, get_select_box, select_tag, and load_field_scripts, the added @param and @return tags match the current method signatures and how arguments/results are used (arrays of args, HTML fragments as strings, no returns where declared void). These will aid static analysis without affecting behavior. One tiny nit is that the $field param descriptions saying “Field settings array” (while typed array|object) could be relaxed to “Field settings” for strict consistency, but that’s purely cosmetic.

Also applies to: 974-982, 1162-1174, 1176-1201, 1280-1295, 1297-1323, 1325-1338, 1364-1372

classes/helpers/FrmFormsHelper.php (1)

1118-1157: Consider narrowing $form_id doc type to scalar IDs

The method treats $form_id as an identifier that’s concatenated into URLs and passed to helpers expecting an ID, while $form is the place where an object is normalized via FrmForm::getOne. To avoid implying that passing an object as $form_id is supported, consider updating the PHPDoc to:

@param int|string $form_id
@param mixed      $form
@return array

This better reflects current usage patterns and reduces the chance of someone passing an object where a scalar ID is expected.

📜 Review details

Configuration used: CodeRabbit UI

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 1fa36d5 and 3d84ebe.

📒 Files selected for processing (8)
  • classes/controllers/FrmEntriesController.php (14 hunks)
  • classes/controllers/FrmFormsController.php (19 hunks)
  • classes/helpers/FrmAppHelper.php (32 hunks)
  • classes/helpers/FrmFormsHelper.php (13 hunks)
  • classes/models/FrmFormAction.php (15 hunks)
  • classes/models/FrmFormMigrator.php (6 hunks)
  • classes/models/fields/FrmFieldType.php (16 hunks)
  • phpstan.neon (1 hunks)
🚧 Files skipped from review as they are similar to previous changes (3)
  • classes/models/FrmFormAction.php
  • classes/controllers/FrmFormsController.php
  • classes/helpers/FrmAppHelper.php
🧰 Additional context used
🧬 Code graph analysis (1)
classes/controllers/FrmEntriesController.php (1)
classes/helpers/FrmAppHelper.php (2)
  • FrmAppHelper (6-4786)
  • ips_saved (347-350)
⏰ 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: PHP 8 tests in WP trunk
  • GitHub Check: PHP 7.4 tests in WP trunk
  • GitHub Check: Cypress
🔇 Additional comments (27)
phpstan.neon (1)

137-139: <function_calls>

#!/bin/bash

Check phpstan.neon configuration

echo "=== phpstan.neon content around line 137-139 ==="
sed -n '130,150p' phpstan.neon

echo -e "\n=== Count of ignoreErrors in phpstan.neon ==="
rg -c 'message:' phpstan.neon

echo -e "\n=== Check if FrmFormAction has other suppressions ==="
rg -n 'FrmFormAction' phpstan.neon

echo -e "\n=== Check phpstan.neon header for configuration ==="
head -30 phpstan.neon


</function_calls>

# Look for WordPress stubs or type definitions
echo -e "\n=== Check composer.json for phpstan/wordpress versions ==="
jq '.require | keys[]' composer.json 2>/dev/null | grep -i phpstan

echo -e "\n=== Check if type casts exist elsewhere in codebase ==="
rg -n '\(WP_Post\)' --type=php | head -20
</parameter>
</invoke>
</invoke>
</function_calls>

</blockquote></details>
<details>
<summary>classes/controllers/FrmEntriesController.php (16)</summary><blockquote>

`134-138`: **LGTM!**

The PHPDoc accurately documents the parameter types and return type for this screen options filter method.

---

`217-222`: **LGTM!**

The PHPDoc correctly documents the method parameters including the pass-by-reference `$columns` array, and the void return type.

---

`242-247`: **LGTM!**

The PHPDoc is consistent with similar methods and accurately documents the parameters and return type.

---

`286-291`: **LGTM!**

The PHPDoc accurately documents this conditional column addition method.

---

`298-306`: **LGTM!**

The PHPDoc correctly documents this filter callback with appropriate parameter types.

---

`326-332`: **LGTM!**

The PHPDoc accurately documents this metadata update hook callback.

---

`384-387`: **LGTM!**

The PHPDoc correctly documents the parameter and return type for this utility method.

---

`397-400`: **LGTM!**

The PHPDoc correctly documents this utility method that generates column keys.

---

`412-418`: **LGTM!**

The PHPDoc accurately documents this filter callback for the per-page option.

---

`502-506`: **LGTM!**

The PHPDoc correctly documents this method that filters hidden columns for a specific form.

---

`598-602`: **LGTM!**

The PHPDoc accurately documents this method that calculates and stores the trash deletion time.

---

`616-618`: **LGTM!**

The PHPDoc correctly documents this entry display method.

---

`762-770`: **LGTM!**

The PHPDoc accurately documents this hook callback that deletes entries before redirecting.

---

`781-781`: **LGTM!**

The addition of the `@return void` completes the PHPDoc for this method.

---

`787-794`: **LGTM!**

The PHPDoc accurately documents this private entry deletion method.

---

`809-812`: **LGTM!**

The PHPDoc accurately documents this private method that unlinks entries from posts.

</blockquote></details>
<details>
<summary>classes/models/FrmFormMigrator.php (2)</summary><blockquote>

`162-166`: **LGTM! Accurate PHPDoc documentation.**

The parameter and return types are correctly documented for the `import_form` method.

---

`428-433`: **LGTM! Accurate PHPDoc documentation.**

The parameter and return types are correctly documented for the `form_creation_error_response` method.

</blockquote></details>
<details>
<summary>classes/models/fields/FrmFieldType.php (2)</summary><blockquote>

`437-446`: **Builder/options docblocks match actual usage**

The added `@param`/`@return` annotations for `show_options`, `show_field_options`, `show_single_option`, `has_field_choices`, and `displayed_field_type` correctly reflect how these methods are invoked and what they return (arrays and booleans keyed off field type). Nothing here changes runtime behavior, and the types look accurate for the current implementations.  



Also applies to: 479-510, 600-607, 616-626, 631-646

---

`730-746`: **Value-normalization helper docs are consistent with signatures**

The new/expanded docblocks on `default_value_to_string`, `maybe_trim_excess_values`, and `sanitize_value` align with the pass‑by‑reference signatures and the value shapes actually handled (`mixed` / `array|string`). The “passed by reference” descriptions are helpful for readers and tools; no issues from a type or behavior standpoint.  



Also applies to: 1470-1476, 1776-1788

</blockquote></details>
<details>
<summary>classes/helpers/FrmFormsHelper.php (6)</summary><blockquote>

`307-382`: **Docblocks for `setup_new_vars` and `setup_edit_vars` accurately describe types**

The new `@param`/`@return` annotations for these two helpers match how `$values`, `$record`, and `$post_values` are used and the fact they always return an array. No behavioral change and the documentation is consistent with the implementation.

---

`799-827`: **`maybe_create_end_section` PHPDoc matches implementation**

The new parameter annotations (`bool`, `int`, `array`, `object`, `string`) line up with how each argument is used, and omitting a `@return` tag is appropriate for this void helper.

---

`909-948`: **`get_form_style_class` union types and nullable return are correct**

Allowing `array|bool|int|object|string` for `$form` and documenting `string|null` for the return value matches all current code paths in this method.

---

`1226-1334`: **Trash/delete helper PHPDocs line up with behavior**

The added annotations for `delete_trash_link`, `format_link_html`, `delete_trash_info`, and `delete_trash_links` correctly describe the integer ID, string status/length, array structures, and return types (string or array). This clarifies usage without altering behavior.

---

`1374-1430`: **Layout and status helper PHPDocs are accurate**

The new `@return array` for `grid_classes` and the detailed annotations for `style_class_label` and `status_nice_name` accurately reflect the existing implementations and will make consuming these helpers clearer.

---

`1582-1600`: **`show_plan_required` parameter and void return docs match usage**

The added PHPDoc for `$requires` and `$link` as strings, and `@return void`, matches the control flow and echo-based behavior of this helper.

</blockquote></details>

</blockquote></details>

</details>

<!-- This is an auto-generated comment by CodeRabbit for review status -->

Comment thread classes/models/FrmFormMigrator.php
Comment thread classes/models/FrmFormMigrator.php
Comment thread classes/models/FrmFormMigrator.php
Comment thread classes/models/FrmFormMigrator.php
Copy link
Copy Markdown
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

Caution

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

⚠️ Outside diff range comments (3)
classes/models/FrmFormAction.php (3)

351-368: Align maybe_create_action() return type with actual return

maybe_create_action() returns $this->save_settings() or $this->duplicate_one(), both of which are int|WP_Error, but the docblock currently says @return int $post_id. This can mislead consumers and static tools.

Consider updating the return annotation:

-	 * @return int $post_id
+	 * @return int|WP_Error $post_id

657-674: Correct get_single_action_type() return type (currently misleading)

get_single_action_type() returns false when $type is empty, otherwise it returns the result of $action_control->get_single_action($action_id), which is object|null (WP_Post|null), not FrmFormAction.

The current @return bool|FrmFormAction is inaccurate.

Recommend updating to something along these lines:

-	 * @return bool|FrmFormAction
+	 * @return false|WP_Post|null

(or false|object|null if you prefer not to tie it to WP_Post).


687-741: Clarify get_all() return type – can be array or single action

get_all() returns:

  • array() when no actions,
  • an array of actions when $limit > 1,
  • a single action object when $limit === 1 (after reset($settings)).

The new @return array annotation is therefore incomplete.

Consider a more accurate return type such as:

-	 * @return array
+	 * @return array|object

(or a more specific union if you want to model the limit === 1 case).

♻️ Duplicate comments (4)
classes/models/FrmFormMigrator.php (4)

216-221: Document the pass-by-reference parameter.

The $form parameter is passed by reference (line 222) but the PHPDoc doesn't indicate this. Since this PR focuses on adding type comments, the documentation should accurately reflect that this parameter is mutated.


293-295: Document the pass-by-reference parameter.

The $fields parameter is passed by reference (line 297) but the PHPDoc doesn't indicate this. In a documentation-focused PR, it's important to accurately reflect that this parameter is mutated.


331-335: Document the pass-by-reference parameters.

Both $fields and $order are passed by reference (line 337) but the PHPDoc doesn't indicate this. Both parameters are mutated by this method.


350-356: Document the pass-by-reference parameter.

The $fields parameter is passed by reference (line 358) but the PHPDoc doesn't indicate this. This parameter is directly modified via array_splice.

📜 Review details

Configuration used: CodeRabbit UI

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 3d84ebe and 6bc240c.

📒 Files selected for processing (3)
  • classes/controllers/FrmFormsController.php (24 hunks)
  • classes/models/FrmFormAction.php (16 hunks)
  • classes/models/FrmFormMigrator.php (7 hunks)
🚧 Files skipped from review as they are similar to previous changes (1)
  • classes/controllers/FrmFormsController.php
🧰 Additional context used
🪛 GitHub Actions: Psalm Code Analysis
classes/models/FrmFormAction.php

[error] 281-281: InvalidDocblock: Found duplicated @param or prefixed @param tag in docblock for FrmFormAction::prepare_new (see https://psalm.dev/008)

⏰ 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: PHP 8 tests in WP trunk
  • GitHub Check: PHP 7.4 tests in WP trunk
  • GitHub Check: Cypress
🔇 Additional comments (16)
classes/models/FrmFormMigrator.php (3)

162-165: LGTM!

The PHPDoc correctly documents the parameter and return type for the import_form method.


428-431: LGTM!

The PHPDoc correctly documents the parameter and return type for the form_creation_error_response method.


457-459: LGTM!

The PHPDoc correctly documents the parameter types (including the appropriate union type for $form_id) and return type for the create_emails method.

classes/models/FrmFormAction.php (13)

182-190: Constructor PHPDoc additions look correct

The added param docs for $id_base, $name, $action_options, and $control_options match the signature and are clear.


207-215: get_group() docblock matches usage

The new @param array $action_options and @return array annotations correctly reflect the method’s contract.


235-245: get_field_name() param annotation is accurate

Adding @param string $post_field aligns with the default 'post_content' and helps static analysis.


311-322: create() return type docblock is consistent

create() ultimately returns FrmDb::save_settings() which yields int|WP_Error; the new @return int|WP_Error is correct and helpful.


324-344: duplicate_form_actions() docblock looks good

The @param int|string $form_id / $old_id and @return void annotations match the implementation (no return value).


370-403: duplicate_one() docblock now correctly reflects return type

The updated @return int|WP_Error matches the call to save_settings() and resolves the earlier mismatch with callers.


433-514: update_callback() annotations match behavior

@param int|string $form_id and @return array|null correctly describe that the method either returns an array of IDs or early-returns null.


549-563: get_single_action() docblock is reasonable

The new @param int $id and @return object|null mirror the get_post() + prepare_action() flow and are acceptable (even if the concrete type is WP_Post).


676-685: form_has_action_type() change is clean

Renaming to $actions and using ! empty( $actions ) with @return bool keeps behavior intact and improves clarity.


743-763: action_args() docblock matches usage

@param int $form_id, @param int $limit, and @return array align with the query args being built.


765-792: prepare_action() PHPDoc is accurate

Typing the parameter and return as WP_Post is consistent with get_post() usage and the fact that you’re mutating and returning the same post object.


794-818: destroy() param types look correct

@param false|int|string $form_id and @param string $type describe the inputs well, and @return void matches the implementation.


865-912: migrate_to_2() docblock improvements are correct

The added @param object $form, @param string $update, and @return int|WP_Error lines match the logic (migration may create/update an action and return the resulting post ID or WP_Error).

Comment thread classes/models/FrmFormAction.php
Copy link
Copy Markdown
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

Caution

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

⚠️ Outside diff range comments (2)
classes/models/FrmFormAction.php (2)

345-367: Include WP_Error in maybe_create_action() @return type

maybe_create_action() returns $post_id coming from:

  • save_settings( $action ), which returns int|WP_Error, and
  • duplicate_one(), which now correctly documents and returns int|WP_Error.

So the current docblock:

 * @return int $post_id

is too narrow. To keep type information accurate and avoid confusing static analysis, it should reflect the union:

-	 * @return int $post_id
+	 * @return int|WP_Error

duplicate_one()’s new @return int|WP_Error annotation is correct and consistent with save_settings().

Also applies to: 369-402


793-811: migrate_to_2() @return annotation doesn’t match possible array return

migrate_to_2() is documented as:

 * @return int|WP_Error

but in practice:

$post_id = get_posts( [ ..., 'numberposts' => 1 ] );

if ( empty( $post_id ) ) {
    $post_id = $this->save_settings( $action ); // int|WP_Error
}

// ...

return $post_id;

When an action already exists, $post_id is the array returned by get_posts(), not an int or WP_Error. So actual return type is int|WP_Error|array.

To reconcile this you have two options:

  1. Normalize to an ID (recommended if the intended contract is “ID or error”):

  • $post_id = get_posts(
    
  • 	array(
    
  • 		'name'        => $action->post_name,
    
  • 		'post_type'   => FrmFormActionsController::$action_post_type,
    
  • 		'post_status' => $action->post_status,
    
  • 		'numberposts' => 1,
    
  • 	)
    
  • );
    
  • if ( empty( $post_id ) ) {
    
  • 	// create action now
    
  • 	$post_id = $this->save_settings( $action );
    
  • }
    
  • $posts = get_posts(
    
  • 	array(
    
  • 		'name'        => $action->post_name,
    
  • 		'post_type'   => FrmFormActionsController::$action_post_type,
    
  • 		'post_status' => $action->post_status,
    
  • 		'numberposts' => 1,
    
  • 	)
    
  • );
    
  • if ( empty( $posts ) ) {
    
  • 	// create action now
    
  • 	$post_id = $this->save_settings( $action );
    
  • } else {
    
  • 	$post_id = $posts[0]->ID;
    
  • }
    
    
    This keeps the `@return int|WP_Error` contract true.
    
    
  1. Or, if callers genuinely expect the full post array, widen the docblock to include array and update callers accordingly.

Given this PR’s focus on type comments, I’d lean towards normalizing to an ID if that matches historical expectations.

Also applies to: 864-911

🧹 Nitpick comments (3)
classes/models/FrmFormAction.php (2)

432-513: Optional: tighten update_callback() return type to describe element types

update_callback() is annotated as @return array|null, but $action_ids is built from:

  • $new_instance['ID'] (ints), and
  • save_settings( $instance ) (int|WP_Error).

If you want more precise static analysis, consider clarifying the element type, e.g.:

 * @return array<int|WP_Error>|null

(or similar generic notation your tools prefer). Current behavior is correct; this is purely a type-precision improvement.


548-562: Optional: align get_single_action() return type with WP_Post

get_single_action() ultimately returns the result of get_post() passed through prepare_action(), so it’s effectively WP_Post|null in normal usage. Right now it’s documented as @return object|null.

If you want stronger typing and consistency with prepare_action()’s @param WP_Post / @return WP_Post, you could update the docblock to:

-	 * @return object|null
+	 * @return WP_Post|null

Behavior doesn’t change either way; this just improves clarity.

Also applies to: 764-791

classes/controllers/FrmFormsController.php (1)

3320-3332: Script defer helper and related docs – consider a more explicit strpos check

  • The new PHPDocs for defer_script_loading( $tag, $handle ), footer_js( $location ), maybe_minimize_form( $atts, &$content ), and is_minification_on( $atts ) all match current usage.
  • In defer_script_loading(), the stricter handle check ('captcha-api' === $handle) is good. The condition ! strpos( $tag, 'defer' ) works for typical <script> tags, but it relies on strpos() never returning 0. For future‑proofing, it would be more idiomatic (and robust) to use:
if ( 'captcha-api' === $handle && false === strpos( $tag, 'defer' ) ) {
    $tag = str_replace( ' src', ' defer="defer" async="async" src', $tag );
}

This avoids the edge case where 'defer' might appear at position 0 and be treated as “not found”.

Also applies to: 3334-3350, 3352-3365, 3367-3375

📜 Review details

Configuration used: CodeRabbit UI

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 6bc240c and 8ccd4d2.

📒 Files selected for processing (4)
  • classes/controllers/FrmFormsController.php (25 hunks)
  • classes/models/FrmFormAction.php (16 hunks)
  • tests/cypress/e2e/Forms/formPageDataValidation.cy.js (1 hunks)
  • tests/cypress/e2e/admin-a11y.cy.js (1 hunks)
⏰ 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 7.4 tests in WP trunk
  • GitHub Check: PHP 8 tests in WP trunk
🔇 Additional comments (16)
tests/cypress/e2e/Forms/formPageDataValidation.cy.js (1)

44-44: LGTM!

The additional expected heading text appropriately extends test coverage for promotional banner variations.

tests/cypress/e2e/admin-a11y.cy.js (1)

33-34: Based on my verification, I've gathered important information about this change:

Key Findings:

  1. axe-core 'region' rule verified: The rule checks that all page content (except skip links) is contained within landmark elements (HTML5 landmarks like <header>, <nav>, <main>, <footer> or ARIA landmark roles). This is a best-practice check for screen reader navigation.

  2. Scope of impact: The 'region' rule is now disabled across 9+ admin page tests that use baselineRules (including dashboard, form list, entries, import/export, global settings, add-ons, SMTP, and trash pages).

  3. No tracking found: I found no TODOs, FIXMEs, GitHub issues, or documentation comments in the codebase indicating that this accessibility gap is being tracked as technical debt. The rule is simply silently disabled without an apparent remediation plan.

  4. Consistency: The 'region' rule also appears disabled in form-preview-a11y.cy.js with the same pattern.


Confirm the landmark region violations are documented or tracked as technical debt.

Disabling the region rule allows content to live outside landmark regions without detection, affecting screen reader navigation across multiple admin pages. No tracking mechanism is visible in the codebase for remediating these issues. Consider creating a GitHub issue to formally document this accessibility debt before merging.

classes/models/FrmFormAction.php (3)

182-190: Constructor and helper PHPDoc additions look consistent

The added/expanded annotations for the legacy constructor, get_group(), and get_field_name() correctly reflect the signatures and current usage; no inconsistencies spotted.

Also applies to: 207-213, 235-245


275-321: prepare_new() and create() PHPDoc now accurately match behavior

  • prepare_new()’s @param false|int|string $form_id and @return object align with how $form_id is used and the (object) $form_action return.
  • create()’s @param int|string $form_id and @return int|WP_Error are consistent with delegating to save_settings().

Nothing else to adjust here.


323-343: duplicate_form_actions() / form_has_action_type() docs and minor rename are sound

  • duplicate_form_actions()’s param types for $form_id and $old_id match how they’re used as menu_order values.
  • form_has_action_type()’s new PHPDoc and the rename to $actions align with the actual call to get_action_for_form() and its boolean result check.

All good in this area.

Also applies to: 675-684

classes/controllers/FrmFormsController.php (11)

75-89: Divi conflict filter PHPDoc matches implementation

The new @param array $shortcodes and @return array annotations on prevent_divi_conflict() correctly describe how the function is used (pushes 'formidable' into the array and returns it). No behavior change here.


200-211: Type docs for edit() and update() align with usage

Documenting edit( $values = false ) as array|false and update( $values = array() ) as array matches how these methods are called (either with an array from routing/JSON or falling back to $_POST). The annotations look accurate and should help static analysis without changing behavior.

Also applies to: 281-327


632-646: preview_page_title() PHPDoc is accurate

The added @param string $title / @return string docs match the filter signature and implementation ($title is always returned as a string). No issues here.


1428-1437: form_publish_button() param/return annotations look correct

The new @param array $atts and @return void tags match the current usage ($atts['values'] is read and no value is returned). This is consistent and non‑breaking.


1920-1973: Bulk actions and view/report/admin‑bar helpers: docs match behavior

  • process_bulk_form_actions( array $errors ) : array matches how the method is used and what it returns.
  • no_views( $values = array() ) and no_reports( $values = array() ) now document the $values argument even though they currently ignore it, which is fine for filters/actions.
  • add_forms_to_admin_bar( $actions ) is correctly described as taking an array and returning void.

These PHPDoc additions look accurate and don’t affect runtime.

Also applies to: 2136-2146, 2153-2161, 2210-2249


2440-2451: Saved‑errors and entry‑lookup docs are a good fit

  • get_saved_errors( $form, $params ) : array now documents $form as object and $params as array, which matches the usage ($form->id and FrmForm::get_params()).
  • just_created_entry( $form_id ) : int matches how the function is used (array key into $frm_vars['created_entries'], returning an entry ID or 0).

These clarifications should help static analysis without changing behavior.

Also applies to: 2467-2476


2720-2751: On‑submit actions and page‑load helper docs reflect actual usage

  • run_on_submit_actions( array $args ) is now clearly documented and matches the internal contract used in get_form_contents().
  • load_page_after_submit( array $args )’s PHPDoc matches how $args is constructed and consumed (expects keys like success_opt, form, entry_id).

No behavioral changes here; the type comments look correct.

Also applies to: 2823-2854


3060-3087: Success‑message / post‑submit helpers: array param docs look right

The added/expanded PHPDocs for:

  • show_message_after_save( array $atts )
  • show_form_after_submit( array $args )
  • fill_atts_for_form_display( array &$args )
  • show_lone_success_message( array $atts )

all accurately describe how these methods are being passed associative arrays and return no value. The by‑reference usage of $args in fill_atts_for_form_display() is consistent with the docs and call sites.

Also applies to: 3090-3127, 3161-3189, 3191-3212


3493-3502: Deprecated create() PHPDoc is now explicit and consistent

Adding @param array $values and @return void to create() matches what the method does (proxy to update() after _deprecated_function()). This is a nice clarity/typing improvement without affecting behavior.


1252-1355: Hook registration is correctly configured – no changes needed

The frm_fields_in_form_builder filter is registered in FrmHooksController.php:154 without an explicit $accepted_args parameter:

add_filter( 'frm_fields_in_form_builder', 'FrmFormsController::update_form_builder_fields' );

WordPress defaults $accepted_args to 1 when omitted. Since update_form_builder_fields() accepts only one parameter ($fields), WordPress will correctly pass only the first argument to the callback, making this safe and compatible with the two-argument apply_filters() call at line 1318.

The PHPDoc suggestion remains optional but reasonable for tooling clarity.


1664-1700: I'll help you verify the review comment about the $settings_tab type consistency. Let me start by examining the FrmAppHelper::is_admin_page() method to confirm its return type.
<function_calls>

#!/bin/bash

Search for FrmAppHelper class and is_admin_page method definition

rg -n "function is_admin_page" -C5 --type php


</function_calls>

I'll search for the is_admin_page method definition to check its return type:
<function_calls>

#!/bin/bash

Find FrmAppHelper file and is_admin_page method

find . -type f -name "*.php" | xargs grep -l "class FrmAppHelper"


</function_calls>

Let me take a broader approach to locate this class:
<function_calls>

#!/bin/bash

Search for is_admin_page method definition

rg -n "function is_admin_page" -A10 --type php


</function_calls>

Now let me find where get_shortcode_helpers() calls is_admin_page():
<function_calls>

#!/bin/bash

Search for get_shortcode_helpers method

rg -n "function get_shortcode_helpers" -A20 --type php


</function_calls>

Let me also search for the specific file mentioned in the review and examine it:
<function_calls>

#!/bin/bash

Read the FrmFormsController.php file around the mentioned lines

sed -n '1754,1793p' classes/controllers/FrmFormsController.php


</function_calls>

Let me check if the file exists and examine more context:
<function_calls>

#!/bin/bash

Find FrmFormsController.php

find . -name "FrmFormsController.php" -type f


</function_calls>

<function_calls>

#!/bin/bash

List the repository structure to understand organization

ls -la


</function_calls>

<function_calls>

#!/bin/bash

Get list of PHP files related to controllers

find . -path "/controllers/.php" -type f | head -20


</function_calls>

Let me search more broadly for these methods:
<function_calls>

#!/bin/bash

Search for get_shortcode_helpers in all PHP files

rg "get_shortcode_helpers" -n --type php -C3


</function_calls>

<function_calls>

#!/bin/bash

Search for is_admin_page calls to understand how it's used

rg "is_admin_page" -n --type php -C3


</function_calls>

Let me check the git repository information:
<function_calls>

#!/bin/bash

Check git status and repository info

git log --oneline -1
git branch -a


</function_calls>

<function_calls>

#!/bin/bash

List all PHP files in the repo

git ls-files "*.php" | head -30


</function_calls>

<function_calls>

#!/bin/bash

Search more specifically for FrmAppHelper

git ls-files "*.php" | xargs grep -l "class FrmAppHelper" 2>/dev/null


</function_calls>

<function_calls>

#!/bin/bash

Get comprehensive list of all files to understand repo structure

git ls-files | grep -E "(Helper|Controller)" | head -20


</function_calls>

Let me try a different approach - search for any mention of these function/class names:
<function_calls>

#!/bin/bash

Search in all tracked files

git ls-files | xargs grep -l "is_admin_page" 2>/dev/null | head -10


</function_calls>

<function_calls>

#!/bin/bash

Try to understand the repository structure

git ls-files | head -50


</function_calls>

Let me try Python to help search through the repository more effectively:
<function_calls>

#!/bin/bash
python3 << 'EOF'
import subprocess
import os

Get all PHP files

result = subprocess.run(['git', 'ls-files', '*.php'], capture_output=True, text=True)
files = result.stdout.strip().split('\n')

print(f"Total PHP files: {len(files)}")
print("\nFirst 20 PHP files:")
for f in files[:20]:
print(f)
EOF


</function_calls>

<function_calls>

#!/bin/bash

Check if there are any files at all

ls -la | head -20
pwd


</function_calls>

<function_calls>

#!/bin/bash

List git tracked files count

git ls-files | wc -l
git ls-files | head -50


</function_calls>

Based on my attempts to locate the codebase files, it appears the repository may not have been cloned into the sandbox environment, or the files are not accessible. Let me verify the current state and provide guidance:
<function_calls>

#!/bin/bash

Check current directory and git status

git status


</function_calls>

Given that I'm unable to access the repository files to perform the verification, I need to gather information differently. Let me search for documentation or type information about the is_admin_page() method:
<function_calls>

FrmAppHelper is_admin_page return type PHP

</function_calls>

Comment thread classes/models/FrmFormAction.php
Copy link
Copy Markdown
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: 0

Caution

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

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

3016-3044: Regex in get_formatted_time is invalid and should be fixed

While this hunk only updates PHPDoc, the nearby regex:

if ( preg_match( '/^\d{1-2}\/\d{1-2}\/\d{4}$/', $date ) && self::pro_is_installed() ) {

uses {1-2} which is not a valid quantifier in PCRE. This will trigger a compilation warning and cause preg_match to always fail.

It looks like the intention was {1,2} (“1 or 2 digits”). Suggest:

-		if ( preg_match( '/^\d{1-2}\/\d{1-2}\/\d{4}$/', $date ) && self::pro_is_installed() ) {
+		if ( preg_match( '/^\d{1,2}\/\d{1,2}\/\d{4}$/', $date ) && self::pro_is_installed() ) {

Since this can emit PHP warnings at runtime, it’s worth fixing even though it predates the doc change.

🧹 Nitpick comments (3)
classes/helpers/FrmAppHelper.php (3)

2006-2020: Consider using core helpers and escaping for post_edit_link

New post_edit_link( $post_id ) is generally fine, but a couple of small improvements would make it more robust:

  • Core already provides get_edit_post_link( $post_id ), which also respects permissions; using it would align behavior with WP expectations.
  • Even though truncate() strips tags, wrapping the title in esc_html() would make the intent explicit and guard against any future change to truncate().

For example:

-		$post = get_post( $post_id );
-		if ( $post ) {
-			$post_url = admin_url( 'post.php?post=' . $post_id . '&action=edit' );
-
-			return '<a href="' . esc_url( $post_url ) . '">' . self::truncate( $post->post_title, 50 ) . '</a>';
-		}
+		$post = get_post( $post_id );
+		if ( $post ) {
+			$post_url = get_edit_post_link( $post );
+
+			if ( ! $post_url ) {
+				return '';
+			}
+
+			return '<a href="' . esc_url( $post_url ) . '">' . esc_html( self::truncate( $post->post_title, 50 ) ) . '</a>';
+		}

2476-2482: Docstring for replace_quotes is misleading

The summary says “Replace quotes with their HTML entities”, but the implementation does the opposite: it replaces several HTML entities for curly/prime quotes with straight ASCII "'" characters.

Consider rewording to avoid confusion, e.g.:

/**
 * Normalize HTML-encoded quote entities to straight ASCII quotes.
 *
 * @param string $val
 * @return string
 */

3141-3177: time_format and convert_time docs: return type mismatch

  • time_format()’s docblock matches behavior (int return after floor()).
  • convert_time() is annotated as returning int, but it may return a float (months and years use fractional day constants, and the division itself is not cast).

For accuracy, consider updating:

/**
 * @return float
 */
private static function convert_time( $from, $to ) {

This avoids misleading static analysis and future readers.

📜 Review details

Configuration used: CodeRabbit UI

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 8ccd4d2 and 763b63f.

📒 Files selected for processing (2)
  • classes/helpers/FrmAppHelper.php (32 hunks)
  • classes/models/FrmFormAction.php (16 hunks)
🚧 Files skipped from review as they are similar to previous changes (1)
  • classes/models/FrmFormAction.php
⏰ 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). (1)
  • GitHub Check: Cypress
🔇 Additional comments (21)
classes/helpers/FrmAppHelper.php (21)

943-1116: Sanitization helpers PHPDoc updates look consistent with behavior

The added/expanded docs around decode_specialchars, decode_amp, kses, and allowed_html correctly describe by‑reference parameters and value types; signatures and behavior remain unchanged and coherent with existing usage.


1287-1315: Query var helper type hints are reasonable

Documenting $value in get_query_var() as array|string and $param as string matches the loose behavior (early-return if already populated, otherwise WP_Query lookup). No functional concerns here.


1623-1683: show_search_box PHPDoc matches implementation

The new @param array $atts / @return void annotations align with how $atts is merged with defaults and only echoed. No functional changes; behavior still looks good.


1686-1696: trigger_hook_load docblock clarification

The new parameter docs for $type and optional $object match existing usage and the filter/action signatures. No behavior change; implementation remains straightforward.


1965-2004: Page dropdown helper docs match usage

The updated docs for prep_page_dropdown_params() and preformat_selection_args() (deprecated params + mixed $args) accurately describe how old call styles are normalized into the current array format. No changes needed.


2287-2310: Permission helper docblocks align with current behavior

The added parameter docs for permission_check() ($show_message) and permission_nonce_error() ($nonce_name, $nonce) correctly describe the existing control flow (optional nonce validation + capability check). No implementation issues spotted.


2332-2357: Selection helpers: docs and behavior look good

New docblocks for checked() and check_selected() correctly capture the accepted types (array|string) and return types. The trimming + htmlspecialchars_decode via recursive_function_map() makes sense for robust comparisons against $current.


2404-2440: array_flatten / safe_implode docs match behavior

The clarified docs (array + $keys mode, returning array/string) correctly reflect what array_flatten() and safe_implode() do. Logic remains unchanged and still guards against “Array to string conversion” notices.


2465-2474: use_wpautop type hints are accurate

Annotating $content as mixed and the return as mixed is appropriate given the early is_string() guard. No behavior change; OK as is.


2494-2515: script_version docblock matches implementation

The new @param and @return int|string annotations align with how $default is passed through and how $query->ver is extracted. Logic still correctly defends against missing $wp_scripts or unregistered handles.


2999-3013: mb_function helper implementation and docs look solid

The new mb_function( array $function_names, array $args ) correctly prefers the multibyte function when available and falls back to the non‑mb equivalent. Call sites in truncate() pass compatible pairs (mb_strlen/strlen, mb_substr/substr, mb_split/explode), so signatures line up.

No changes needed.


3066-3077: get_localized_date docs align with behavior

The added params/return annotations (string $date_format, string $date, string return) match the implementation that converts from GMT and delegates to date_i18n(). No further comments.


3083-3136: human_time_diff parameter docs and behavior are consistent

Documenting $from/$to as seconds and $levels as int|string matches usage (Unix timestamps wrapped via DateTime('@...'), with $levels either depth or a specific unit). The logic for unit selection and filtering via frm_time_ago_levels still looks correct.


3193-3211: get_unit docblock is accurate

The @return int|string annotation fits the implementation (either returns the original unit string, numeric, or 1 as a fallback). No behavior concerns.


3286-3339: json_to_array docblock and behavior

The addition of @param array $json_vars / @return array correctly captures how this converts serialized form-style name/value pairs into a nested array. The implementation’s use of add_value_to_array() and nested switches is unchanged; no obvious correctness issues.


3341-3355: add_value_to_array docs match its current semantics

The new annotations for $val and $vars reflect existing behavior: this helper only sets the first occurrence for a given key (unless $name is empty, in which case it appends). That behavior is consistent with how json_to_array() uses it.


3390-3408: select_current_page docblock updates look good

Documenting $page/$current_page as int|string and $action as array matches how they’re compared and how the optional action filtering works. No change in logic; still a simple echo‑side effect helper.


3570-3595: format_form_data annotations are accurate

The updated doc (@param array $form by reference, @return void) aligns with this method mutating $form in place based on name/value pairs. Implementation remains unchanged and still uses http_build_query/parse_str correctly.


4139-4151: get_images_dropdown_atts docblock is clear and correct

New docs for $option and $args match usage: it composes the image HTML, extra classes, and custom attributes into a compact array consumed by the images dropdown view. No issues.


4379-4393: get_landing_page_upgrade_data_params type docs align with usage

Adding @param string $medium and array return type matches how $medium is dropped into the params array and how get_upgrade_data_params() is called. Everything stays backward‑compatible.


3853-3875: min_pro_version_notice parameter doc

The new @param string $min_version annotation correctly reflects current calls and the version comparison against FrmProDb::$plug_version. Implementation is otherwise unchanged and still guards against non‑Pro installs.

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