Add return type comments and more missing param type comments#2609
Conversation
WalkthroughThis PR introduces widespread PHPDoc documentation improvements across ~100+ files, primarily adding return type and parameter annotations to existing methods without altering their signatures. Key functional additions include new addon license management methods in FrmAddon, enhanced CSV export parameter/header handling, new unread inbox retrieval in FrmInbox, new FrmFormState getter method, and invoice handling improvements in Stripe payment processing. Configuration changes to phpstan.neon shift ignore rules from global to file-scoped patterns. Changes
Estimated code review effort🎯 4 (Complex) | ⏱️ ~70 minutes Areas requiring extra attention:
Possibly related PRs
Suggested reviewers
Pre-merge checks and finishing touches✅ Passed checks (3 passed)
✨ Finishing touches
🧪 Generate unit tests (beta)
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. Comment |
There was a problem hiding this comment.
Actionable comments posted: 3
Caution
Some comments are outside the diff and can’t be posted inline due to platform limitations.
⚠️ Outside diff range comments (3)
classes/controllers/FrmOnboardingWizardController.php (1)
504-509: Documentation mismatch: docstring describes wrong functionality.The docblock for
get_page_url()states "Get the path to the Onboarding Wizard views" (lines 504-509), but this method actually returns the URL to access the page, not the filesystem path. The description appears to be copied fromget_view_path(). This is a pre-existing documentation error unrelated to this PR's changes, but worth correcting.Suggested fix:
/** - * Get the path to the Onboarding Wizard views. + * Get the URL to access the Onboarding Wizard page. * * @since 6.9 * - * @return string Path to views. + * @return string URL to access the Onboarding Wizard page. */ public static function get_page_url() { return self::$page_url; }classes/helpers/FrmTipsHelper.php (1)
398-402: Add empty array guard to prevent runtime exception.If
$tipsis an empty array,count($tips) - 1equals-1, causingrandom_int(0, -1)to throw aValueErrorbecause the minimum exceeds the maximum. This can crash the application when any tip-generation method returns an empty array.Apply this diff to add a guard:
public static function get_random_tip( $tips ) { + if ( empty( $tips ) ) { + return array(); + } $random = random_int( 0, count( $tips ) - 1 ); return $tips[ $random ]; }classes/controllers/FrmStylesController.php (1)
837-849: Add null check forget_default_style()return value to prevent potential null dereference.The
FrmStyle::get_default_style()method (line 566 inclasses/models/FrmStyle.php) can implicitly return null if the foreach loop doesn't find a style with a truthymenu_ordervalue. Line 846 inget_custom_css()directly accesses$style->post_content['custom_css']without null protection, which will fail ifget_default_style()returns null.Recommended fix:
$style = $frm_style->get_default_style(); if ( $style && isset( $style->post_content['custom_css'] ) ) { $custom_css = $style->post_content['custom_css']; } else { $custom_css = ''; // or appropriate fallback }
🧹 Nitpick comments (23)
classes/models/fields/FrmFieldCreditCard.php (1)
24-26:@return arrayannotation matches implementationThe new docblock correctly documents the return type as
arrayforfield_settings_for_type(), which always returns the$settingsarray literal. If you want to go further for static analysis, you could narrow it to something like@return array<string,bool>(or a shaped array), but that’s optional given the current project style.classes/models/FrmPersonalData.php (1)
160-162: Docblock return type is correct; optional clarification.
get_current_page()does return a string (the LIMIT clause), so@return stringis accurate and helpful. If you want to go a bit further, you could add a short description (e.g., “SQL LIMIT string for the current page”) to make its purpose clearer to readers and static analyzers.classes/models/FrmFieldOption.php (1)
37-43: Constructor docblock looks correct; optional opportunity to tighten$argstypeThe param/return annotations here are consistent with the properties and constructor behavior, and adding
@return voidis fine for tooling and readability. If you know the expected structure of$args, you could optionally narrow it (e.g.,array<string,mixed>) to give static analysis a bit more signal, but it’s not required for this PR’s goal.classes/models/FrmInstallPlugin.php (1)
28-28: Consider removing the unused$filevariable.The
list()unpacking assigns to both$slugand$file, but$fileis never used. You can simplify this by using array destructuring with underscore or extracting only what's needed.Apply this diff to clean up the unused variable:
- list( $slug, $file ) = explode( '/', $this->plugin_file ); + list( $slug ) = explode( '/', $this->plugin_file );Alternatively, using modern PHP array destructuring:
- list( $slug, $file ) = explode( '/', $this->plugin_file ); + [ $slug ] = explode( '/', $this->plugin_file );classes/models/FrmFormApi.php (1)
263-267: Return type docblock matches implementation; consider narrowing fromobjectif possibleThe new
@return false|objectaccurately reflects the two return paths ($updaterorfalse). If the updater has a stable concrete class or interface in this codebase, you might optionally tighten this tofalse|SomeUpdaterClass(or similar) for better static analysis and IDE support, but the current annotation is correct and safe.classes/helpers/FrmShortcodeHelper.php (1)
131-138: PHPDoc matches method signature and behaviorThe parameter and return types in the new docblock correctly reflect the method’s current signature and side‑effect‑only behavior. If you want to be extra explicit, you could denote
$htmlas by‑reference (e.g.,@param string &$htmlor a short description mentioning it’s modified in place), but that’s optional given the signature already shows&.classes/models/FrmFormState.php (1)
77-85: Docblock and getter behavior look good; consider adding an@sincetagThe
get( $key, $default )implementation is straightforward and correctly mirrors the pattern used byget_from_request, and the docblock accurately reflects the signature and return value. Since this is a new public accessor method, you may want to add an@sincetag to the docblock for API clarity and consistency with other documented entry points.classes/helpers/FrmOnSubmitHelper.php (1)
140-150: Observation: Pre-existing cache bug inget_actions().Outside the scope of this PR, but line 148 calls
wp_cache_set( $cache_key, 'frm_actions' )with only two arguments. The signature iswp_cache_set( $key, $data, $group ), so the cache group is being passed as the value, and $actions is never cached. This should bewp_cache_set( $cache_key, $actions, 'frm_actions' ). Worth addressing separately if not already known.classes/models/FrmInstallerSkin.php (1)
49-103: Optional: add@return voidto other void methods for consistency
header(),footer(),error(), andfeedback()also return nothing; consider adding@return voidto their docblocks to fully align this class with the PR’s “add return type comments” objective.classes/models/FrmCreateFile.php (1)
189-191: Verify return type precision forget_creds().The return type is documented as
array|bool. However, examining the code flow:
- Line 199:
request_filesystem_credentials()returnsarray|false(nottrue)- Line 201:
get_ftp_creds()returnsarray|false(documented at line 210)Using
array|falsewould be more precise and consistent with theget_ftp_creds()return type on line 210. Consider updating this for consistency.classes/helpers/FrmFormMigratorsHelper.php (1)
114-121: Consider refactoring for consistency.The PHPDoc accurately describes the current behavior, but the function mixes two patterns: returning an empty string on early exit (line 121) versus outputting HTML and implicitly returning null. Since the return value is never used (line 33), consider refactoring for clarity:
Option 1: Make it void (preferred for side-effect functions)
/** * @param array $install * - * @return string|null + * @return void */ private static function install_banner( $install ) { if ( empty( $install['link'] ) ) { - return ''; + return; }Option 2: Use output buffering to always return a string
private static function install_banner( $install ) { if ( empty( $install['link'] ) ) { return ''; } + ob_start(); ?> <div class="frm-feature-banner"> <!-- ... HTML ... --> </div> <?php + return ob_get_clean(); }classes/models/FrmStyle.php (1)
561-565: Tightenget_default_style()return PHPDoc to match actual typesThe implementation returns the same kind of style objects as
get_all()/get_one()(i.e.,WP_PostorstdClass) ornullwhen none is found. Usingobject|nullis technically correct but overly generic and inconsistent with neighboring docblocks.Consider narrowing the type for better static analysis and consistency:
- /** - * @param array|null $styles - * - * @return object|null - */ + /** + * @param array|null $styles + * + * @return stdClass|WP_Post|null + */classes/models/FrmSolution.php (1)
320-323: get_steps_data() return annotation matches implementation (optionally could be more specific)
@return arrayaligns with the$stepsstructure returned here and is accurate. If you ever want stricter static analysis, you could later refine this to a keyed array/shape, but it’s not necessary for this PR.classes/controllers/FrmOverlayController.php (2)
56-58: Consider enhancing the PHPDoc with config details or cross-reference.The added PHPDoc accurately documents the parameter type but could be more helpful by either describing the required array structure inline or referencing the detailed documentation at lines 23-31.
Consider one of these approaches:
/** - * @param array $config + * @param array $config { + * @type string $execution-frequency Time interval for recurring execution (e.g., '1 day', '1 week'). + * @type string $config-option-name Handle name for storing overlay options. + * }Or add a cross-reference:
/** - * @param array $config + * @param array $config See {@see FrmOverlayController::$config} for structure details. + * @return void
60-62: Consider adding feedback for invalid configuration.The constructor silently returns when required config keys are missing, leaving the instance in a non-functional state without notification. While this doesn't cause errors, it could lead to confusion when the overlay doesn't behave as expected.
Consider adding developer feedback:
public function __construct( $config = array() ) { if ( ! isset( $config['config-option-name'] ) || ! isset( $config['execution-frequency'] ) ) { + // phpcs:ignore WordPress.PHP.DevelopmentFunctions.error_log_trigger_error + trigger_error( 'FrmOverlayController requires config-option-name and execution-frequency keys.', E_USER_NOTICE ); return; }Alternatively, validate and throw an exception if the config is required for the instance to function properly.
classes/controllers/FrmEntriesController.php (1)
445-474: (Optional) Consider narrowing theroute()return type
route()currently only ever returnsnull/no meaningful value (calling methods that themselves return void). If there’s no expectation for third‑party overrides to return content, you could narrow its PHPDoc to@return voidfor clearer static analysis; otherwisemixedis fine.Also applies to: 112-134
classes/controllers/FrmDashboardController.php (1)
445-456: Consider minor refinements to the regex replacement.The regex pattern correctly removes dismiss buttons, but consider these optional improvements:
- Type safety: The
$ctaparameter lacks type validation beforepreg_replace(). Consider adding a type check or type hint.- Whitespace handling: Replacing matches with a single space (line 455) may create extra whitespace. Consider using an empty string
''or adding a trim operation afterward.Apply this diff to add a type hint and adjust whitespace handling:
/** * Clean messages CTA. * * @param string $cta * @return string */ -private static function inbox_clean_messages_cta( $cta ) { +private static function inbox_clean_messages_cta( string $cta ): string { // remove dismiss button $pattern = '/<a[^>]*class="[^"]*frm_inbox_dismiss[^"]*"[^>]*>.*?<\/a>/is'; - return preg_replace( $pattern, ' ', $cta ); + return preg_replace( $pattern, '', $cta ); }square/helpers/FrmSquareLiteConnectHelper.php (1)
678-682: Consider adding a PHPDoc block for documentation consistency.While the method logic is straightforward, public methods benefit from documentation, especially regarding return behavior and side effects (disconnects and resets Square API integration).
Apply this diff to add documentation:
+ /** + * Handle disconnect request from AJAX. + * + * @return void + */ public static function handle_disconnect() { self::disconnect(); self::reset_square_api_integration(); wp_send_json_success(); }classes/models/FrmFieldValue.php (1)
112-123:@return mixedannotations match behavior; small message/method-name nitThe new
@return mixeddocblocks for:
get_field_option()get_field_attr()get_saved_value()get_displayed_value()are consistent with how these methods are currently implemented (they can legitimately surface a variety of types, depending on field config and filters). No functional concerns here.
One minor consistency nit while we’re in this area: in
get_displayed_value(), the error message refers toprepare_display_value()but the actual method name isprepare_displayed_value(). Consider tightening this up:- return __( 'The display value has not been prepared. Please use the prepare_display_value() method before calling get_displayed_value().', 'formidable' ); + return __( 'The display value has not been prepared. Please use the prepare_displayed_value() method before calling get_displayed_value().', 'formidable' );Also applies to: 125-134, 189-210
classes/controllers/FrmAddonsController.php (1)
476-499: Return type ofis_license_expireddoes not match its docblockThe docblock says
@return bool, but the method returns eitherfalseor$version_info['error'](an array). Consider either:
- Normalizing the method to return a strict
bool, or- Updating the annotation to something like
@return bool|arrayand, ideally, renaming the method to better reflect the non-boolean return.classes/models/fields/FrmFieldCaptcha.php (1)
402-406: Clarify unused$frm_settingsparameter insend_api_check()The new docblock correctly describes
@param FrmSettings $frm_settingsand@return array|WP_Error, but the method no longer uses$frm_settingsinternally (it relies onFrmCaptchaFactory::get_settings_object()instead).To avoid future confusion, consider noting this in the docblock, e.g.:
- * @param FrmSettings $frm_settings + * @param FrmSettings $frm_settings Unused, kept for backwards compatibility.This keeps the signature stable while signalling that the param isn’t read.
phpstan.neon (2)
34-34: Global ignore for “no value type specified” remains broadYou’ve tightened other “missing type” ignores to specific paths, but
'#no value type specified.#'is still a global ignore. If the medium‑term goal is to enforce collection value types project‑wide, consider scoping this pattern to selected files as you did for return types, instead of suppressing it everywhere.Please double‑check how often this rule currently fires in phpstan and whether further scoping makes sense for your codebase.
137-194: New file‑scoped ignore blocks for return/type messages look fine, but can be tidiedThe two new
ignoreErrorsentries for:
'#has no return type specified#''#with no type specified#'scoped to a list of concrete file paths are a good step away from blanket suppression.
A couple of minor cleanup points:
- Some paths are duplicated multiple times (for example
classes/models/FrmEntryValidate.phpappears more than once in each list).- A few entries appear to have trailing spaces (e.g.
classes/controllers/FrmEmailStylesController.php), which may prevent exact path matching depending on how NEON is parsed.Neither affects correctness dramatically, but deduplicating and trimming would keep the config clearer and avoid surprises if phpstan ever becomes stricter about path matching.
Please run phpstan locally and confirm that:
- these ignore patterns are actually matching the intended files (no unexpected “unmatched ignored errors”), and
- you’re not still getting “has no return type specified” / “with no type specified” warnings from files you expected to be covered.
📜 Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro
⛔ Files ignored due to path filters (3)
composer.jsonis excluded by!**/*.jsonphpcs.xmlis excluded by!**/*.xmlpsalm.xmlis excluded by!**/*.xml
📒 Files selected for processing (61)
classes/controllers/FrmAddonsController.php(4 hunks)classes/controllers/FrmAppController.php(6 hunks)classes/controllers/FrmCronController.php(1 hunks)classes/controllers/FrmDashboardController.php(1 hunks)classes/controllers/FrmEmailStylesController.php(1 hunks)classes/controllers/FrmEmailSummaryController.php(1 hunks)classes/controllers/FrmEntriesController.php(8 hunks)classes/controllers/FrmFieldsController.php(5 hunks)classes/controllers/FrmFormTemplatesController.php(1 hunks)classes/controllers/FrmOnboardingWizardController.php(1 hunks)classes/controllers/FrmOverlayController.php(1 hunks)classes/controllers/FrmSettingsController.php(10 hunks)classes/controllers/FrmStylesController.php(9 hunks)classes/controllers/FrmUsageController.php(2 hunks)classes/controllers/FrmWelcomeTourController.php(2 hunks)classes/controllers/FrmXMLController.php(2 hunks)classes/factories/FrmFieldFactory.php(1 hunks)classes/helpers/FrmCSVExportHelper.php(13 hunks)classes/helpers/FrmEmailSummaryHelper.php(7 hunks)classes/helpers/FrmEntriesListHelper.php(4 hunks)classes/helpers/FrmFieldGridHelper.php(1 hunks)classes/helpers/FrmFormActionsHelper.php(1 hunks)classes/helpers/FrmFormMigratorsHelper.php(1 hunks)classes/helpers/FrmFormTemplatesHelper.php(1 hunks)classes/helpers/FrmOnSubmitHelper.php(7 hunks)classes/helpers/FrmShortcodeHelper.php(1 hunks)classes/helpers/FrmStylesHelper.php(7 hunks)classes/helpers/FrmSubmitHelper.php(4 hunks)classes/helpers/FrmTipsHelper.php(1 hunks)classes/models/FrmAntiSpam.php(1 hunks)classes/models/FrmCreateFile.php(3 hunks)classes/models/FrmDb.php(5 hunks)classes/models/FrmEmail.php(1 hunks)classes/models/FrmEmailStats.php(2 hunks)classes/models/FrmEntryShortcodeFormatter.php(1 hunks)classes/models/FrmFieldOption.php(1 hunks)classes/models/FrmFieldValue.php(8 hunks)classes/models/FrmFormApi.php(1 hunks)classes/models/FrmFormState.php(1 hunks)classes/models/FrmFormTemplateApi.php(1 hunks)classes/models/FrmHoneypot.php(5 hunks)classes/models/FrmInbox.php(2 hunks)classes/models/FrmInstallPlugin.php(1 hunks)classes/models/FrmInstallerSkin.php(2 hunks)classes/models/FrmPersonalData.php(1 hunks)classes/models/FrmSalesApi.php(1 hunks)classes/models/FrmSettings.php(3 hunks)classes/models/FrmSolution.php(3 hunks)classes/models/FrmSpamCheck.php(1 hunks)classes/models/FrmSpamCheckDenylist.php(7 hunks)classes/models/FrmStyle.php(1 hunks)classes/models/fields/FrmFieldCaptcha.php(2 hunks)classes/models/fields/FrmFieldCheckbox.php(1 hunks)classes/models/fields/FrmFieldCreditCard.php(1 hunks)classes/models/fields/FrmFieldHidden.php(1 hunks)classes/models/fields/FrmFieldRadio.php(1 hunks)classes/models/fields/FrmFieldUserID.php(1 hunks)deprecated/FrmEDD_SL_Plugin_Updater.php(1 hunks)phpstan.neon(2 hunks)square/helpers/FrmSquareLiteConnectHelper.php(7 hunks)stripe/models/FrmStrpLiteAuth.php(1 hunks)
🧰 Additional context used
🧬 Code graph analysis (4)
classes/controllers/FrmSettingsController.php (1)
classes/helpers/FrmStylesHelper.php (1)
save_button(27-31)
classes/models/FrmHoneypot.php (1)
classes/models/FrmFormState.php (1)
get_from_request(70-75)
classes/controllers/FrmStylesController.php (1)
stubs.php (1)
FrmProStylesController(170-193)
square/helpers/FrmSquareLiteConnectHelper.php (1)
stripe/controllers/FrmTransLitePaymentsController.php (1)
refund_payment(198-230)
🪛 GitHub Actions: Psalm Code Analysis
classes/controllers/FrmStylesController.php
[error] 846-846: Psalm: PossiblyNullArrayAccess. Cannot access array value on possibly null variable $style->post_content of type mixed|null.
🪛 PHPMD (2.15.0)
classes/models/FrmInstallPlugin.php
28-28: Avoid unused local variables such as '$file'. (undefined)
(UnusedLocalVariable)
deprecated/FrmEDD_SL_Plugin_Updater.php
100-100: Avoid unused parameters such as '$cache_key'. (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). (4)
- GitHub Check: PHP 7.4 tests in WP trunk
- GitHub Check: PHP 8 tests in WP trunk
- GitHub Check: PHP 8 tests in WP trunk
- GitHub Check: PHP 7.4 tests in WP trunk
🔇 Additional comments (93)
classes/helpers/FrmFormActionsHelper.php (1)
15-16: LGTM!The
@return arrayannotation accurately documents the return type for this method. The change is purely documentation-focused and aligns well with the PR's objective to add return type comments across the codebase.classes/controllers/FrmWelcomeTourController.php (1)
303-304: PHPDoc return type annotations are accurate and properly documented.The
@return voidannotations added toshow_completed_links()(lines 303–304) andsave_checklist()(lines 521–522) correctly document that both methods perform side effects (output rendering and option updates) without returning values. These additions support static analysis tooling and improve type safety documentation.Also applies to: 521-522
classes/models/FrmFormTemplateApi.php (1)
69-70: LGTM! The@return voidannotation accurately reflects the method's behavior and maintains consistency with other void-returning methods in the class.classes/models/fields/FrmFieldHidden.php (1)
40-49: Return type annotation is accurate and well-placed.The
@return arrayPHPDoc correctly documents the method's return type, and the annotation is consistent with existing documentation patterns in the class (e.g.,html5_input_type()at line 55).classes/controllers/FrmEmailSummaryController.php (1)
18-22: Return type docblock accurately reflects method behavior
maybe_send_emails()does not return a value (only early returns without data), so adding@return voidis correct and aligns with the PR’s documentation goal.classes/factories/FrmFieldFactory.php (1)
138-139: PHPDoc return type accurately documents dynamic property access.The added
@return mixedannotation correctly reflects that the method returns a dynamically accessed property which can be of various types depending on the$propertyparameter. The documentation is properly formatted and aligns with the PR's objective to document return types.classes/models/FrmSpamCheck.php (1)
22-24: PHPDoc parameter documentation is accurate and well-placed.The
@param array $valuesannotation correctly documents the constructor parameter and aligns with the property type declaration on line 18. The documentation follows the existing pattern used throughout the file (e.g., return types on other methods).classes/models/FrmEmailStats.php (1)
128-129: Documentation improvements look good.The
@return voidannotations accurately document that these methods modify the$statsarray by reference without returning a value. The additions are consistent with the existing PHPDoc style in this file and align with the PR's objective.Also applies to: 144-145
classes/models/FrmSalesApi.php (1)
488-490: Docblock return type formenu()correctly reflects implementation
FrmSalesApi::menu()does not return a value, so documenting@return voidis accurate and helps static analysis without changing behavior.stripe/models/FrmStrpLiteAuth.php (1)
742-743: Return type annotation properly added.The
get_message_url()docblock now correctly includes the@return stringannotation. The method returns the result ofadd_query_arg(), which produces a URL string, making the annotation accurate.classes/helpers/FrmFieldGridHelper.php (1)
57-60: LGTM!The PHPDoc block for the
@param bool $nestedparameter is accurate and consistent with the documentation style throughout the class. This documentation addition aligns well with the PR objective and improves IDE support and code clarity.classes/controllers/FrmCronController.php (1)
38-39: LGTM! Documentation enhancement for consistency.The
@return voidannotation accurately documents thatschedule_events()returns no value, consistent with the existing annotation style in this class (seeremove_crons()).classes/helpers/FrmFormTemplatesHelper.php (1)
25-26: Accurate return type documentation added.The
@return voidannotation correctly documents the method's behavior. Sinceprepare_template_details()modifies its parameter by reference without returning a value, this documentation is precise and will improve static analysis tool support (PHPStan, Psalm, etc.) and IDE type hints.classes/models/FrmEmail.php (1)
819-820: Return type annotation improves documentation.The
@return stringannotation accurately reflects the method's behavior. All code paths return a formatted email string, making this a solid documentation improvement aligned with the PR's goal.classes/controllers/FrmUsageController.php (1)
97-98: Solid documentation additions.Both
@return voidannotations are correct and consistent with the existing PHPDoc pattern across the class. The changes align with the PR objective of adding explicit return type documentation without altering function signatures or behavior.Also applies to: 127-128
classes/models/FrmInstallPlugin.php (2)
23-25: PHPDoc parameter annotation is accurate and adds clarity.The
@param array $attsdocuments the constructor's interface and aligns with usage in the method body.
32-34: PHPDoc return type is accurate.The
@return stringcorrectly documents the method's behavior; all code paths return either an empty string or a URL string from the helper methods.classes/models/FrmAntiSpam.php (1)
75-77: Docblock return type is accurate and consistent with implementation
get_antispam_secret_key()always returns a string in all code paths, so@return stringis correct and aligns with the method’s behavior and the PR goal of clearer return annotations.classes/controllers/FrmFormTemplatesController.php (1)
143-162: Documentation improvement: return type annotation added.The addition of
@return voidto theload_admin_hooks()method docblock (lines 146–147) is appropriate and consistent with the documentation pattern used throughout this file. All other methods in the class are already properly annotated with their return types.classes/controllers/FrmOnboardingWizardController.php (1)
123-124: Minor documentation addition looks good.The addition of
@return voidannotation toload_admin_hooks()is consistent with the PR objectives and existing patterns in the file.classes/controllers/FrmSettingsController.php (1)
17-19: Comprehensive PHPDoc additions are accurate and well-placed.All return type annotations (
@return void) correctly reflect actual function behavior—methods either include view templates or echo output. Parameter documentation ondisplay_form(),route(), andfake_color_picker()matches their signatures precisely, with the union type@param bool|string $stop_loadaccurately capturing the documented flexibility. These changes will improve static analysis and IDE support without altering any runtime behavior.Also applies to: 39-44, 297-298, 307-309, 321-323, 332-334, 343-345, 360-362, 420-422, 429-433, 518-520
classes/helpers/FrmEntriesListHelper.php (4)
41-48: PHPDoc additions are accurate and consistent.The
@param array $s_queryand@return voidannotations correctly document the function behavior. The typing aligns with the function's actual usage and return semantics.
50-66: Void return type correctly documented.The
@return voidannotation is accurate and the formatting is consistent with the file's PHPDoc style.
68-78: Void return correctly documented.The
@return voidannotation accurately reflects that this method modifies global state but does not return a value.
400-405: Return type correctly documented as mixed.The
@param object $itemand@return mixedaccurately reflect the function's polymorphic return behavior (strings, HTML markup, and filtered values). This is appropriate for a column value renderer.classes/controllers/FrmXMLController.php (2)
185-186: LGTM! Accurate return type documentation.The
@return stringannotation correctly documents the method's return behavior, which consistently returns a string value (either from the form array or an empty string).
755-759: LGTM! Accurate parameter and return type documentation.The PHPDoc block correctly documents the
$mimesparameter as an array and the return type as an array, which accurately reflects the method's signature and implementation.classes/helpers/FrmOnSubmitHelper.php (1)
27-28: Return type documentation is accurate across all added annotations.All nine
@returnPHPDoc additions correctly reflect the method behaviors:
- Void-returning methods (output or side-effects only) are properly documented as
@return void- String-returning methods correctly marked as
@return stringThe changes complete type coverage for this helper class consistently. No logic, signatures, or runtime behavior is altered.
Also applies to: 86-87, 105-106, 162-164, 169-171, 177-179, 199-200, 235-236, 275-276
classes/models/fields/FrmFieldUserID.php (1)
55-61: Return type annotation matches actual behavior
get_field_value()returns either the stored field value or the current user ID, both of which are effectivelyint|string, so the new@return int|stringPHPDoc accurately reflects the implementation and improves static analysis without changing behavior.classes/helpers/FrmEmailSummaryHelper.php (1)
85-86: Documentation enhancements are accurate and well-placed.The seven
@return voidannotations added tosave_options(),send_monthly(),send_yearly(),set_last_sent_date(),show_comparison(),section_heading_with_icon(), andplain_text_echo()are all correct. Each method performs side effects (updating options, sending emails, or outputting content) without returning a meaningful value, making@return voidthe appropriate return type. The PHPDoc formatting is consistent with existing annotations throughout the file, and these changes align cleanly with the PR objective to add return type comments across the codebase.Also applies to: 138-139, 151-152, 258-259, 350-351, 422-423, 570-571
classes/models/FrmInstallerSkin.php (2)
21-34: Accurate@return voidforset_upgraderThe new
@return voidmatches the implementation (no return value) and improves static analysis without changing behavior. Looks good.
36-47: Accurate@return voidforset_resultSame here: the method only mutates state and does not return anything, so
@return voidis correct and consistent with the intent.classes/models/FrmEntryShortcodeFormatter.php (1)
152-158: Docblock return type accurately reflects implementation
content()can return a string (empty, plain text, or HTML) or an array viaget_array(), so@return string|arrayis correct and improves static analysis/readability without changing behavior.classes/models/FrmCreateFile.php (2)
17-19: Constructor parameter documentation added correctly.The
$attsparameter is now documented in PHPDoc format. The documentation accurately reflects that this parameter accepts an array.
207-210:get_ftp_creds()parameter and return type documentation added correctly.Both the parameter (line 208, existing) and return type (lines 209–210, added) are now properly documented. The return type
array|falseaccurately reflects the implementation: the method returns the credentials array on line 263 orfalseon line 266.classes/models/FrmSpamCheckDenylist.php (7)
23-25: LGTM!The parameter type annotation is accurate and improves static analysis support.
34-36: LGTM!The return type annotation is accurate and consistent with the method implementation.
48-49: LGTM!The
@return voidannotation is accurate—this method modifies the array by reference and has no return value.
200-201: LGTM!The
@return voidannotation is accurate for this by-reference parameter method.
399-400: LGTM!The
@return voidannotation is accurate for this by-reference parameter method.
495-500: LGTM!All parameter and return type annotations are accurate and consistent with the method implementation.
560-564: LGTM!The parameter and return type annotations are accurate for this private utility method.
classes/models/FrmHoneypot.php (1)
32-34: LGTM! PHPDoc annotations are accurate and improve code documentation.All the added PHPDoc blocks correctly document the return types and parameters based on the actual implementations. These documentation improvements enhance type clarity and maintainability without introducing any behavioral changes.
Also applies to: 133-134, 167-168, 245-249, 259-261, 268-270
classes/helpers/FrmTipsHelper.php (1)
393-397: LGTM! Documentation is accurate.The PHPDoc correctly documents the parameter and return types for this method.
classes/models/FrmSolution.php (2)
30-33: Constructor param docblock is consistent with the signature
@param array $attsmatches__construct( $atts = array() )and doesn’t introduce any behavioral change. No issues here.
75-80: plugin_links() PHPDoc correctly matches filter usageDocumenting
$linksasarrayand the return type asarrayis consistent with how the method is used in theplugin_action_links_*filter.classes/helpers/FrmStylesHelper.php (1)
8-10: PHPDoc return type annotations are accurate and well-placed.All added
@returndocumentation correctly reflects the actual return types of these methods. These changes improve static analysis compliance and IDE support.Also applies to: 20-26, 33-37, 77-79, 105-107, 272-279, 363-369
classes/controllers/FrmStylesController.php (2)
23-25: PHPDoc return annotations are accurate and improve type safety.All added
@returnand@paramdocumentation correctly matches the actual function implementations. The return types are well-chosen (void, string, array, mixed) and align with real behavior.Also applies to: 32-34, 245-251, 263-268, 1133-1137, 1182-1187, 1204-1210, 1219-1223, 1231-1235, 1258-1263
270-270: Strict equality comparison improves type safety.Changed loose equality (
==) to strict equality (===), eliminating potential type-juggling bugs. The logic is preserved and this aligns with PHP best practices.classes/controllers/FrmEntriesController.php (4)
8-27: Admin routing/menu docblocks look consistent with behaviorThe new
@return voidannotations formenu()andload_manage_entries_hooks()match the implementations, and theroute()docblock is also consistent with current usage as a screen callback. No runtime behavior changes introduced here.Also applies to: 94-110, 112-134
158-205: Column-related helper docblocks correctly describe parameters and return typesThe added PHPDoc for
manage_columns(),get_columns_for_form(),maybe_add_ip_col(), andsortable_columns()aligns with how these methods are used (arrays in, arrays out / by‑ref mutation, void where appropriate). This should help static analysis around the entries list table.Also applies to: 304-314, 317-324, 445-474
707-774:process_entry()docblock matches actual usageThe new docblock for
process_entry()correctly reflects$errorsasstring|arrayand$ajaxasbool, with avoidreturn. This aligns with how$errorsis initialized, validated, filtered, and stored.
906-936:entry_sidebar()parameter/return annotations are accurateDocumenting
$entryasobject|falseand the method as returningvoidmatches the implementation and how the included view uses the prepared data.classes/controllers/FrmEmailStylesController.php (1)
333-334: LGTM: Documentation enhancement.The
@return voidannotation accurately documents the method's behavior.classes/models/FrmInbox.php (2)
52-53: LGTM: Documentation enhancement.The
@return arrayannotation accurately documents the return type.
330-342: LGTM: Clean implementation of unread message filtering.The method correctly filters messages to return only those unread by the current user, with proper null-safety checks.
classes/models/FrmDb.php (1)
59-60: LGTM: Comprehensive documentation improvements.The PHPDoc additions accurately document parameter types and return values across multiple private methods, improving code maintainability with no functional changes.
Also applies to: 177-178, 340-341, 376-382, 553-554
classes/helpers/FrmSubmitHelper.php (1)
149-150: LGTM: Accurate void return documentation.The
@return voidannotations correctly document methods that perform side effects without returning values.Also applies to: 178-179, 213-214, 242-243
deprecated/FrmEDD_SL_Plugin_Updater.php (1)
97-103: Unused parameter is acceptable in deprecated stub.The static analysis warning about the unused
$cache_keyparameter can be safely ignored—this is a deprecated stub method maintained for backward compatibility.classes/helpers/FrmCSVExportHelper.php (2)
244-258: LGTM: Well-designed filter integration.The addition of
frm_csv_line_breakandfrm_csv_date_formatfilters enhances extensibility while maintaining backward compatibility. The filter pattern is consistent with the existingfrm_csv_sepfilter.
260-267: LGTM: Comprehensive PHPDoc coverage.The extensive documentation additions improve code maintainability by clarifying parameter types and return values across all helper methods, with no functional changes.
Also applies to: 269-294, 313-331, 333-366, 368-463, 484-489, 491-526, 528-546, 548-589, 628-641, 643-686, 740-757, 759-811, 813-845
square/helpers/FrmSquareLiteConnectHelper.php (11)
133-135: LGTM!The return type annotation
false|stringaccurately reflects the method's behavior.
210-213: LGTM!The parameter and return type annotations are accurate.
532-534: LGTM!The return type annotation accurately reflects that this method returns an array.
558-560: LGTM!The return type annotation matches the property type declared at line 15.
565-569: LGTM!The return type annotation
false|objectmatches the return type ofpost_with_authenticated_body().
643-649: LGTM!The updated return type annotation
false|objectis accurate.
651-658: LGTM!The return type annotation
false|objectis accurate.
660-667: LGTM!The return type annotation
false|objectis accurate.
669-676: LGTM!The return type annotation
false|objectis accurate.
768-779: LGTM!The return type annotation
false|objectaccurately reflects the method's behavior.
484-504: I'll verify the concerns raised in this review comment by searching for all callers of thecreate_payment()method and checking for inconsistencies with similar methods.
<function_calls>
#!/bin/bashSearch for all calls to FrmSquareLiteConnectHelper::create_payment
echo "=== Static calls to FrmSquareLiteConnectHelper::create_payment ==="
rg -nP --type=php 'FrmSquareLiteConnectHelper::create_payment\s*(' -C3echo ""
echo "=== Instance method calls to create_payment ==="
rg -nP --type=php '->create_payment\s*(' -C3
</function_calls>classes/models/FrmFieldValue.php (1)
145-187: String return types for field metadata getters look correctThe new
@return stringannotations on:
get_field_label()(name)get_field_id()(id)get_field_key()(field_key)get_field_type()(type)match the expected shapes of these properties and how they’re used throughout (labels, keys, and type slugs). These docblocks should give tools better signal without changing behavior.
classes/controllers/FrmAddonsController.php (4)
28-33:load_admin_hooks@return voidannotation is accurateMethod only wires hooks and does not return a value; the new
@return voidis correct and helps static analysis.
423-451:get_pro_licensereturn type now correctly documented asstringAll code paths return a string (either the normalized license or an empty string), so the
@return stringaddition is correct.
463-474:license_type@return stringmatches current behaviorThis method always returns a string (
FrmProAddonsController::license_type()or'free'), so the new@return stringannotation is consistent.
1042-1073:install_addonunion return type (array|string) matches implementationThis method returns an error array on failure and the plugin identifier string on success; the new
@return array|stringdocblock correctly describes that behavior and is compatible with callers likedownload_and_activateandhandle_addon_action.classes/controllers/FrmAppController.php (6)
33-48:menu_icon@return stringannotation is correctThe method always returns an SVG data URI string (possibly filtered), so documenting
@return stringis accurate.
139-183:is_white_pagenow correctly documented as returningboolThe method derives a boolean and then passes it through
apply_filters( 'frm_is_white_page', … ). Treating this asboolmatches intended usage in callers likeadd_admin_class.
821-833:enqueue_global_settings_scripts@return voidannotation fits usageThis helper only enqueues assets conditionally based on
$pageand has no return value;@return voidis appropriate.
1080-1090:can_update_db@return boolis consistent with transient usage
get_transient( 'frm_updating_api' )is only ever set totruein this file and otherwise evaluates tofalse, so modeling the permission callback as returningboolis accurate for REST.
1198-1211:drop_tablesdocblock aligns with behaviorThe method takes an array of table names and appends four Formidable tables before returning the array;
@param array $tables/@return arraycorrectly describe its contract for use in drop-table filters.
1252-1263:set_footer_textreturn type is now clearly specifiedThis filter callback always returns a string (either the original footer text or an empty string on Formidable admin pages), so the
@return stringannotation is accurate and useful for static analysis.classes/models/FrmSettings.php (2)
111-113: Constructor PHPDoc matches current usage
$argsis only ever treated as an array (passed straight intomaybe_filter_for_form()which expects an array), so documenting it as@param array $argsis consistent with current usage. No functional concerns here.
381-386:validate()PHPDoc is consistent with filter contract
@param array $params,@param array $errors, and@return arraymatch the usage withapply_filters( 'frm_validate_settings', $errors, $params ), which expects and returns an error array. Looks good.classes/models/fields/FrmFieldCheckbox.php (1)
31-33: Accurateinput_html()return typeDocumenting
input_html()as returningstringis consistent with themultiple_input_html()return value. No issues.classes/models/fields/FrmFieldCaptcha.php (1)
278-282:allow_multiple()PHPDoc matches implementation
@param FrmSettings $frm_settingsand@return boolalign with reading$frm_settings->re_multi. This improves static analysis without behavior change.classes/controllers/FrmFieldsController.php (5)
156-164:load_single_field()documented asvoidis appropriateThe method only performs rendering (includes a view and may early‑return) and doesn’t return a value;
@return voidis accurate.
511-516:input_html()return type is correct despite echo side‑effectThe method always builds
$add_htmlas a string and returns it, regardless of whether it also echoes when$echo === true. Documenting@return stringis accurate and helpful for callers that rely on the return value.
778-783:add_validation_messages()PHPDoc matches usage
$fieldis treated as an array and$add_htmlis passed by reference as an array of extra attributes. The@param array/@return voidannotations line up with the implementation.
1016-1022:check_value()PHPDoc correctly usesmixedGiven
$optcan be scalar or array and is normalized before returning, usingmixedfor both the input and return types is appropriate, andarray|objectfor$fieldmatches how it’s inspected viaFrmField::is_option_true().
1035-1039:check_label()PHPDoc is consistent
$optcan be either an array or scalar; the method normalizes array inputs to a scalar and returns that.@param mixed $opt/@return mixedis accurate.classes/models/fields/FrmFieldRadio.php (1)
36-38:input_html()return type annotation is correctDocumenting
input_html()as returningstringaligns with themultiple_input_html()call. This is consistent with the checkbox field implementation.
There was a problem hiding this comment.
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)
stripe/models/FrmTransLiteDb.php (1)
263-273: Incomplete return type annotation.The return type should include
nullsincewpdb->get_var()returnsstring|null, not juststring. The method can return null when no rows are found.Apply this diff to correct the return type:
/** - * @return string + * @return string|null */ public function get_count() {
🧹 Nitpick comments (6)
classes/views/styles/components/FrmSliderStyleComponent.php (1)
25-29: Constructor PHPDoc looks correct; consider documenting$datashapeThe param types align with how the constructor and helpers use these values. For stronger static analysis and self‑documentation, you might optionally expand the
$datatype (e.g.,array{units?: string[], type?: string, icon?: string, max_value?: int|float, ...}) or at least mention expected keys in the summary line above the tags.square/models/FrmSquareLiteSettings.php (1)
61-63: Good documentation addition.The PHPDoc correctly documents the return type. For greater specificity and consistency with the property declaration at line 11, consider using
@return stdClassinstead of@return object.Apply this diff for more specific type documentation:
/** - * @return object + * @return stdClass */stripe/helpers/FrmStrpLiteConnectApiAdapter.php (1)
160-161: Consider a more specific return type.The method delegates to
FrmStrpLiteConnectHelper::maybe_create_plan(), which returnsfalse|string(line 822-830 in the helper). Consider using@return false|stringinstead of@return mixedfor better type clarity.stripe/helpers/FrmStrpLiteConnectHelper.php (1)
488-492: Refine the return type annotation.The
@return object|nullannotation is incomplete. Sincejson_decode()is called without the second parameter (line 496), it can return object, array, scalar values, or null depending on the JSON structure. Consider using@return mixedor, if the API consistently returns JSON objects,@return object|array|nullfor accuracy.phpstan.neon (2)
34-34: Consider scoping'#no value type specified.#'instead of ignoring it globallyIf the medium‑term goal is to tighten PHPStan coverage on generics/value types as well, this global ignore will mask those issues everywhere. You might want to mirror the approach used below for return types and introduce a
paths:list here, so new/actively‑touched code can start enforcing value types while legacy areas remain suppressed.
137-198: Deduplicatepathsentries in the new return‑type ignore rulesIn both new
ignoreErrorsblocks ('#has no return type specified#'and'#with no type specified#'), some paths (e.g.,classes/models/FrmEntryValidate.php) appear multiple times. It’s harmless but adds noise and can confuse future maintainers scanning for “special” files.Suggest trimming duplicates so each path appears once per block, for example:
- - classes/models/FrmEntryValidate.php - - classes/models/FrmEntryMeta.php - - classes/models/FrmEntry.php - - classes/models/FrmEntryValidate.php + - classes/models/FrmEntryValidate.php + - classes/models/FrmEntryMeta.php + - classes/models/FrmEntry.php…and similarly in the second block.
📜 Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro
📒 Files selected for processing (17)
classes/views/styles/components/FrmSliderStyleComponent.php(1 hunks)classes/views/styles/components/FrmStyleComponent.php(2 hunks)classes/widgets/FrmElementorWidget.php(4 hunks)classes/widgets/FrmShowForm.php(1 hunks)phpstan.neon(2 hunks)square/models/FrmSquareLiteSettings.php(1 hunks)stripe/controllers/FrmStrpLiteEventsController.php(3 hunks)stripe/controllers/FrmTransLiteHooksController.php(1 hunks)stripe/controllers/FrmTransLiteListsController.php(1 hunks)stripe/helpers/FrmStrpLiteConnectApiAdapter.php(1 hunks)stripe/helpers/FrmStrpLiteConnectHelper.php(1 hunks)stripe/helpers/FrmStrpLiteLinkRedirectHelper.php(1 hunks)stripe/helpers/FrmTransLiteAppHelper.php(6 hunks)stripe/helpers/FrmTransLiteListHelper.php(2 hunks)stripe/models/FrmStrpLiteSettings.php(1 hunks)stripe/models/FrmTransLiteAction.php(1 hunks)stripe/models/FrmTransLiteDb.php(4 hunks)
✅ Files skipped from review due to trivial changes (5)
- classes/views/styles/components/FrmStyleComponent.php
- stripe/controllers/FrmTransLiteListsController.php
- classes/widgets/FrmShowForm.php
- stripe/models/FrmStrpLiteSettings.php
- classes/widgets/FrmElementorWidget.php
🧰 Additional context used
🪛 PHPMD (2.15.0)
stripe/models/FrmTransLiteDb.php
260-260: Avoid unused local variables such as '$field'. (undefined)
(UnusedLocalVariable)
⏰ 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). (2)
- GitHub Check: PHP 8 tests in WP trunk
- GitHub Check: PHP 7.4 tests in WP trunk
🔇 Additional comments (10)
stripe/controllers/FrmTransLiteHooksController.php (1)
70-72: LGTM! Documentation improvement.The PHPDoc annotation accurately documents the void return type and is consistent with other method annotations in this file.
stripe/models/FrmTransLiteAction.php (1)
26-27: LGTM!The
@return voidannotation accurately documents that theform()method produces no return value. This enhances IDE support and code clarity without changing functionality.stripe/helpers/FrmStrpLiteLinkRedirectHelper.php (1)
115-116: LGTM!The
@return boolannotation accurately reflects the method's return type.stripe/helpers/FrmTransLiteAppHelper.php (1)
152-153: LGTM!All return type annotations accurately reflect the methods' behaviors. The documentation improvements enhance code clarity without altering functionality.
Also applies to: 163-164, 268-272, 523-525, 534-535, 558-559
stripe/controllers/FrmStrpLiteEventsController.php (1)
206-208: LGTM!The return type annotations accurately document the possible return values for these methods. The documentation improvements help clarify method contracts.
Also applies to: 327-331, 349-353
stripe/helpers/FrmTransLiteListHelper.php (2)
261-266: Docblock forget_column_valuematches implementation.The
@return stringannotation aligns with all code paths returning a string-like value used for HTML output; no further changes needed.
483-487: Accurate return type onget_status_columndocblock.The
@param object $itemand@return stringannotations correctly describe the method’s usage and output.stripe/models/FrmTransLiteDb.php (3)
160-160: LGTM! Correct return type refinement.Removing
voidfrom the return type annotation is accurate sincewpdb->get_row()returnsarray|object|nulland this method has no early return without a value.
199-228: LGTM! Well-structured query method.The implementation correctly validates the field against a whitelist before using it in the SQL query, and returns an empty array for invalid states. The return type annotation accurately reflects that
wpdb->get_results()returns an array.
230-252: LGTM! Proper JOIN implementation.The SQL join between payments and items tables is correctly structured with a prepared statement for the user ID parameter. The return type annotation accurately reflects the array result from
wpdb->get_results().
There was a problem hiding this comment.
Actionable comments posted: 3
Caution
Some comments are outside the diff and can’t be posted inline due to platform limitations.
⚠️ Outside diff range comments (3)
classes/models/FrmEntry.php (1)
272-306: Handle the case when the entry does not exist.If
getOne()returnsnullbecause the entry with the given$iddoesn't exist, attempting to access$values->nameand other properties on line 279-283 will cause a fatal error.Apply this diff to add validation:
public static function duplicate( $id ) { global $wpdb; $values = self::getOne( $id ); + if ( ! $values ) { + return false; + } $new_values = array();classes/helpers/FrmAppHelper.php (1)
3077-3080: Fix invalid date regex quantifier inget_formatted_timeIn
get_formatted_time, the pattern'/^\d{1-2}\/\d{1-2}\/\d{4}$/'(Line 3077) uses{1-2}, which is not a valid quantifier and can cause apreg_matchcompilation warning at runtime. It looks like this was meant to be “1 or 2 digits”.You can safely correct it as:
- 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() ) {This keeps the intent (detecting
mm/dd/yyyy-style input) without risking regex compilation errors.classes/models/FrmAddon.php (1)
83-96: Handlefalseresult from get_addon to avoid fatal errorsThe
@return false|FrmAddonannotation is accurate, but current callers likeactivate_license_for_plugin()andset_license_from_post()assume a non-false return and immediately call methods on the result. Iffrm_installed_addonsever returns an array without the requested slug (e.g., unexpected slug in the AJAX request), this will trigger a fatal error.I recommend either:
- Guarding at the call sites and returning a structured error when
$this_pluginisfalse, or- Making
get_addon()throw a controlled exception / return a structured error instead offalse, and updating callers accordingly.
🧹 Nitpick comments (13)
classes/helpers/FrmListHelper.php (4)
682-686: Consider tighteningdisabled_pagesreturn typeThe current
@return arrayis correct but very generic. If you want stronger tooling support, you could document the fixed keys and boolean values:- * @return array + * @return array{first:bool,last:bool,prev:bool,next:bool}This would make phpstan/psalm aware of the exact shape.
713-717: Optionally narrowlink_labelparam type
$linkis effectively limited to'first','last','prev','next'by the call sites. You can express that for better static checking:- * @param string $link + * @param 'first'|'last'|'prev'|'next' $linkThe existing
stringannotation is still correct, so this is purely an enhancement.
735-739:add_page_linkdocblock is correct; could specify expected keys
@param array $atts/@return stringmatches usage. If you’d like, you can document the expected structure for better IDE support:- * @param array $atts + * @param array{ + * page:string, + * arrow:string, + * number:int, + * disabled:bool + * } $atts
759-763:add_active_linkdocblock OK; array-shape annotation would be a nice follow-upLike
add_page_link, this expects a structured$attsarray and returns an HTML string. Current types are correct; consider an array-shape annotation similar to:- * @param array $atts + * @param array{ + * page:string, + * arrow:string, + * number:int + * } $attsto help static analysis.
classes/controllers/FrmFormsController.php (1)
1237-1243:save_per_pagedocblock matches behavior, with a minor param-type nuanceThe docblock reflects usage well;
$saveasmixedand returnmixedis appropriate, and$optionis indeed a string. Since$valuecomes from a request and is then cast with(int) $value, you might consider documenting it asint|stringfor maximal accuracy, but it’s not critical.classes/models/FrmEntry.php (1)
401-410: Clarify the purpose of the$valueparameter.The
$valueparameter is only used in anisset()check to determine whether to setform_idto$form_idornull, but the actual value is never used. This makes the API confusing.Consider one of these approaches:
- If
$valuerepresents whether to set or unset the form linkage, rename it and use a boolean:-public static function update_form( $id, $value, $form_id ) { +public static function update_form( $id, $form_id, $set_linkage = true ) { global $wpdb; - $form_id = isset( $value ) ? $form_id : null; + $form_id = $set_linkage ? $form_id : null;
- If this is legacy API that must be maintained, at least document the parameter's purpose in the PHPDoc:
/** * @param int $id - * @param mixed $value + * @param mixed $value If set, updates form_id to $form_id; if not set, clears the form linkage. * @param int|string $form_idclasses/models/FrmFormAction.php (2)
577-584:get_one()return type in PHPDoc is too narrow
get_one()delegates toget_all( $form_id, 1 ). When at least one action exists,get_all()collapses the result to a single prepared action object (WP_Post), and when there are none it returns an empty array. So@return arrayis misleading.Consider widening the return type to reflect actual behavior, e.g.:
- * @param int|string $form_id - * - * @return array + * @param int|string $form_id + * + * @return WP_Post|WP_Post[]This matches
prepare_action()’sWP_Posttyping and still covers the empty-array case.
586-641:get_action_for_form()docblock should reflect union return type and$attsflexibility
get_action_for_form()can:
- Return an empty array early in several branches.
- For
$type !== 'all', return the result of$action_controls->get_all( $form_id, $atts ), which may be an array ofWP_Postobjects or a singleWP_Postwhen the limit is 1.- For
$type === 'all', after building$settings, collapse to a single action when$limit === 1($settings = reset( $settings );).Also,
$attscan be either an array or an integer limit, since it is passed intoprepare_get_action()(directly or viaget_all()), which explicitly handles numeric arguments for backward compatibility.To make the PHPDoc match behavior, I’d suggest:
- * @param int|string $form_id - * @param string $type - * @param array $atts - * - * @return array + * @param int|string $form_id + * @param string $type + * @param array|int $atts + * + * @return WP_Post|WP_Post[]This should play nicer with static analysis and better document the API without changing runtime behavior.
classes/helpers/FrmAppHelper.php (1)
714-758: Docblock additions look consistent; consider tightening one return type annotationThe new
@param/@returnannotations across helpers likeget_param,sanitize_request,recursive_function_map,is_assoc,prepare_field_arrays,fill_field_defaults,add_value_to_array,maybe_add_tooltip,prepare_action_slashes, andformat_form_dataalign well with the implementations and should help static analysis. One small mismatch: inget_user_id_param(Line 2561), the function can returnfalseif a falsy$user_idis passed in, while the docblock advertisesint|string. If thatfalsereturn is intentional, you may want to widen the@returntype to includebool, or normalize falsy input to a consistent int/string value to keep the declared return type strict.Also applies to: 892-905, 2373-2402, 2420-2427, 2556-2583, 2780-2798, 2801-2856, 3388-3401, 3404-3437, 3498-3521, 3629-3655
classes/models/FrmAddon.php (4)
72-81: insert_installed_addon PHPDoc matches implementationThe new docblock correctly documents
arrayin andarrayout, matching the filter usage. If you want tighter static analysis, you could narrow this to something likearray<string, FrmAddon>(or the appropriate addon interface), but it’s fine as-is.
292-301: set_active parameter type in PHPDoc vs actual usageThe new docblock declares
@param bool $is_active, butmaybe_set_active()passes the string'valid'when activation succeeds. The parameter is currently unused inset_active(), so this mismatch is only visible to static analysis, but it’s still misleading.Consider either:
- Updating the docblock to
@param bool|string $is_activeto reflect current usage, or- Normalizing
maybe_set_active()to pass a real boolean and, if needed, storing the'valid'status separately.
530-546: is_current_version PHPDoc is accurate; possible clarity tweakThe
@param object $transientand@return boolannotation lines up with usage: it expects an object withchecked/responseproperties and returns a boolean flag. If you want to help tools like PHPStan further, you might tighten the param tostdClassor describe the expected shape in a more detailed PHPDoc, but that’s optional.
910-919: lock_key() docblock return type is incorrectThe docblock says
@return bool, butlock_key()clearly returns a string identifier ($this->transient_lock_key . '_' . $this->license). This is an easy fix that will improve the accuracy of the new type annotations:- * @return bool + * @return string
📜 Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro
⛔ Files ignored due to path filters (1)
psalm.xmlis excluded by!**/*.xml
📒 Files selected for processing (26)
classes/controllers/FrmEntriesController.php(10 hunks)classes/controllers/FrmFormActionsController.php(5 hunks)classes/controllers/FrmFormsController.php(8 hunks)classes/helpers/FrmAppHelper.php(9 hunks)classes/helpers/FrmCSVExportHelper.php(13 hunks)classes/helpers/FrmEntriesHelper.php(5 hunks)classes/helpers/FrmFieldsHelper.php(15 hunks)classes/helpers/FrmFormsHelper.php(7 hunks)classes/helpers/FrmListHelper.php(6 hunks)classes/helpers/FrmXMLHelper.php(9 hunks)classes/models/FrmAddon.php(5 hunks)classes/models/FrmEntry.php(6 hunks)classes/models/FrmEntryMeta.php(6 hunks)classes/models/FrmEntryShortcodeFormatter.php(1 hunks)classes/models/FrmEntryValidate.php(9 hunks)classes/models/FrmField.php(5 hunks)classes/models/FrmForm.php(10 hunks)classes/models/FrmFormAction.php(3 hunks)classes/models/FrmFormMigrator.php(6 hunks)classes/models/FrmMigrate.php(1 hunks)classes/models/FrmSettings.php(3 hunks)classes/models/fields/FrmFieldType.php(7 hunks)phpstan.neon(2 hunks)stripe/controllers/FrmStrpLiteEventsController.php(3 hunks)stripe/helpers/FrmTransLiteAppHelper.php(6 hunks)stripe/models/FrmTransLiteDb.php(4 hunks)
✅ Files skipped from review due to trivial changes (8)
- classes/models/fields/FrmFieldType.php
- classes/helpers/FrmEntriesHelper.php
- classes/helpers/FrmFormsHelper.php
- classes/models/FrmEntryMeta.php
- classes/models/FrmForm.php
- classes/helpers/FrmFieldsHelper.php
- classes/models/FrmEntryValidate.php
- classes/models/FrmMigrate.php
🚧 Files skipped from review as they are similar to previous changes (6)
- classes/models/FrmEntryShortcodeFormatter.php
- classes/controllers/FrmEntriesController.php
- stripe/models/FrmTransLiteDb.php
- classes/helpers/FrmCSVExportHelper.php
- stripe/helpers/FrmTransLiteAppHelper.php
- classes/models/FrmSettings.php
🧰 Additional context used
🧬 Code graph analysis (1)
stripe/controllers/FrmStrpLiteEventsController.php (1)
stripe/models/FrmTransLiteDb.php (1)
get_one_by(179-197)
⏰ 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 7.4 tests in WP trunk
- GitHub Check: PHP 8 tests in WP trunk
- GitHub Check: Cypress
🔇 Additional comments (40)
phpstan.neon (1)
137-162: Good approach: Transitioning from global to file-scoped ignores.This change correctly narrows PHPStan's ignore rules from global patterns to explicit file paths. This prevents new files from silently inheriting these suppressions and clearly documents which files still need return type annotations.
classes/helpers/FrmXMLHelper.php (1)
13-18: LGTM! Excellent documentation improvements.The PHPDoc annotations added throughout this file accurately document parameter types and return types for all modified methods. The type hints are correct and will improve IDE support, static analysis, and developer experience.
Also applies to: 289-293, 323-327, 349-355, 368-372, 572-577, 1214-1220, 1340-1345, 1462-1466
classes/controllers/FrmFormActionsController.php (6)
410-418: LGTM!The PHPDoc accurately documents the method parameters and return type. The
WP_Posttype for$form_actionaligns with its usage accessingpost_excerptproperty.
575-579: LGTM!The PHPDoc correctly documents the array parameter and void return type.
723-729: LGTM!The PHPDoc correctly documents all parameters including the union type for
$form_idand the void return type.
747-751: LGTM!The PHPDoc correctly documents the string parameter and return type, which is consistent with the SQL WHERE clause filtering logic.
788-792: LGTM!The PHPDoc correctly documents the string parameter (class name) and void return type.
797-801: LGTM!The PHPDoc correctly documents the string parameter (class name) and void return type.
classes/models/FrmFormMigrator.php (6)
201-216: LGTM!The docblock accurately documents the method signature and return type. The
int|stringunion type for$source_idcorrectly reflects that form IDs can be either type.
218-226: LGTM!The docblock correctly documents this extensibility hook. The
array|objecttype for$formappropriately handles both array and object representations from different source plugins, and the pass-by-reference parameter is properly indicated.
290-298: LGTM!The docblock correctly documents this field-level extensibility hook with appropriate types and properly indicates the pass-by-reference parameter.
570-579: LGTM!The docblock accurately documents this helper method with correct parameter and return types.
590-599: LGTM!The docblock correctly documents this method with accurate types. The protected visibility allows child migrator classes to customize field-skipping behavior.
622-629: LGTM!The docblock properly documents this method stub with the appropriate union type for
$id. The implementation correctly provides an empty array as the default return value for child classes to override.classes/helpers/FrmListHelper.php (3)
278-282: Docblock forhidden_search_inputscorrectly reflects usage
$param_nameis always passed as a string and the method only echoes HTML with no return value, so@param stringand@return voidare accurate. No further changes needed.
452-456:get_bulk_actionreturn type matches implementationThe method guarantees either
falseor a non-empty, sanitized action string, so@return false|stringis correct and helpful for static analysis.
750-754:add_disabled_linkdocblock is accurateThe method always returns an HTML string built from the
$label, so@param stringand@return stringare appropriate.classes/controllers/FrmFormsController.php (9)
1922-1928:replace_content_shortcodesPHPDoc is consistent with implementationThe parameter and return types (
string,false|object,array, returningstring) are consistent with how the method delegates toFrmFieldsHelper::replace_content_shortcodes.
2139-2143:json_errordocblock correctly describes the filter signature
$errorsasarrayin and out aligns with how this is used as a validation filter, and the description is clear.
2388-2392:is_viewable_draft_formdocblock looks accurateDocumenting
$formasobjectand return asboolmatches the actual usage ($form->statuscheck plus capability/preview checks).
2397-2403:get_formdocblock matches current call patternsThe doc types (
object $form,bool $title,bool $description,array $atts, returningstring) line up with howshow_formnormalizestitle/descriptionbefore calling this method.
2421-2425:enqueue_scriptsdocblock is correctThe method only forwards
$paramsto an action, so@param array $params/@return voidis appropriate and helpful.
2430-2437:get_form_contentsPHPDoc matches usageThe documented types for
$form,$title,$description, and$atts, with@return void, are consistent with how the method is called and how it operates (side-effectful rendering only).
2558-2563:maybe_trigger_redirectdocblock matches behaviorParam types (
object $form,array $params,array $args) andvoidreturn are aligned with the implementation and how it passes those arrays intoget_confirmation_method.
2606-2612:trigger_redirectdocblock is accurateThe documented types and
voidreturn correctly reflect building$success_argsand delegating torun_success_action.
3332-3338:maybe_load_cssdocblock correctly captures parameter shapes
$formasobject,$this_loadasint|string, and$global_loadasboolmatch the way this method is called (e.g., fromshow_form_after_submit), and@return voidis correct.stripe/controllers/FrmStrpLiteEventsController.php (3)
206-208: LGTM!The PHPDoc accurately documents the return type. The method correctly returns
falsewhen the invoice lacks a subscription or when no matching subscription is found, and returns an object representing the payment when successful.
327-331: LGTM!The PHPDoc correctly documents the parameter and return type. The method returns
object|nullconsistent with the underlyingget_one_by()method's behavior, which wraps WordPress's$wpdb->get_row().Also applies to: 335-335
350-354: LGTM!The PHPDoc correctly documents the parameter and return type, accurately reflecting that
get_one_by()returns either an object or null.classes/models/FrmEntry.php (4)
460-465: LGTM!The PHPDoc accurately reflects the method's signature and return type.
522-526: LGTM!The PHPDoc correctly documents the parameter and return types for this method.
594-602: LGTM!The PHPDoc accurately describes all parameters and the return type for this method.
858-864: LGTM!The PHPDoc correctly documents this helper method's parameters and return type.
classes/models/FrmField.php (3)
487-494: LGTM!The PHPDoc accurately documents the method parameters and return type.
891-898: LGTM!The PHPDoc correctly documents the pass-by-reference parameter and void return type.
1413-1417: LGTM!The PHPDoc accurately documents the parameter and return types.
classes/models/FrmFormAction.php (2)
113-121: Docblock formigrate_values()matches current usage
$actionand$formare passed as objects fromprepare_new()/migrate_to_2(), and the method always returns the$actionobject, so the new@param object/@return objectannotations are accurate and helpful. No changes needed here.
410-443:duplicate_array_walk()PHPDoc is consistent with how it’s usedWithin
duplicate_one(),$actionis treated as an array segment ofpost_content,$subkeycan be either a string or an array of keys, and$valis mixed; the method always returns the modified$actionarray. The new docblock (@param array $action,@param array|string $subkey,@param mixed $val,@return array) correctly reflects this.classes/models/FrmAddon.php (2)
233-240: set_license docblock aligns with behavior
@param string $licenseand@return voidmatch howset_license()is used (storing the raw license string in the option). No functional issues here.
408-437: clear_expired_download docblock and logic look consistentThe
@param mixed $transient/@return mixedannotation matches the behavior: the method accepts any value, short-circuits non-objects, and returns the original transient (possibly modified) without changing its type. The integration withis_current_version()and the update-reset path reads correctly.
There was a problem hiding this comment.
Actionable comments posted: 0
🧹 Nitpick comments (4)
classes/models/FrmEntryValidate.php (1)
87-91: Consider documenting by-reference parameters in PHPDoc.Several newly added PHPDoc blocks don't indicate that parameters are passed by reference. While the code functions correctly, documenting reference parameters (
&$param) improves documentation completeness and helps developers understand that these parameters will be modified.Examples:
- Line 88:
set_item_key-$valuesis by reference- Line 132:
validate_field-$errorsis by reference- Line 691:
add_site_info_to_akismet-$datasis by reference- Line 709:
add_user_info_to_akismet-$datasis by reference- Line 895:
add_server_values_to_akismet-$datasis by reference- Line 943:
skip_adding_values_to_akismet-$valuesis by reference- Line 1042:
prepare_values_for_spam_check-$valuesis by referenceYou can add a note in the description indicating the parameter is modified, for example:
/** - * @param array $values + * @param array $values Entry values (passed by reference and modified). * * @return void */ private static function set_item_key( &$values ) {Also applies to: 130-137, 413-420, 432-439, 690-694, 708-713, 894-898, 942-944, 1041-1043
classes/models/FrmMigrate.php (2)
554-556: Optionally narrowget_fields_with_sizereturn type
get_fields_with_size()is annotated as@return arraybut in practice returns the result ofFrmDb::get_results, which appears to be an array of objects (likelystdClass). If you want stricter PHPStan help, consider something like@return array<stdClass>(or the concrete type used byFrmDb::get_results).
716-720: Consider broadening$sizeparam type or clarifying pass‑by‑ref
convert_character_to_px( &$size )may receive numeric or numeric‑string values before it normalizes to a'NNNpx'string. The current@param string $sizeis functionally fine but slightly narrower than the apparent usage. You could optionally change this to@param int|string $size(or similar) and/or mention that it is passed by reference for clarity.classes/models/FrmAddon.php (1)
171-173: Tighten a few docblocks to match actual return/param typesThere are a handful of spots where the phpdoc doesn’t quite match what the code can do; adjusting these would avoid confusing PHPStan and future readers:
get_license()/activate_defined_license()(Lines 171–173, 216–222)
Both can end up returningfalse(eg when no constant is defined and no option exists), not just a string. Either normalize the value to''in code or broaden the docblocks tostring|false.
set_active( $is_active )(Lines 315–319)
The param is annotated asbool, butmaybe_set_active()passes the string'valid'. Since the argument is unused and only its truthiness matters, you could either:
- Change the phpdoc to
@param bool|string $is_active, or- Cast to bool at the call site or in the method and keep the param as
bool.
set_license_from_post()(Lines 883–884)
self::get_addon( $plugin_slug )can returnfalse, so the effective return type isFrmAddon|false. Right now the docblock promisesFrmAddon. Either:
- Update the docblock to
@return FrmAddon|false, and/or- Add a guard before calling methods on
$this_pluginto fail gracefully if it’sfalse.
send_mothership_request()(Lines 893–896)
The docblock says@return string, but$messagecan be an array when the decoded JSON response has noerrorkey. The callers already handlearray|string, so the docblock should ideally reflect that (array|stringor a more specific array shape).
lock_key()(Lines 971–975)
The docblock currently says@return bool, but the method returns a string key concatenated from$this->transient_lock_keyand$this->license. This should be@return string.A minimal phpdoc-only patch could look like:
- * @return string + * @return string|false @@ - * @return string + * @return string|false @@ - * @param bool $is_active + * @param bool|string $is_active @@ - * @return FrmAddon + * @return FrmAddon|false @@ - * @return string + * @return array|string @@ - * @return bool + * @return stringAlso applies to: 216-222, 315-319, 883-884, 893-896, 971-975
📜 Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro
⛔ Files ignored due to path filters (1)
phpcs.xmlis excluded by!**/*.xml
📒 Files selected for processing (20)
classes/helpers/FrmAppHelper.php(9 hunks)classes/helpers/FrmEntriesHelper.php(9 hunks)classes/helpers/FrmFieldsHelper.php(40 hunks)classes/helpers/FrmFormsHelper.php(19 hunks)classes/models/FrmAddon.php(21 hunks)classes/models/FrmEntry.php(16 hunks)classes/models/FrmEntryFormatter.php(30 hunks)classes/models/FrmEntryMeta.php(8 hunks)classes/models/FrmEntryValidate.php(17 hunks)classes/models/FrmField.php(12 hunks)classes/models/FrmFieldFormHtml.php(23 hunks)classes/models/FrmForm.php(17 hunks)classes/models/FrmFormAction.php(8 hunks)classes/models/FrmFormMigrator.php(14 hunks)classes/models/FrmMigrate.php(19 hunks)classes/models/FrmOnSubmitAction.php(0 hunks)classes/models/fields/FrmFieldType.php(33 hunks)classes/views/frm-form-actions/email_action.php(0 hunks)phpstan.neon(2 hunks)stripe/helpers/FrmTransLiteListHelper.php(3 hunks)
💤 Files with no reviewable changes (2)
- classes/models/FrmOnSubmitAction.php
- classes/views/frm-form-actions/email_action.php
✅ Files skipped from review due to trivial changes (1)
- classes/helpers/FrmFieldsHelper.php
🚧 Files skipped from review as they are similar to previous changes (10)
- classes/models/FrmField.php
- classes/models/FrmFormMigrator.php
- classes/models/fields/FrmFieldType.php
- classes/models/FrmEntry.php
- classes/models/FrmForm.php
- classes/helpers/FrmEntriesHelper.php
- stripe/helpers/FrmTransLiteListHelper.php
- classes/helpers/FrmAppHelper.php
- classes/models/FrmFormAction.php
- phpstan.neon
⏰ 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 7.4 tests in WP trunk
- GitHub Check: PHP 8 tests in WP trunk
- GitHub Check: Cypress
🔇 Additional comments (23)
classes/models/FrmEntryFormatter.php (2)
128-129: LGTM! Excellent type documentation improvements.The added
@return voidand@return arrayannotations accurately reflect the methods' return behavior and align with the PR objectives to improve PHPStan compliance. All methods marked as returningvoideither modify properties, use pass-by-reference parameters, or have early returns without values.Also applies to: 150-151, 186-187, 227-228, 242-243, 259-260, 274-275, 289-290, 302-303, 315-316, 328-329, 341-342, 354-355, 477-478, 528-529, 548-549, 573-574, 593-594, 612-613, 634-635, 657-658, 678-679, 698-699, 715-716, 729-730, 743-744, 757-758, 792-793, 815-816, 886-887
579-579: LGTM! Appropriate use of strict comparison.The change from loose (
==) to strict (===) comparison is correct since$this->directionis always a string value ('ltr'or'rtl'), improving type safety without affecting behavior.classes/models/FrmEntryMeta.php (8)
191-196: LGTM!The PHPDoc accurately documents the parameter types and void return type for the
duplicate_entry_metasmethod.
215-220: LGTM!The PHPDoc correctly documents the return type as
false|int, which matches the return value of$wpdb->query().
233-234: LGTM!The void return type annotation is accurate for this cache-clearing utility method.
299-306: LGTM!The PHPDoc correctly documents all parameter types and the array return type. The
int|stringtype for$field_idappropriately reflects support for both field IDs and field keys.
342-343: LGTM!The void return type is accurate for this query-building helper that modifies the
$queryarray by reference.
371-375: LGTM!The PHPDoc accurately reflects the parameter and return types for retrieving entry meta information.
410-418: LGTM!The PHPDoc appropriately documents the flexible return type based on the
$limitparameter—returning an array for multiple IDs or a single value (or null) when limited to one result.
584-590: LGTM!The PHPDoc accurately documents the parameter types and array return type for this search method that supports both simple string searches and complex array-based date searches.
classes/helpers/FrmFormsHelper.php (1)
19-20: LGTM! Excellent PHPDoc additions.The return type and parameter annotations are accurate and well-structured. These additions properly document method signatures for PHPStan analysis without altering any behavior. The types correctly reflect the actual runtime behavior:
voidreturns for methods that output HTML directly- Proper union types for parameters that accept multiple types (e.g.,
false|object,int|string)- Accurate array and string return types
Also applies to: 26-31, 39-45, 90-95, 105-106, 232-238, 411-417, 479-483, 495-496, 523-525, 543-551, 586-587, 747-750, 803-804, 867-868, 889-897, 952-956, 1127-1130, 1157-1160, 1187-1191, 1199-1203, 1428-1429
classes/models/FrmMigrate.php (1)
20-22: Docblocks for side‑effect‑only helpers look accurateAll the added
@return voidannotations onupgradeand the variousmigrate_to_*/helper methods correctly reflect their side‑effect‑only implementations and don’t affect runtime behaviour. This is a clean win for static analysis.Also applies to: 81-82, 135-137, 292-294, 306-307, 327-328, 436-437, 458-459, 469-470, 483-484, 510-511, 524-525, 586-587, 635-636, 661-662, 674-675, 697-698
classes/models/FrmFieldFormHtml.php (10)
40-120: Setter helpers correctly annotated asvoid
_set,set_html,set_field_id,set_pass_args, andset_from_fieldonly mutate object state and never return a value, so the added@return voidannotations are accurate and help PHPStan without changing behavior.
122-131:get_html()@return stringmatches implementation
get_html()always returns$this->html, which is built and filtered as a string throughout the class, so the new@return stringdocblock correctly describes the method’s contract.
133-181: Pre-input shortcode helpers correctly marked asvoid
replace_shortcodes_before_input,replace_field_values, andreplace_required_label_shortcodeonly modify$this->htmland related state; they have no return statements, so documenting them as@return voidis consistent with their behavior.
205-229: Description-related helpers accurately documented asvoidBoth
replace_description_shortcodeandmaybe_add_description_idperform in-place updates (HTML and IDs) and do not return anything, so the added@return voidtags are correct.
260-315: Error handling helpers correctly use@return void
replace_error_shortcodeandmaybe_add_error_idoperate via side effects on$this->htmland do not return values, making the new@return voidannotations appropriate.
317-358: Required/form shortcode helpers properly annotated asvoid
replace_required_class,replace_form_shortcodes, andreplace_shortcodes_after_inputare all mutating helpers with no return value, so the@return voiddocblocks are accurate.
360-391: Post-processing helpers returningvoidas documented
filter_for_more_shortcodesandremove_collapse_shortcodeonly adjust HTML (including by-reference in the latter) and never return a value, so the@return voidannotations correctly capture their behavior.
393-415:replace_shortcodes_with_atts()side-effect-only;voidis correctThis method iterates over matches and rewrites
$this->htmlwithout returning anything, so documenting it as@return voidis consistent with its usage.
452-494: Label/entry/div helper methods correctly marked asvoid
add_class_to_label,replace_entry_key, andadd_field_div_classesall modify$this->htmlbased on state and do not return values, so the added@return voidtags are appropriate.
539-550:process_wp_shortcodes()@return voidis accurateThis method conditionally runs
do_shortcodeand assigns back to$this->htmlwithout returning a value; the new@return voidannotation matches the actual control flow.classes/models/FrmAddon.php (1)
67-69: Most new phpdoc annotations look consistent with runtime behaviorThe majority of the added/updated
@param/@returntags here (hooks registration, addon lookup, cache clearing, update transients, activation/deactivation handlers, etc.) match the actual values being passed around (arrays,FrmAddon|false,mixed, andvoidwhere appropriate). These should play nicely with PHPStan once the generic “no return type specified” ignore is removed.Also applies to: 75-79, 86-90, 101-103, 171-173, 188-192, 216-222, 235-241, 248-252, 257-259, 269-270, 277-279, 315-319, 330-332, 361-365, 435-439, 471-474, 559-563, 585-587, 592-594, 673-677, 682-684, 775-777, 813-815, 831-832, 849-850, 883-884, 953-955
Add return type comments and more missing param type comments
We no longer ignore the
'#has no return type specified#'and'#with no type specified#'substrings from PHPStan with this update.I've kept some exceptions for
'#has no return type specified#'where the function really dies and never returns. I don't thinkneverworks consistently yet across PHP versions though.