From e47d91061bbe63640d6d6f74f3fb393d351ce22a Mon Sep 17 00:00:00 2001 From: Mike Letellier Date: Fri, 23 Jan 2026 11:45:56 -0400 Subject: [PATCH 1/7] Add param default value type to types in param comments --- .../controllers/FrmDashboardController.php | 6 +- .../controllers/FrmEmailStylesController.php | 4 +- classes/controllers/FrmEntriesController.php | 2 +- classes/controllers/FrmFormsController.php | 8 +- classes/controllers/FrmXMLController.php | 6 +- classes/helpers/FrmAppHelper.php | 2 +- classes/helpers/FrmFieldsHelper.php | 4 +- classes/helpers/FrmFormsHelper.php | 6 +- classes/helpers/FrmOnSubmitHelper.php | 6 +- classes/models/FrmAddon.php | 6 +- classes/models/FrmField.php | 16 +- classes/models/FrmForm.php | 12 +- classes/models/FrmFormAction.php | 10 +- classes/models/FrmInbox.php | 2 +- .../AddMissingParamTypeFromDefaultSniff.php | 449 ++++++++++++++++++ phpcs-sniffs/Formidable/ruleset.xml | 1 + .../FrmSquareLiteActionsController.php | 4 +- square/helpers/FrmSquareLiteAppHelper.php | 4 +- .../FrmStrpLiteActionsController.php | 4 +- stripe/helpers/FrmStrpLiteAppHelper.php | 4 +- .../helpers/FrmStrpLiteConnectApiAdapter.php | 4 +- stripe/helpers/FrmStrpLiteConnectHelper.php | 8 +- stripe/models/FrmTransLitePayment.php | 4 +- .../phpunit/misc/test_FrmDirectFileAccess.php | 2 +- 24 files changed, 512 insertions(+), 62 deletions(-) create mode 100644 phpcs-sniffs/Formidable/Sniffs/Commenting/AddMissingParamTypeFromDefaultSniff.php diff --git a/classes/controllers/FrmDashboardController.php b/classes/controllers/FrmDashboardController.php index 178c91d8a3..49cf7da0fb 100644 --- a/classes/controllers/FrmDashboardController.php +++ b/classes/controllers/FrmDashboardController.php @@ -285,9 +285,9 @@ private static function view_args_entries_placeholder( $forms_count ) { /** * A function to handle the counters cta from the top: Total Forms, Total Entries, All Views, Installed Apps. * - * @param string $counter_type - * @param int $counter_value - * @param false|object $latest_available_form The form object of the latest form available. If there are at least one + * @param string $counter_type + * @param int $counter_value + * @param bool|false|object $latest_available_form The form object of the latest form available. If there are at least one * form available we show "Add Entry" cta for entries counter. * * @return array diff --git a/classes/controllers/FrmEmailStylesController.php b/classes/controllers/FrmEmailStylesController.php index 915c7f9207..ea167a29e5 100644 --- a/classes/controllers/FrmEmailStylesController.php +++ b/classes/controllers/FrmEmailStylesController.php @@ -106,7 +106,7 @@ public static function get_default_email_style() { /** * Gets the test email content. * - * @param false|string $style_key Default is `false`, using the one in settings. + * @param bool|false|string $style_key Default is `false`, using the one in settings. * * @return string */ @@ -229,7 +229,7 @@ public static function get_content_for_one_column_cell( $label, $value ) { /** * Gets table generator object for an email style. * - * @param false|string $email_style Email style. Default is `false`: using the one in global settings. + * @param bool|false|string $email_style Email style. Default is `false`: using the one in global settings. * * @return FrmTableHTMLGenerator */ diff --git a/classes/controllers/FrmEntriesController.php b/classes/controllers/FrmEntriesController.php index d2360fa1cc..df3904fe8e 100644 --- a/classes/controllers/FrmEntriesController.php +++ b/classes/controllers/FrmEntriesController.php @@ -937,7 +937,7 @@ public static function show_entry_shortcode( $atts ) { } /** - * @param false|object $entry + * @param bool|false|object $entry * * @return void */ diff --git a/classes/controllers/FrmFormsController.php b/classes/controllers/FrmFormsController.php index 8fa889e1f2..d1ecacf569 100644 --- a/classes/controllers/FrmFormsController.php +++ b/classes/controllers/FrmFormsController.php @@ -207,7 +207,7 @@ private static function create_submit_button_field( $form ) { } /** - * @param array|false $values + * @param array|bool|false $values * * @return void */ @@ -1928,9 +1928,9 @@ public static function get_email_html() { } /** - * @param string $content - * @param int|stdClass|string $form - * @param false|int|stdClass|string $entry + * @param string $content + * @param int|stdClass|string $form + * @param bool|false|int|stdClass|string $entry * * @return string */ diff --git a/classes/controllers/FrmXMLController.php b/classes/controllers/FrmXMLController.php index 3208c81d9b..b9eab85814 100644 --- a/classes/controllers/FrmXMLController.php +++ b/classes/controllers/FrmXMLController.php @@ -680,9 +680,9 @@ public static function generate_csv( $atts ) { * * @since 2.0.19 * - * @param false|int|string $form_id - * @param string $search - * @param string $fid + * @param bool|false|int|string $form_id + * @param string $search + * @param string $fid * * @return void */ diff --git a/classes/helpers/FrmAppHelper.php b/classes/helpers/FrmAppHelper.php index 8df4e8607d..ffcf9bd42e 100644 --- a/classes/helpers/FrmAppHelper.php +++ b/classes/helpers/FrmAppHelper.php @@ -4679,7 +4679,7 @@ public static function set_current_screen_and_hook_suffix() { * * @since 5.2.02 * - * @param string $text Text in the pill. Default is NEW. + * @param string|null $text Text in the pill. Default is NEW. */ public static function show_pill_text( $text = null ) { if ( null === $text ) { diff --git a/classes/helpers/FrmFieldsHelper.php b/classes/helpers/FrmFieldsHelper.php index e755d33e45..3bd88f64fd 100644 --- a/classes/helpers/FrmFieldsHelper.php +++ b/classes/helpers/FrmFieldsHelper.php @@ -2192,8 +2192,8 @@ public static function get_countries() { * * @since 5.0.04 Add `$include_class` param. * - * @param array $prepop Bulk options. - * @param array|false $include_class Include the class in the bulk options. + * @param array $prepop Bulk options. + * @param array|bool|false $include_class Include the class in the bulk options. * * @return void */ diff --git a/classes/helpers/FrmFormsHelper.php b/classes/helpers/FrmFormsHelper.php index 0bab77e124..65bb3a22a1 100644 --- a/classes/helpers/FrmFormsHelper.php +++ b/classes/helpers/FrmFormsHelper.php @@ -24,8 +24,8 @@ public static function form_error_class() { } /** - * @param string $key - * @param false|object $form + * @param string $key + * @param bool|false|object $form * * @return string */ @@ -100,7 +100,7 @@ public static function add_html_attr( $class, $param, &$add_html ) { } /** - * @param false|object|string $selected - The label for the placeholder, or the form object. + * @param bool|false|object|string $selected - The label for the placeholder, or the form object. * * @return void */ diff --git a/classes/helpers/FrmOnSubmitHelper.php b/classes/helpers/FrmOnSubmitHelper.php index 7ae25cbac6..4067eee828 100644 --- a/classes/helpers/FrmOnSubmitHelper.php +++ b/classes/helpers/FrmOnSubmitHelper.php @@ -237,9 +237,9 @@ public static function save_on_submit_settings( $form_id ) { /** * Populates the On Submit data to form options. * - * @param array $form_options Form options. - * @param object $action Optional. The On Submit action object. - * @param string $event Form event. Default is `create`. + * @param array $form_options Form options. + * @param object|null $action Optional. The On Submit action object. + * @param string $event Form event. Default is `create`. * * @return void */ diff --git a/classes/models/FrmAddon.php b/classes/models/FrmAddon.php index 2fa3c67b98..f7874f62e2 100644 --- a/classes/models/FrmAddon.php +++ b/classes/models/FrmAddon.php @@ -175,9 +175,9 @@ public function edd_plugin_updater() { * * @uses api_request() * - * @param mixed $_data - * @param string $_action - * @param object $_args + * @param mixed $_data + * @param string $_action + * @param object|null $_args * * @return object Data. */ diff --git a/classes/models/FrmField.php b/classes/models/FrmField.php index 2cde473ad6..c227c41c32 100644 --- a/classes/models/FrmField.php +++ b/classes/models/FrmField.php @@ -584,10 +584,10 @@ public static function duplicate_single_field( $field_id, $form_id ) { } /** - * @param int|string $old_form_id - * @param int|string $form_id - * @param bool $copy_keys - * @param false|int $blog_id + * @param int|string $old_form_id + * @param int|string $form_id + * @param bool $copy_keys + * @param bool|false|int $blog_id * * @return void */ @@ -1060,10 +1060,10 @@ public static function include_sub_fields( &$results, $inc_embed, $type = 'all', } /** - * @param array|string $where - * @param string $order_by - * @param string $limit - * @param false|int $blog_id + * @param array|string $where + * @param string $order_by + * @param string $limit + * @param bool|false|int $blog_id * * @return array|object|null */ diff --git a/classes/models/FrmForm.php b/classes/models/FrmForm.php index d77620a6aa..63dbaef5de 100644 --- a/classes/models/FrmForm.php +++ b/classes/models/FrmForm.php @@ -74,10 +74,10 @@ private static function maybe_filter_form_options( $options ) { /** * Duplicate a form. * - * @param int $id Form ID to duplicate. - * @param bool $template Whether the duplicated form is a template. - * @param bool $copy_keys Whether to copy the original form key. - * @param false|int $blog_id Blog ID when duplicating across sites, or false for current site. + * @param int $id Form ID to duplicate. + * @param bool $template Whether the duplicated form is a template. + * @param bool $copy_keys Whether to copy the original form key. + * @param bool|false|int $blog_id Blog ID when duplicating across sites, or false for current site. * * @return bool|int ID on success or false on failure */ @@ -848,8 +848,8 @@ public static function maybe_get_form( &$form ) { } /** - * @param int|string $id - * @param false|int $blog_id + * @param int|string $id + * @param bool|false|int $blog_id * * @return stdClass|null */ diff --git a/classes/models/FrmFormAction.php b/classes/models/FrmFormAction.php index b10ff4ff9a..fbf8c214fd 100644 --- a/classes/models/FrmFormAction.php +++ b/classes/models/FrmFormAction.php @@ -285,7 +285,7 @@ public function _set( $number ) { } /** - * @param false|int|string $form_id + * @param bool|false|int|string $form_id * * @return object */ @@ -717,8 +717,8 @@ public static function form_has_action_type( $form_id, $type ) { } /** - * @param false|int|string $form_id - * @param array $atts + * @param bool|false|int|string $form_id + * @param array $atts * * @return array */ @@ -825,8 +825,8 @@ public function prepare_action( $action ) { } /** - * @param false|int|string $form_id - * @param string $type + * @param bool|false|int|string $form_id + * @param string $type * * @return void */ diff --git a/classes/models/FrmInbox.php b/classes/models/FrmInbox.php index 974242fb46..1d3deda3c8 100644 --- a/classes/models/FrmInbox.php +++ b/classes/models/FrmInbox.php @@ -54,7 +54,7 @@ protected function api_url() { /** * @since 4.05 * - * @param array|false $filter + * @param array|bool|false $filter * * @return array */ diff --git a/phpcs-sniffs/Formidable/Sniffs/Commenting/AddMissingParamTypeFromDefaultSniff.php b/phpcs-sniffs/Formidable/Sniffs/Commenting/AddMissingParamTypeFromDefaultSniff.php new file mode 100644 index 0000000000..5c190ca430 --- /dev/null +++ b/phpcs-sniffs/Formidable/Sniffs/Commenting/AddMissingParamTypeFromDefaultSniff.php @@ -0,0 +1,449 @@ +getTokens(); + + // Check if function has a docblock. + $docblock = $this->findDocblock( $phpcsFile, $stackPtr ); + + if ( false === $docblock ) { + return; + } + + // Get function parameters with their default values. + $params = $this->getParametersWithDefaults( $phpcsFile, $stackPtr ); + + if ( empty( $params ) ) { + return; + } + + // Get existing @param tags with their types. + $existingParams = $this->getExistingParamTags( $phpcsFile, $docblock ); + + if ( empty( $existingParams ) ) { + return; + } + + // Find missing types based on default values. + $missingTypes = array(); + + foreach ( $params as $param ) { + $paramName = $param['name']; + + if ( ! isset( $existingParams[ $paramName ] ) ) { + continue; + } + + if ( null === $param['default_type'] ) { + continue; + } + + $existingType = $existingParams[ $paramName ]['type']; + $defaultType = $param['default_type']; + + if ( ! $this->typeIncludesType( $existingType, $defaultType ) ) { + $missingTypes[ $paramName ] = array( + 'existing' => $existingType, + 'missing' => $defaultType, + 'token' => $existingParams[ $paramName ]['token'], + ); + } + } + + if ( empty( $missingTypes ) ) { + return; + } + + // Report and fix each missing type. + foreach ( $missingTypes as $paramName => $info ) { + $newType = $info['existing'] . '|' . $info['missing']; + + $fix = $phpcsFile->addFixableError( + '@param %s is missing type "%s" based on default value', + $info['token'], + 'MissingParamTypeFromDefault', + array( $paramName, $info['missing'] ) + ); + + if ( $fix ) { + $this->fixParamType( $phpcsFile, $info['token'], $info['existing'], $newType ); + } + } + } + + /** + * Find the docblock for a function. + * + * @param File $phpcsFile The file being scanned. + * @param int $stackPtr The function token position. + * + * @return false|int The docblock opener position, or false. + */ + private function findDocblock( File $phpcsFile, $stackPtr ) { + $tokens = $phpcsFile->getTokens(); + + $ignore = array( + T_WHITESPACE, + T_STATIC, + T_PUBLIC, + T_PRIVATE, + T_PROTECTED, + T_ABSTRACT, + T_FINAL, + ); + + $prev = $phpcsFile->findPrevious( $ignore, $stackPtr - 1, null, true ); + + if ( false !== $prev && $tokens[ $prev ]['code'] === T_DOC_COMMENT_CLOSE_TAG ) { + return $tokens[ $prev ]['comment_opener']; + } + + return false; + } + + /** + * Get function parameters with their default values. + * + * @param File $phpcsFile The file being scanned. + * @param int $stackPtr The function token position. + * + * @return array Array of parameter info including default type. + */ + private function getParametersWithDefaults( File $phpcsFile, $stackPtr ) { + $tokens = $phpcsFile->getTokens(); + $params = array(); + + if ( ! isset( $tokens[ $stackPtr ]['parenthesis_opener'] ) ) { + return $params; + } + + $opener = $tokens[ $stackPtr ]['parenthesis_opener']; + $closer = $tokens[ $stackPtr ]['parenthesis_closer']; + + for ( $i = $opener + 1; $i < $closer; $i++ ) { + if ( $tokens[ $i ]['code'] !== T_VARIABLE ) { + continue; + } + + $paramName = $tokens[ $i ]['content']; + $defaultType = null; + + // Look for = after the variable. + $next = $phpcsFile->findNext( T_WHITESPACE, $i + 1, $closer, true ); + + if ( false !== $next && $tokens[ $next ]['code'] === T_EQUAL ) { + $defaultType = $this->getDefaultValueType( $phpcsFile, $next + 1, $closer ); + } + + $params[] = array( + 'name' => $paramName, + 'token' => $i, + 'default_type' => $defaultType, + ); + } + + return $params; + } + + /** + * Determine the type of a default value. + * + * @param File $phpcsFile The file being scanned. + * @param int $startPtr The position after the = sign. + * @param int $endPtr The end of the parameter list. + * + * @return string|null The type of the default value, or null if unknown. + */ + private function getDefaultValueType( File $phpcsFile, $startPtr, $endPtr ) { + $tokens = $phpcsFile->getTokens(); + + // Find the first non-whitespace token after =. + $valueToken = $phpcsFile->findNext( T_WHITESPACE, $startPtr, $endPtr, true ); + + if ( false === $valueToken ) { + return null; + } + + $code = $tokens[ $valueToken ]['code']; + $content = $tokens[ $valueToken ]['content']; + + // Array literals. + if ( $code === T_ARRAY || $code === T_OPEN_SHORT_ARRAY ) { + return 'array'; + } + + // Null. + if ( $code === T_NULL ) { + return 'null'; + } + + // Boolean. + if ( $code === T_TRUE || $code === T_FALSE ) { + return 'bool'; + } + + // Integer. + if ( $code === T_LNUMBER ) { + return 'int'; + } + + // Float. + if ( $code === T_DNUMBER ) { + return 'float'; + } + + // String (single or double quoted, or heredoc/nowdoc). + if ( $code === T_CONSTANT_ENCAPSED_STRING || $code === T_START_HEREDOC || $code === T_START_NOWDOC ) { + return 'string'; + } + + // Empty string ''. + if ( $content === "''" || $content === '""' ) { + return 'string'; + } + + return null; + } + + /** + * Get existing @param tags from docblock with their types. + * + * @param File $phpcsFile The file being scanned. + * @param int $docblock The docblock opener position. + * + * @return array Associative array of param name => array('type' => string, 'token' => int). + */ + private function getExistingParamTags( File $phpcsFile, $docblock ) { + $tokens = $phpcsFile->getTokens(); + $existing = array(); + + if ( ! isset( $tokens[ $docblock ]['comment_closer'] ) ) { + return $existing; + } + + $closer = $tokens[ $docblock ]['comment_closer']; + + for ( $i = $docblock; $i < $closer; $i++ ) { + if ( $tokens[ $i ]['code'] !== T_DOC_COMMENT_TAG ) { + continue; + } + + if ( $tokens[ $i ]['content'] !== '@param' ) { + continue; + } + + // Find the type and parameter name in this @param line. + for ( $j = $i + 1; $j < $closer; $j++ ) { + if ( $tokens[ $j ]['code'] === T_DOC_COMMENT_STRING ) { + $content = $tokens[ $j ]['content']; + + // Parse "type $varName description" format. + if ( preg_match( '/^([^\s]+)\s+(\$\w+)/', $content, $matches ) ) { + $existing[ $matches[2] ] = array( + 'type' => $matches[1], + 'token' => $j, + ); + } + break; + } + + if ( $tokens[ $j ]['code'] === T_DOC_COMMENT_TAG ) { + break; + } + } + } + + return $existing; + } + + /** + * Check if an existing type string includes a specific type. + * + * @param string $existingType The existing type string (e.g., "string|array"). + * @param string $checkType The type to check for. + * + * @return bool + */ + private function typeIncludesType( $existingType, $checkType ) { + // Split existing type by | for checking. + $existingTypes = explode( '|', $existingType ); + + // If checking for 'array', also check for typed arrays and shorthand notation. + if ( $checkType === 'array' ) { + foreach ( $existingTypes as $existing ) { + $normalized = $this->normalizeType( $existing ); + + if ( $normalized === 'array' ) { + return true; + } + } + + return false; + } + + // If checking for 'object', treat any class name as covering it. + if ( $checkType === 'object' ) { + foreach ( $existingTypes as $existing ) { + $normalized = $this->normalizeType( $existing ); + + if ( $normalized === 'object' || $this->isClassName( $existing ) ) { + return true; + } + } + + return false; + } + + foreach ( $existingTypes as $existing ) { + $normalizedExisting = $this->normalizeType( $existing ); + $normalizedCheck = $this->normalizeType( $checkType ); + + if ( $normalizedExisting === $normalizedCheck ) { + return true; + } + + // Check if 'mixed' covers everything. + if ( $normalizedExisting === 'mixed' ) { + return true; + } + } + + return false; + } + + /** + * Check if a type string looks like a class name. + * + * @param string $type The type to check. + * + * @return bool + */ + private function isClassName( $type ) { + $type = trim( $type ); + + // Skip primitive types and known non-class types. + $primitives = array( + 'int', 'integer', 'float', 'double', 'real', 'string', 'bool', 'boolean', + 'array', 'object', 'null', 'mixed', 'void', 'callable', 'iterable', + 'resource', 'true', 'false', 'self', 'static', 'parent', + ); + + $lowerType = strtolower( $type ); + + if ( in_array( $lowerType, $primitives, true ) ) { + return false; + } + + // Skip if it's an array notation. + if ( preg_match( '/\[\]$/', $type ) || preg_match( '/^array\s*[<{]/', $lowerType ) ) { + return false; + } + + // If it starts with uppercase or contains backslash (namespace), it's likely a class. + if ( preg_match( '/^[A-Z]/', $type ) || strpos( $type, '\\' ) !== false ) { + return true; + } + + return false; + } + + /** + * Normalize a type for comparison. + * + * @param string $type The type to normalize. + * + * @return string + */ + private function normalizeType( $type ) { + $type = strtolower( trim( $type ) ); + + // Normalize common aliases. + $aliases = array( + 'integer' => 'int', + 'boolean' => 'bool', + 'double' => 'float', + 'real' => 'float', + 'long' => 'int', + 'stdclass' => 'object', + 'closure' => 'callable', + ); + + if ( isset( $aliases[ $type ] ) ) { + return $aliases[ $type ]; + } + + // Normalize typed arrays (array, array, etc.) to just 'array'. + if ( preg_match( '/^array\s*getTokens(); + $content = $tokens[ $tokenPtr ]['content']; + + // Replace the old type with the new type. + $newContent = preg_replace( + '/^' . preg_quote( $oldType, '/' ) . '/', + $newType, + $content, + 1 + ); + + $phpcsFile->fixer->beginChangeset(); + $phpcsFile->fixer->replaceToken( $tokenPtr, $newContent ); + $phpcsFile->fixer->endChangeset(); + } +} diff --git a/phpcs-sniffs/Formidable/ruleset.xml b/phpcs-sniffs/Formidable/ruleset.xml index 504157f4c6..55391ce7c5 100644 --- a/phpcs-sniffs/Formidable/ruleset.xml +++ b/phpcs-sniffs/Formidable/ruleset.xml @@ -72,4 +72,5 @@ + diff --git a/square/controllers/FrmSquareLiteActionsController.php b/square/controllers/FrmSquareLiteActionsController.php index 98665b8865..7a9e3e01c6 100644 --- a/square/controllers/FrmSquareLiteActionsController.php +++ b/square/controllers/FrmSquareLiteActionsController.php @@ -8,8 +8,8 @@ class FrmSquareLiteActionsController extends FrmTransLiteActionsController { /** * @since 6.22 * - * @param string $callback - * @param array|false|object $field + * @param string $callback + * @param array|bool|false|object $field * * @return string */ diff --git a/square/helpers/FrmSquareLiteAppHelper.php b/square/helpers/FrmSquareLiteAppHelper.php index e5eb4938f7..8a87920384 100644 --- a/square/helpers/FrmSquareLiteAppHelper.php +++ b/square/helpers/FrmSquareLiteAppHelper.php @@ -54,8 +54,8 @@ public static function active_mode() { /** * Add education about Stripe fees. * - * @param string $content UTM Content for the admin upgrade link. - * @param array|false|string $gateway Gateway or list of gateways this applies to. + * @param string $content UTM Content for the admin upgrade link. + * @param array|bool|false|string $gateway Gateway or list of gateways this applies to. * * @return void */ diff --git a/stripe/controllers/FrmStrpLiteActionsController.php b/stripe/controllers/FrmStrpLiteActionsController.php index 13ed6fba3e..e78f08e0bc 100644 --- a/stripe/controllers/FrmStrpLiteActionsController.php +++ b/stripe/controllers/FrmStrpLiteActionsController.php @@ -13,8 +13,8 @@ class FrmStrpLiteActionsController extends FrmTransLiteActionsController { /** * @since 6.22 * - * @param string $callback - * @param array|false|object $field + * @param string $callback + * @param array|bool|false|object $field * * @return string */ diff --git a/stripe/helpers/FrmStrpLiteAppHelper.php b/stripe/helpers/FrmStrpLiteAppHelper.php index 8e15c07051..4dd295a845 100644 --- a/stripe/helpers/FrmStrpLiteAppHelper.php +++ b/stripe/helpers/FrmStrpLiteAppHelper.php @@ -99,8 +99,8 @@ public static function active_mode() { /** * Add education about Stripe fees. * - * @param string $content UTM Content for the admin upgrade link. - * @param array|false|string $gateway Gateway or list of gateways this applies to. + * @param string $content UTM Content for the admin upgrade link. + * @param array|bool|false|string $gateway Gateway or list of gateways this applies to. * * @return void */ diff --git a/stripe/helpers/FrmStrpLiteConnectApiAdapter.php b/stripe/helpers/FrmStrpLiteConnectApiAdapter.php index eb4290a2be..2affa03028 100644 --- a/stripe/helpers/FrmStrpLiteConnectApiAdapter.php +++ b/stripe/helpers/FrmStrpLiteConnectApiAdapter.php @@ -211,8 +211,8 @@ public static function update_intent( $intent_id, $data ) { * * @since 6.5, introduced in v3.0 of the Stripe add on. * - * @param string $customer_id Customer ID beginning with cus_. - * @param array|false $payment_method_types If false the types will defaults to array( 'card', 'link' ). + * @param string $customer_id Customer ID beginning with cus_. + * @param array|bool|false $payment_method_types If false the types will defaults to array( 'card', 'link' ). * * @return false|object|string */ diff --git a/stripe/helpers/FrmStrpLiteConnectHelper.php b/stripe/helpers/FrmStrpLiteConnectHelper.php index 16148d4bba..19c95c2363 100644 --- a/stripe/helpers/FrmStrpLiteConnectHelper.php +++ b/stripe/helpers/FrmStrpLiteConnectHelper.php @@ -791,8 +791,8 @@ public static function create_subscription( $new_charge ) { } /** - * @param string $sub_id - * @param false|string $customer_id if specified, this will enforce a customer id match (bypassed for users with administrator permission). + * @param string $sub_id + * @param bool|false|string $customer_id if specified, this will enforce a customer id match (bypassed for users with administrator permission). * * @return bool */ @@ -908,8 +908,8 @@ public static function get_unprocessed_event_ids() { * * @since 6.5, introduced in v3.0 of the Stripe add on. * - * @param string $customer_id - * @param array|false $payment_method_types + * @param string $customer_id + * @param array|bool|false $payment_method_types * * @return false|object|string */ diff --git a/stripe/models/FrmTransLitePayment.php b/stripe/models/FrmTransLitePayment.php index a759c78213..5998d5de43 100755 --- a/stripe/models/FrmTransLitePayment.php +++ b/stripe/models/FrmTransLitePayment.php @@ -73,8 +73,8 @@ public function get_defaults() { * * @since 6.7 * - * @param string $from_date From date. - * @param string $to_date To date. + * @param string|null $from_date From date. + * @param string|null $to_date To date. * * @return array Contains `count` and `total`. */ diff --git a/tests/phpunit/misc/test_FrmDirectFileAccess.php b/tests/phpunit/misc/test_FrmDirectFileAccess.php index 58c8d00369..cce7d91b71 100644 --- a/tests/phpunit/misc/test_FrmDirectFileAccess.php +++ b/tests/phpunit/misc/test_FrmDirectFileAccess.php @@ -6,7 +6,7 @@ class test_FrmDirectFileAccess extends FrmUnitTest { /** - * @param string $dir + * @param bool|string $dir * @param array $results * * @return array From 295bae43e22ffa7e27f49954f6123ff4233b2351 Mon Sep 17 00:00:00 2001 From: Mike Letellier Date: Fri, 23 Jan 2026 11:47:58 -0400 Subject: [PATCH 2/7] Revert bool|false strings --- classes/controllers/FrmDashboardController.php | 6 +++--- classes/controllers/FrmEmailStylesController.php | 4 ++-- classes/controllers/FrmEntriesController.php | 2 +- classes/controllers/FrmFormsController.php | 4 ++-- classes/controllers/FrmXMLController.php | 2 +- classes/helpers/FrmFieldsHelper.php | 2 +- classes/helpers/FrmFormsHelper.php | 4 ++-- classes/models/FrmEntryMeta.php | 2 +- classes/models/FrmField.php | 4 ++-- classes/models/FrmForm.php | 4 ++-- classes/models/FrmFormAction.php | 6 +++--- classes/models/FrmInbox.php | 2 +- .../AddMissingParamTypeFromDefaultSniff.php | 13 +++++++++++++ .../controllers/FrmSquareLiteActionsController.php | 2 +- square/helpers/FrmSquareLiteAppHelper.php | 2 +- stripe/controllers/FrmStrpLiteActionsController.php | 2 +- stripe/helpers/FrmStrpLiteAppHelper.php | 2 +- stripe/helpers/FrmStrpLiteConnectApiAdapter.php | 2 +- stripe/helpers/FrmStrpLiteConnectHelper.php | 4 ++-- 19 files changed, 41 insertions(+), 28 deletions(-) diff --git a/classes/controllers/FrmDashboardController.php b/classes/controllers/FrmDashboardController.php index 49cf7da0fb..178c91d8a3 100644 --- a/classes/controllers/FrmDashboardController.php +++ b/classes/controllers/FrmDashboardController.php @@ -285,9 +285,9 @@ private static function view_args_entries_placeholder( $forms_count ) { /** * A function to handle the counters cta from the top: Total Forms, Total Entries, All Views, Installed Apps. * - * @param string $counter_type - * @param int $counter_value - * @param bool|false|object $latest_available_form The form object of the latest form available. If there are at least one + * @param string $counter_type + * @param int $counter_value + * @param false|object $latest_available_form The form object of the latest form available. If there are at least one * form available we show "Add Entry" cta for entries counter. * * @return array diff --git a/classes/controllers/FrmEmailStylesController.php b/classes/controllers/FrmEmailStylesController.php index ea167a29e5..915c7f9207 100644 --- a/classes/controllers/FrmEmailStylesController.php +++ b/classes/controllers/FrmEmailStylesController.php @@ -106,7 +106,7 @@ public static function get_default_email_style() { /** * Gets the test email content. * - * @param bool|false|string $style_key Default is `false`, using the one in settings. + * @param false|string $style_key Default is `false`, using the one in settings. * * @return string */ @@ -229,7 +229,7 @@ public static function get_content_for_one_column_cell( $label, $value ) { /** * Gets table generator object for an email style. * - * @param bool|false|string $email_style Email style. Default is `false`: using the one in global settings. + * @param false|string $email_style Email style. Default is `false`: using the one in global settings. * * @return FrmTableHTMLGenerator */ diff --git a/classes/controllers/FrmEntriesController.php b/classes/controllers/FrmEntriesController.php index df3904fe8e..d2360fa1cc 100644 --- a/classes/controllers/FrmEntriesController.php +++ b/classes/controllers/FrmEntriesController.php @@ -937,7 +937,7 @@ public static function show_entry_shortcode( $atts ) { } /** - * @param bool|false|object $entry + * @param false|object $entry * * @return void */ diff --git a/classes/controllers/FrmFormsController.php b/classes/controllers/FrmFormsController.php index d1ecacf569..94335afc45 100644 --- a/classes/controllers/FrmFormsController.php +++ b/classes/controllers/FrmFormsController.php @@ -207,7 +207,7 @@ private static function create_submit_button_field( $form ) { } /** - * @param array|bool|false $values + * @param array|false $values * * @return void */ @@ -1930,7 +1930,7 @@ public static function get_email_html() { /** * @param string $content * @param int|stdClass|string $form - * @param bool|false|int|stdClass|string $entry + * @param false|int|stdClass|string $entry * * @return string */ diff --git a/classes/controllers/FrmXMLController.php b/classes/controllers/FrmXMLController.php index b9eab85814..a67a82873f 100644 --- a/classes/controllers/FrmXMLController.php +++ b/classes/controllers/FrmXMLController.php @@ -680,7 +680,7 @@ public static function generate_csv( $atts ) { * * @since 2.0.19 * - * @param bool|false|int|string $form_id + * @param false|int|string $form_id * @param string $search * @param string $fid * diff --git a/classes/helpers/FrmFieldsHelper.php b/classes/helpers/FrmFieldsHelper.php index 3bd88f64fd..443f88b2a6 100644 --- a/classes/helpers/FrmFieldsHelper.php +++ b/classes/helpers/FrmFieldsHelper.php @@ -2193,7 +2193,7 @@ public static function get_countries() { * @since 5.0.04 Add `$include_class` param. * * @param array $prepop Bulk options. - * @param array|bool|false $include_class Include the class in the bulk options. + * @param array|false $include_class Include the class in the bulk options. * * @return void */ diff --git a/classes/helpers/FrmFormsHelper.php b/classes/helpers/FrmFormsHelper.php index 65bb3a22a1..e56c5a4d8a 100644 --- a/classes/helpers/FrmFormsHelper.php +++ b/classes/helpers/FrmFormsHelper.php @@ -25,7 +25,7 @@ public static function form_error_class() { /** * @param string $key - * @param bool|false|object $form + * @param false|object $form * * @return string */ @@ -100,7 +100,7 @@ public static function add_html_attr( $class, $param, &$add_html ) { } /** - * @param bool|false|object|string $selected - The label for the placeholder, or the form object. + * @param false|object|string $selected - The label for the placeholder, or the form object. * * @return void */ diff --git a/classes/models/FrmEntryMeta.php b/classes/models/FrmEntryMeta.php index 4b5455cfe4..5285365892 100644 --- a/classes/models/FrmEntryMeta.php +++ b/classes/models/FrmEntryMeta.php @@ -47,7 +47,7 @@ public static function add_entry_meta( $entry_id, $field_id, $meta_key, $meta_va * @param string $meta_key Deprecated. * @param array|string $meta_value * - * @return bool|false|int + * @return false|int */ public static function update_entry_meta( $entry_id, $field_id, $meta_key, $meta_value ) { if ( ! $field_id ) { diff --git a/classes/models/FrmField.php b/classes/models/FrmField.php index c227c41c32..f74407f4fd 100644 --- a/classes/models/FrmField.php +++ b/classes/models/FrmField.php @@ -587,7 +587,7 @@ public static function duplicate_single_field( $field_id, $form_id ) { * @param int|string $old_form_id * @param int|string $form_id * @param bool $copy_keys - * @param bool|false|int $blog_id + * @param false|int $blog_id * * @return void */ @@ -1063,7 +1063,7 @@ public static function include_sub_fields( &$results, $inc_embed, $type = 'all', * @param array|string $where * @param string $order_by * @param string $limit - * @param bool|false|int $blog_id + * @param false|int $blog_id * * @return array|object|null */ diff --git a/classes/models/FrmForm.php b/classes/models/FrmForm.php index 63dbaef5de..13cdf799e5 100644 --- a/classes/models/FrmForm.php +++ b/classes/models/FrmForm.php @@ -77,7 +77,7 @@ private static function maybe_filter_form_options( $options ) { * @param int $id Form ID to duplicate. * @param bool $template Whether the duplicated form is a template. * @param bool $copy_keys Whether to copy the original form key. - * @param bool|false|int $blog_id Blog ID when duplicating across sites, or false for current site. + * @param false|int $blog_id Blog ID when duplicating across sites, or false for current site. * * @return bool|int ID on success or false on failure */ @@ -849,7 +849,7 @@ public static function maybe_get_form( &$form ) { /** * @param int|string $id - * @param bool|false|int $blog_id + * @param false|int $blog_id * * @return stdClass|null */ diff --git a/classes/models/FrmFormAction.php b/classes/models/FrmFormAction.php index fbf8c214fd..e920a33eca 100644 --- a/classes/models/FrmFormAction.php +++ b/classes/models/FrmFormAction.php @@ -285,7 +285,7 @@ public function _set( $number ) { } /** - * @param bool|false|int|string $form_id + * @param false|int|string $form_id * * @return object */ @@ -717,7 +717,7 @@ public static function form_has_action_type( $form_id, $type ) { } /** - * @param bool|false|int|string $form_id + * @param false|int|string $form_id * @param array $atts * * @return array @@ -825,7 +825,7 @@ public function prepare_action( $action ) { } /** - * @param bool|false|int|string $form_id + * @param false|int|string $form_id * @param string $type * * @return void diff --git a/classes/models/FrmInbox.php b/classes/models/FrmInbox.php index 1d3deda3c8..974242fb46 100644 --- a/classes/models/FrmInbox.php +++ b/classes/models/FrmInbox.php @@ -54,7 +54,7 @@ protected function api_url() { /** * @since 4.05 * - * @param array|bool|false $filter + * @param array|false $filter * * @return array */ diff --git a/phpcs-sniffs/Formidable/Sniffs/Commenting/AddMissingParamTypeFromDefaultSniff.php b/phpcs-sniffs/Formidable/Sniffs/Commenting/AddMissingParamTypeFromDefaultSniff.php index 5c190ca430..618a9eaa1d 100644 --- a/phpcs-sniffs/Formidable/Sniffs/Commenting/AddMissingParamTypeFromDefaultSniff.php +++ b/phpcs-sniffs/Formidable/Sniffs/Commenting/AddMissingParamTypeFromDefaultSniff.php @@ -329,6 +329,19 @@ private function typeIncludesType( $existingType, $checkType ) { return false; } + // If checking for 'bool', also accept 'true' or 'false' as covering it. + if ( $checkType === 'bool' ) { + foreach ( $existingTypes as $existing ) { + $normalized = $this->normalizeType( $existing ); + + if ( $normalized === 'bool' || $normalized === 'true' || $normalized === 'false' ) { + return true; + } + } + + return false; + } + foreach ( $existingTypes as $existing ) { $normalizedExisting = $this->normalizeType( $existing ); $normalizedCheck = $this->normalizeType( $checkType ); diff --git a/square/controllers/FrmSquareLiteActionsController.php b/square/controllers/FrmSquareLiteActionsController.php index 7a9e3e01c6..a559f69043 100644 --- a/square/controllers/FrmSquareLiteActionsController.php +++ b/square/controllers/FrmSquareLiteActionsController.php @@ -9,7 +9,7 @@ class FrmSquareLiteActionsController extends FrmTransLiteActionsController { * @since 6.22 * * @param string $callback - * @param array|bool|false|object $field + * @param array|false|object $field * * @return string */ diff --git a/square/helpers/FrmSquareLiteAppHelper.php b/square/helpers/FrmSquareLiteAppHelper.php index 8a87920384..a4a16a2afc 100644 --- a/square/helpers/FrmSquareLiteAppHelper.php +++ b/square/helpers/FrmSquareLiteAppHelper.php @@ -55,7 +55,7 @@ public static function active_mode() { * Add education about Stripe fees. * * @param string $content UTM Content for the admin upgrade link. - * @param array|bool|false|string $gateway Gateway or list of gateways this applies to. + * @param array|false|string $gateway Gateway or list of gateways this applies to. * * @return void */ diff --git a/stripe/controllers/FrmStrpLiteActionsController.php b/stripe/controllers/FrmStrpLiteActionsController.php index e78f08e0bc..bbda992b4c 100644 --- a/stripe/controllers/FrmStrpLiteActionsController.php +++ b/stripe/controllers/FrmStrpLiteActionsController.php @@ -14,7 +14,7 @@ class FrmStrpLiteActionsController extends FrmTransLiteActionsController { * @since 6.22 * * @param string $callback - * @param array|bool|false|object $field + * @param array|false|object $field * * @return string */ diff --git a/stripe/helpers/FrmStrpLiteAppHelper.php b/stripe/helpers/FrmStrpLiteAppHelper.php index 4dd295a845..4bd1da54d2 100644 --- a/stripe/helpers/FrmStrpLiteAppHelper.php +++ b/stripe/helpers/FrmStrpLiteAppHelper.php @@ -100,7 +100,7 @@ public static function active_mode() { * Add education about Stripe fees. * * @param string $content UTM Content for the admin upgrade link. - * @param array|bool|false|string $gateway Gateway or list of gateways this applies to. + * @param array|false|string $gateway Gateway or list of gateways this applies to. * * @return void */ diff --git a/stripe/helpers/FrmStrpLiteConnectApiAdapter.php b/stripe/helpers/FrmStrpLiteConnectApiAdapter.php index 2affa03028..784df0a10d 100644 --- a/stripe/helpers/FrmStrpLiteConnectApiAdapter.php +++ b/stripe/helpers/FrmStrpLiteConnectApiAdapter.php @@ -212,7 +212,7 @@ public static function update_intent( $intent_id, $data ) { * @since 6.5, introduced in v3.0 of the Stripe add on. * * @param string $customer_id Customer ID beginning with cus_. - * @param array|bool|false $payment_method_types If false the types will defaults to array( 'card', 'link' ). + * @param array|false $payment_method_types If false the types will defaults to array( 'card', 'link' ). * * @return false|object|string */ diff --git a/stripe/helpers/FrmStrpLiteConnectHelper.php b/stripe/helpers/FrmStrpLiteConnectHelper.php index 19c95c2363..91cc6ac7bb 100644 --- a/stripe/helpers/FrmStrpLiteConnectHelper.php +++ b/stripe/helpers/FrmStrpLiteConnectHelper.php @@ -792,7 +792,7 @@ public static function create_subscription( $new_charge ) { /** * @param string $sub_id - * @param bool|false|string $customer_id if specified, this will enforce a customer id match (bypassed for users with administrator permission). + * @param false|string $customer_id if specified, this will enforce a customer id match (bypassed for users with administrator permission). * * @return bool */ @@ -909,7 +909,7 @@ public static function get_unprocessed_event_ids() { * @since 6.5, introduced in v3.0 of the Stripe add on. * * @param string $customer_id - * @param array|bool|false $payment_method_types + * @param array|false $payment_method_types * * @return false|object|string */ From fa866ac895d3eea2d35bf07e8eab8cf25efe7e28 Mon Sep 17 00:00:00 2001 From: Mike Letellier Date: Fri, 23 Jan 2026 11:49:09 -0400 Subject: [PATCH 3/7] Realign vars --- stripe/helpers/FrmStrpLiteConnectApiAdapter.php | 2 +- stripe/helpers/FrmStrpLiteConnectHelper.php | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/stripe/helpers/FrmStrpLiteConnectApiAdapter.php b/stripe/helpers/FrmStrpLiteConnectApiAdapter.php index 784df0a10d..eb4290a2be 100644 --- a/stripe/helpers/FrmStrpLiteConnectApiAdapter.php +++ b/stripe/helpers/FrmStrpLiteConnectApiAdapter.php @@ -211,7 +211,7 @@ public static function update_intent( $intent_id, $data ) { * * @since 6.5, introduced in v3.0 of the Stripe add on. * - * @param string $customer_id Customer ID beginning with cus_. + * @param string $customer_id Customer ID beginning with cus_. * @param array|false $payment_method_types If false the types will defaults to array( 'card', 'link' ). * * @return false|object|string diff --git a/stripe/helpers/FrmStrpLiteConnectHelper.php b/stripe/helpers/FrmStrpLiteConnectHelper.php index 91cc6ac7bb..7175352f7b 100644 --- a/stripe/helpers/FrmStrpLiteConnectHelper.php +++ b/stripe/helpers/FrmStrpLiteConnectHelper.php @@ -908,7 +908,7 @@ public static function get_unprocessed_event_ids() { * * @since 6.5, introduced in v3.0 of the Stripe add on. * - * @param string $customer_id + * @param string $customer_id * @param array|false $payment_method_types * * @return false|object|string From ffacd6dd135a99ef733ce91737b7f8c1eda2abe4 Mon Sep 17 00:00:00 2001 From: Mike Letellier Date: Fri, 23 Jan 2026 11:50:35 -0400 Subject: [PATCH 4/7] Run phpcbf --- classes/controllers/FrmFormsController.php | 8 ++++---- classes/controllers/FrmXMLController.php | 4 ++-- classes/helpers/FrmFieldsHelper.php | 2 +- classes/helpers/FrmFormsHelper.php | 2 +- classes/models/FrmAntiSpam.php | 2 +- classes/models/FrmField.php | 16 ++++++++-------- classes/models/FrmForm.php | 10 +++++----- classes/models/FrmFormAction.php | 4 ++-- .../FrmSquareLiteActionsController.php | 2 +- square/helpers/FrmSquareLiteAppHelper.php | 2 +- square/models/FrmSquareLiteSettings.php | 2 +- .../controllers/FrmStrpLiteActionsController.php | 2 +- stripe/controllers/FrmStrpLiteAppController.php | 2 +- stripe/controllers/FrmTransLiteAppController.php | 2 +- stripe/helpers/FrmStrpLiteAppHelper.php | 2 +- stripe/helpers/FrmStrpLiteConnectHelper.php | 2 +- stripe/models/FrmStrpLiteSettings.php | 2 +- stripe/models/FrmTransLiteDb.php | 2 +- 18 files changed, 34 insertions(+), 34 deletions(-) diff --git a/classes/controllers/FrmFormsController.php b/classes/controllers/FrmFormsController.php index 94335afc45..32fdb11bde 100644 --- a/classes/controllers/FrmFormsController.php +++ b/classes/controllers/FrmFormsController.php @@ -220,8 +220,8 @@ public static function edit( $values = false ) { } /** - * @param mixed $id - * @param string $message + * @param mixed|bool $id + * @param string $message * * @return void */ @@ -1928,8 +1928,8 @@ public static function get_email_html() { } /** - * @param string $content - * @param int|stdClass|string $form + * @param string $content + * @param int|stdClass|string $form * @param false|int|stdClass|string $entry * * @return string diff --git a/classes/controllers/FrmXMLController.php b/classes/controllers/FrmXMLController.php index a67a82873f..3208c81d9b 100644 --- a/classes/controllers/FrmXMLController.php +++ b/classes/controllers/FrmXMLController.php @@ -681,8 +681,8 @@ public static function generate_csv( $atts ) { * @since 2.0.19 * * @param false|int|string $form_id - * @param string $search - * @param string $fid + * @param string $search + * @param string $fid * * @return void */ diff --git a/classes/helpers/FrmFieldsHelper.php b/classes/helpers/FrmFieldsHelper.php index 443f88b2a6..e755d33e45 100644 --- a/classes/helpers/FrmFieldsHelper.php +++ b/classes/helpers/FrmFieldsHelper.php @@ -2192,7 +2192,7 @@ public static function get_countries() { * * @since 5.0.04 Add `$include_class` param. * - * @param array $prepop Bulk options. + * @param array $prepop Bulk options. * @param array|false $include_class Include the class in the bulk options. * * @return void diff --git a/classes/helpers/FrmFormsHelper.php b/classes/helpers/FrmFormsHelper.php index e56c5a4d8a..0bab77e124 100644 --- a/classes/helpers/FrmFormsHelper.php +++ b/classes/helpers/FrmFormsHelper.php @@ -24,7 +24,7 @@ public static function form_error_class() { } /** - * @param string $key + * @param string $key * @param false|object $form * * @return string diff --git a/classes/models/FrmAntiSpam.php b/classes/models/FrmAntiSpam.php index 55b00021ba..9f33f55d0c 100644 --- a/classes/models/FrmAntiSpam.php +++ b/classes/models/FrmAntiSpam.php @@ -49,7 +49,7 @@ public function init() { * * @since 4.11 * - * @param mixed $current True to use current time, otherwise a timestamp string. + * @param mixed|bool $current True to use current time, otherwise a timestamp string. * * @return string Token. */ diff --git a/classes/models/FrmField.php b/classes/models/FrmField.php index f74407f4fd..2cde473ad6 100644 --- a/classes/models/FrmField.php +++ b/classes/models/FrmField.php @@ -584,10 +584,10 @@ public static function duplicate_single_field( $field_id, $form_id ) { } /** - * @param int|string $old_form_id - * @param int|string $form_id - * @param bool $copy_keys - * @param false|int $blog_id + * @param int|string $old_form_id + * @param int|string $form_id + * @param bool $copy_keys + * @param false|int $blog_id * * @return void */ @@ -1060,10 +1060,10 @@ public static function include_sub_fields( &$results, $inc_embed, $type = 'all', } /** - * @param array|string $where - * @param string $order_by - * @param string $limit - * @param false|int $blog_id + * @param array|string $where + * @param string $order_by + * @param string $limit + * @param false|int $blog_id * * @return array|object|null */ diff --git a/classes/models/FrmForm.php b/classes/models/FrmForm.php index 13cdf799e5..d77620a6aa 100644 --- a/classes/models/FrmForm.php +++ b/classes/models/FrmForm.php @@ -74,9 +74,9 @@ private static function maybe_filter_form_options( $options ) { /** * Duplicate a form. * - * @param int $id Form ID to duplicate. - * @param bool $template Whether the duplicated form is a template. - * @param bool $copy_keys Whether to copy the original form key. + * @param int $id Form ID to duplicate. + * @param bool $template Whether the duplicated form is a template. + * @param bool $copy_keys Whether to copy the original form key. * @param false|int $blog_id Blog ID when duplicating across sites, or false for current site. * * @return bool|int ID on success or false on failure @@ -848,8 +848,8 @@ public static function maybe_get_form( &$form ) { } /** - * @param int|string $id - * @param false|int $blog_id + * @param int|string $id + * @param false|int $blog_id * * @return stdClass|null */ diff --git a/classes/models/FrmFormAction.php b/classes/models/FrmFormAction.php index e920a33eca..b10ff4ff9a 100644 --- a/classes/models/FrmFormAction.php +++ b/classes/models/FrmFormAction.php @@ -718,7 +718,7 @@ public static function form_has_action_type( $form_id, $type ) { /** * @param false|int|string $form_id - * @param array $atts + * @param array $atts * * @return array */ @@ -826,7 +826,7 @@ public function prepare_action( $action ) { /** * @param false|int|string $form_id - * @param string $type + * @param string $type * * @return void */ diff --git a/square/controllers/FrmSquareLiteActionsController.php b/square/controllers/FrmSquareLiteActionsController.php index a559f69043..98665b8865 100644 --- a/square/controllers/FrmSquareLiteActionsController.php +++ b/square/controllers/FrmSquareLiteActionsController.php @@ -8,7 +8,7 @@ class FrmSquareLiteActionsController extends FrmTransLiteActionsController { /** * @since 6.22 * - * @param string $callback + * @param string $callback * @param array|false|object $field * * @return string diff --git a/square/helpers/FrmSquareLiteAppHelper.php b/square/helpers/FrmSquareLiteAppHelper.php index a4a16a2afc..e5eb4938f7 100644 --- a/square/helpers/FrmSquareLiteAppHelper.php +++ b/square/helpers/FrmSquareLiteAppHelper.php @@ -54,7 +54,7 @@ public static function active_mode() { /** * Add education about Stripe fees. * - * @param string $content UTM Content for the admin upgrade link. + * @param string $content UTM Content for the admin upgrade link. * @param array|false|string $gateway Gateway or list of gateways this applies to. * * @return void diff --git a/square/models/FrmSquareLiteSettings.php b/square/models/FrmSquareLiteSettings.php index 82ca72bd87..55c6295b34 100644 --- a/square/models/FrmSquareLiteSettings.php +++ b/square/models/FrmSquareLiteSettings.php @@ -31,7 +31,7 @@ public function default_options() { } /** - * @param mixed $settings + * @param mixed|bool $settings * * @return void */ diff --git a/stripe/controllers/FrmStrpLiteActionsController.php b/stripe/controllers/FrmStrpLiteActionsController.php index bbda992b4c..13ed6fba3e 100644 --- a/stripe/controllers/FrmStrpLiteActionsController.php +++ b/stripe/controllers/FrmStrpLiteActionsController.php @@ -13,7 +13,7 @@ class FrmStrpLiteActionsController extends FrmTransLiteActionsController { /** * @since 6.22 * - * @param string $callback + * @param string $callback * @param array|false|object $field * * @return string diff --git a/stripe/controllers/FrmStrpLiteAppController.php b/stripe/controllers/FrmStrpLiteAppController.php index 4064b344f6..909558dcde 100644 --- a/stripe/controllers/FrmStrpLiteAppController.php +++ b/stripe/controllers/FrmStrpLiteAppController.php @@ -17,7 +17,7 @@ class FrmStrpLiteAppController { /** * Install required tables. * - * @param mixed $old_db_version + * @param mixed|bool $old_db_version * * @return void */ diff --git a/stripe/controllers/FrmTransLiteAppController.php b/stripe/controllers/FrmTransLiteAppController.php index 371a331d1f..3329f1df85 100755 --- a/stripe/controllers/FrmTransLiteAppController.php +++ b/stripe/controllers/FrmTransLiteAppController.php @@ -8,7 +8,7 @@ class FrmTransLiteAppController { /** * Install or upgrade database structures. * - * @param mixed $old_db_version Previous database version, or false on fresh install. + * @param mixed|bool $old_db_version Previous database version, or false on fresh install. * * @return void */ diff --git a/stripe/helpers/FrmStrpLiteAppHelper.php b/stripe/helpers/FrmStrpLiteAppHelper.php index 4bd1da54d2..8e15c07051 100644 --- a/stripe/helpers/FrmStrpLiteAppHelper.php +++ b/stripe/helpers/FrmStrpLiteAppHelper.php @@ -99,7 +99,7 @@ public static function active_mode() { /** * Add education about Stripe fees. * - * @param string $content UTM Content for the admin upgrade link. + * @param string $content UTM Content for the admin upgrade link. * @param array|false|string $gateway Gateway or list of gateways this applies to. * * @return void diff --git a/stripe/helpers/FrmStrpLiteConnectHelper.php b/stripe/helpers/FrmStrpLiteConnectHelper.php index 7175352f7b..16148d4bba 100644 --- a/stripe/helpers/FrmStrpLiteConnectHelper.php +++ b/stripe/helpers/FrmStrpLiteConnectHelper.php @@ -791,7 +791,7 @@ public static function create_subscription( $new_charge ) { } /** - * @param string $sub_id + * @param string $sub_id * @param false|string $customer_id if specified, this will enforce a customer id match (bypassed for users with administrator permission). * * @return bool diff --git a/stripe/models/FrmStrpLiteSettings.php b/stripe/models/FrmStrpLiteSettings.php index 48680c9809..00ef50a7e5 100644 --- a/stripe/models/FrmStrpLiteSettings.php +++ b/stripe/models/FrmStrpLiteSettings.php @@ -33,7 +33,7 @@ public function default_options() { } /** - * @param mixed $settings + * @param mixed|bool $settings * * @return void */ diff --git a/stripe/models/FrmTransLiteDb.php b/stripe/models/FrmTransLiteDb.php index c44de15294..7725e4df55 100755 --- a/stripe/models/FrmTransLiteDb.php +++ b/stripe/models/FrmTransLiteDb.php @@ -26,7 +26,7 @@ class FrmTransLiteDb { public $singular = ''; /** - * @param mixed $old_db_version + * @param mixed|bool $old_db_version * * @return void */ From 7830ab28ce605cfceb311ca689301e10896f266f Mon Sep 17 00:00:00 2001 From: Mike Letellier Date: Fri, 23 Jan 2026 11:52:53 -0400 Subject: [PATCH 5/7] Revert mixed|bool too --- classes/controllers/FrmFormsController.php | 2 +- classes/models/FrmAntiSpam.php | 2 +- .../AddMissingParamTypeFromDefaultSniff.php | 62 +++++++++++++++++-- square/models/FrmSquareLiteSettings.php | 2 +- .../controllers/FrmStrpLiteAppController.php | 2 +- .../controllers/FrmTransLiteAppController.php | 2 +- stripe/models/FrmStrpLiteSettings.php | 2 +- stripe/models/FrmTransLiteDb.php | 2 +- 8 files changed, 63 insertions(+), 13 deletions(-) diff --git a/classes/controllers/FrmFormsController.php b/classes/controllers/FrmFormsController.php index 32fdb11bde..0ca6cb3f36 100644 --- a/classes/controllers/FrmFormsController.php +++ b/classes/controllers/FrmFormsController.php @@ -220,7 +220,7 @@ public static function edit( $values = false ) { } /** - * @param mixed|bool $id + * @param mixed $id * @param string $message * * @return void diff --git a/classes/models/FrmAntiSpam.php b/classes/models/FrmAntiSpam.php index 9f33f55d0c..55b00021ba 100644 --- a/classes/models/FrmAntiSpam.php +++ b/classes/models/FrmAntiSpam.php @@ -49,7 +49,7 @@ public function init() { * * @since 4.11 * - * @param mixed|bool $current True to use current time, otherwise a timestamp string. + * @param mixed $current True to use current time, otherwise a timestamp string. * * @return string Token. */ diff --git a/phpcs-sniffs/Formidable/Sniffs/Commenting/AddMissingParamTypeFromDefaultSniff.php b/phpcs-sniffs/Formidable/Sniffs/Commenting/AddMissingParamTypeFromDefaultSniff.php index 618a9eaa1d..9acb39fdeb 100644 --- a/phpcs-sniffs/Formidable/Sniffs/Commenting/AddMissingParamTypeFromDefaultSniff.php +++ b/phpcs-sniffs/Formidable/Sniffs/Commenting/AddMissingParamTypeFromDefaultSniff.php @@ -91,13 +91,21 @@ public function process( File $phpcsFile, $stackPtr ) { // Report and fix each missing type. foreach ( $missingTypes as $paramName => $info ) { - $newType = $info['existing'] . '|' . $info['missing']; + $existingType = $info['existing']; + $missingType = $info['missing']; + + // If adding 'bool', remove 'false' from the existing type. + if ( $missingType === 'bool' ) { + $existingType = $this->removeFalseFromType( $existingType ); + } + + $newType = $existingType . '|' . $missingType; $fix = $phpcsFile->addFixableError( '@param %s is missing type "%s" based on default value', $info['token'], 'MissingParamTypeFromDefault', - array( $paramName, $info['missing'] ) + array( $paramName, $missingType ) ); if ( $fix ) { @@ -212,11 +220,16 @@ private function getDefaultValueType( File $phpcsFile, $startPtr, $endPtr ) { return 'null'; } - // Boolean. - if ( $code === T_TRUE || $code === T_FALSE ) { + // Boolean true - add bool type. + if ( $code === T_TRUE ) { return 'bool'; } + // Boolean false - only add if 'false' is not already in the type. + if ( $code === T_FALSE ) { + return 'false'; + } + // Integer. if ( $code === T_LNUMBER ) { return 'int'; @@ -300,6 +313,11 @@ private function getExistingParamTags( File $phpcsFile, $docblock ) { * @return bool */ private function typeIncludesType( $existingType, $checkType ) { + // If existing type is 'mixed', everything is covered. + if ( strtolower( trim( $existingType ) ) === 'mixed' ) { + return true; + } + // Split existing type by | for checking. $existingTypes = explode( '|', $existingType ); @@ -329,12 +347,25 @@ private function typeIncludesType( $existingType, $checkType ) { return false; } - // If checking for 'bool', also accept 'true' or 'false' as covering it. + // If checking for 'bool', accept 'bool' or 'true' as covering it (but not 'false' alone). if ( $checkType === 'bool' ) { foreach ( $existingTypes as $existing ) { $normalized = $this->normalizeType( $existing ); - if ( $normalized === 'bool' || $normalized === 'true' || $normalized === 'false' ) { + if ( $normalized === 'bool' || $normalized === 'true' ) { + return true; + } + } + + return false; + } + + // If checking for 'false', accept 'false' or 'bool' as covering it. + if ( $checkType === 'false' ) { + foreach ( $existingTypes as $existing ) { + $normalized = $this->normalizeType( $existing ); + + if ( $normalized === 'false' || $normalized === 'bool' ) { return true; } } @@ -433,6 +464,25 @@ private function normalizeType( $type ) { return $type; } + /** + * Remove 'false' from a type string. + * + * @param string $type The type string. + * + * @return string The type string without 'false'. + */ + private function removeFalseFromType( $type ) { + $types = explode( '|', $type ); + $types = array_filter( + $types, + function ( $t ) { + return strtolower( trim( $t ) ) !== 'false'; + } + ); + + return implode( '|', $types ); + } + /** * Fix the @param type by replacing the old type with the new type. * diff --git a/square/models/FrmSquareLiteSettings.php b/square/models/FrmSquareLiteSettings.php index 55c6295b34..82ca72bd87 100644 --- a/square/models/FrmSquareLiteSettings.php +++ b/square/models/FrmSquareLiteSettings.php @@ -31,7 +31,7 @@ public function default_options() { } /** - * @param mixed|bool $settings + * @param mixed $settings * * @return void */ diff --git a/stripe/controllers/FrmStrpLiteAppController.php b/stripe/controllers/FrmStrpLiteAppController.php index 909558dcde..4064b344f6 100644 --- a/stripe/controllers/FrmStrpLiteAppController.php +++ b/stripe/controllers/FrmStrpLiteAppController.php @@ -17,7 +17,7 @@ class FrmStrpLiteAppController { /** * Install required tables. * - * @param mixed|bool $old_db_version + * @param mixed $old_db_version * * @return void */ diff --git a/stripe/controllers/FrmTransLiteAppController.php b/stripe/controllers/FrmTransLiteAppController.php index 3329f1df85..371a331d1f 100755 --- a/stripe/controllers/FrmTransLiteAppController.php +++ b/stripe/controllers/FrmTransLiteAppController.php @@ -8,7 +8,7 @@ class FrmTransLiteAppController { /** * Install or upgrade database structures. * - * @param mixed|bool $old_db_version Previous database version, or false on fresh install. + * @param mixed $old_db_version Previous database version, or false on fresh install. * * @return void */ diff --git a/stripe/models/FrmStrpLiteSettings.php b/stripe/models/FrmStrpLiteSettings.php index 00ef50a7e5..48680c9809 100644 --- a/stripe/models/FrmStrpLiteSettings.php +++ b/stripe/models/FrmStrpLiteSettings.php @@ -33,7 +33,7 @@ public function default_options() { } /** - * @param mixed|bool $settings + * @param mixed $settings * * @return void */ diff --git a/stripe/models/FrmTransLiteDb.php b/stripe/models/FrmTransLiteDb.php index 7725e4df55..c44de15294 100755 --- a/stripe/models/FrmTransLiteDb.php +++ b/stripe/models/FrmTransLiteDb.php @@ -26,7 +26,7 @@ class FrmTransLiteDb { public $singular = ''; /** - * @param mixed|bool $old_db_version + * @param mixed $old_db_version * * @return void */ From bff7a598e83281422b8fa58738ea04ffab5bf73c Mon Sep 17 00:00:00 2001 From: Mike Letellier Date: Fri, 23 Jan 2026 11:54:24 -0400 Subject: [PATCH 6/7] Remove redundant type --- classes/models/FrmEntryMeta.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/classes/models/FrmEntryMeta.php b/classes/models/FrmEntryMeta.php index 5285365892..be544352fd 100644 --- a/classes/models/FrmEntryMeta.php +++ b/classes/models/FrmEntryMeta.php @@ -47,7 +47,7 @@ public static function add_entry_meta( $entry_id, $field_id, $meta_key, $meta_va * @param string $meta_key Deprecated. * @param array|string $meta_value * - * @return false|int + * @return bool|int */ public static function update_entry_meta( $entry_id, $field_id, $meta_key, $meta_value ) { if ( ! $field_id ) { From 3aa4342e575f4cd12211a055365ff2e4a58316f0 Mon Sep 17 00:00:00 2001 From: Mike Letellier Date: Fri, 23 Jan 2026 11:55:28 -0400 Subject: [PATCH 7/7] Run phpcbf --- classes/controllers/FrmFormsController.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/classes/controllers/FrmFormsController.php b/classes/controllers/FrmFormsController.php index 0ca6cb3f36..8fa889e1f2 100644 --- a/classes/controllers/FrmFormsController.php +++ b/classes/controllers/FrmFormsController.php @@ -220,8 +220,8 @@ public static function edit( $values = false ) { } /** - * @param mixed $id - * @param string $message + * @param mixed $id + * @param string $message * * @return void */