New sniff to make replace var name in return with a readable text ver…#2809
Conversation
📝 WalkthroughWalkthroughStandardizes PHPDoc Changes
Estimated code review effort🎯 3 (Moderate) | ⏱️ ~20 minutes Possibly related PRs
Poem
🚥 Pre-merge checks | ✅ 3✅ Passed checks (3 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing touches
🧹 Recent nitpick comments
📜 Recent review detailsConfiguration used: Path: .coderabbit.yaml Review profile: CHILL Plan: Pro 📒 Files selected for processing (3)
🚧 Files skipped from review as they are similar to previous changes (1)
🧰 Additional context used📓 Path-based instructions (1)**/*.php⚙️ CodeRabbit configuration file
Files:
⏰ 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)
🔇 Additional comments (4)
✏️ Tip: You can disable this entire section by setting 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: 1
🤖 Fix all issues with AI agents
In `@classes/controllers/FrmXMLController.php`:
- Line 763: Update the docblock in FrmXMLController where the return description
currently reads "Csv fields." to use the correct uppercase abbreviation "CSV
fields."; locate the docblock associated with the relevant method in the
FrmXMLController class (the return tag on the method around the comment) and
replace "Csv" with "CSV" so the abbreviation conforms to the project's
sniff/uppercase rules.
🧹 Nitpick comments (1)
phpcs-sniffs/Formidable/Sniffs/Commenting/ConvertReturnVariableToDescriptionSniff.php (1)
102-139: Consider handling camelCase variable names.The current implementation only splits on underscores, which means camelCase variables like
$entryIdwould produceEntryid.instead of the more readableEntry ID.. If the codebase consistently uses snake_case, this is fine. Otherwise, consider adding camelCase splitting.Optional enhancement for camelCase support
private function variableToDescription( $variableName ) { // Remove the $ prefix and any leading underscores. $name = ltrim( $variableName, '$_' ); + // Convert camelCase to snake_case first. + $name = preg_replace( '/([a-z])([A-Z])/', '$1_$2', $name ); + // Split by underscores. $parts = explode( '_', $name );
📜 Review details
Configuration used: Path: .coderabbit.yaml
Review profile: CHILL
Plan: Pro
📒 Files selected for processing (17)
classes/controllers/FrmXMLController.phpclasses/helpers/FrmAppHelper.phpclasses/helpers/FrmEntriesHelper.phpclasses/helpers/FrmEntriesListHelper.phpclasses/helpers/FrmFieldsHelper.phpclasses/models/FrmAddon.phpclasses/models/FrmEmail.phpclasses/models/FrmEntry.phpclasses/models/FrmFieldFormHtml.phpclasses/models/FrmFormAction.phpclasses/models/FrmValidate.phpclasses/models/fields/FrmFieldCaptcha.phpclasses/models/fields/FrmFieldType.phpphpcs-sniffs/Formidable/Sniffs/Commenting/ConvertReturnVariableToDescriptionSniff.phpphpcs-sniffs/Formidable/ruleset.xmlstripe/helpers/FrmStrpLiteSubscriptionHelper.phptests/phpunit/stripe/FrmStrpLiteUnitTest.php
🧰 Additional context used
📓 Path-based instructions (1)
**/*.php
⚙️ CodeRabbit configuration file
**/*.php: - Do not make suggestions when we use x.x for a version placeholder. This is used like "@SInCE x.x" in a PHP doc comment, but also like 'x.x' when functions like _deprecated_function() are used.
- Treat these placeholders as acceptable in this codebase.
Files:
classes/models/FrmValidate.phpclasses/models/fields/FrmFieldCaptcha.phptests/phpunit/stripe/FrmStrpLiteUnitTest.phpclasses/models/FrmEmail.phpclasses/helpers/FrmEntriesListHelper.phpclasses/helpers/FrmFieldsHelper.phpclasses/models/FrmAddon.phpclasses/models/FrmEntry.phpclasses/helpers/FrmAppHelper.phpclasses/controllers/FrmXMLController.phpclasses/models/fields/FrmFieldType.phpclasses/models/FrmFieldFormHtml.phpclasses/helpers/FrmEntriesHelper.phpphpcs-sniffs/Formidable/Sniffs/Commenting/ConvertReturnVariableToDescriptionSniff.phpstripe/helpers/FrmStrpLiteSubscriptionHelper.phpclasses/models/FrmFormAction.php
🔇 Additional comments (21)
classes/models/fields/FrmFieldType.php (1)
1840-1840: LGTM! Documentation improvement.The PHPDoc return annotation has been updated to use a more readable description ("New value.") instead of a variable-like token ("$new_value"). This is a documentation-only change with no impact on functionality.
classes/models/FrmFieldFormHtml.php (1)
524-524: LGTM! Documentation improvement.The PHPDoc return annotation has been updated to use a more readable description ("Classes.") instead of a variable-like token ("$classes"). This is a documentation-only change with no impact on functionality.
classes/models/FrmFormAction.php (1)
367-367: LGTM! Documentation improvement.The PHPDoc return annotation has been updated to use a more readable description ("Post ID.") instead of a variable-like token ("$post_id"). This is a documentation-only change with no impact on functionality.
classes/helpers/FrmEntriesListHelper.php (1)
295-295: LGTM! Documentation improvement.The PHPDoc return annotation has been updated to use a more readable description ("Primary column.") instead of a variable-like token ("$primary_column"). This is a documentation-only change with no impact on functionality.
classes/models/FrmEmail.php (1)
661-661: LGTM! Documentation improvement.The PHPDoc return annotation has been updated to use a more readable description ("Emails.") instead of a variable-like token ("$emails"). This is a documentation-only change with no impact on functionality.
tests/phpunit/stripe/FrmStrpLiteUnitTest.php (1)
195-197: LGTM!The return annotation update from
$customer_idtoCustomer ID.follows the new documentation convention being introduced by this PR's sniff.classes/models/FrmAddon.php (1)
173-183: LGTM!The return annotation update from
$_datatoData.correctly applies the new documentation convention, properly handling the leading underscore in the original variable name.classes/helpers/FrmAppHelper.php (3)
273-275: LGTM!The return annotation update to
Frm settings.follows the new documentation convention.
870-872: LGTM!The return annotation update to
Value.follows the new documentation convention.
3219-3221: LGTM!The return annotation update to
Time ago.provides a clear, readable description of the return value.stripe/helpers/FrmStrpLiteSubscriptionHelper.php (1)
38-41: LGTM!The return annotation update from
$sub_idtoSub ID.correctly applies the new documentation convention, properly uppercasing the "ID" abbreviation.classes/helpers/FrmEntriesHelper.php (2)
119-123: LGTM!The return annotation update to
New value.follows the new documentation convention.
143-147: LGTM!The return annotation update to
Value is posted.provides a clear, readable description following the new documentation convention.classes/models/FrmValidate.php (1)
32-34: LGTM!The PHPDoc return annotation correctly follows the new convention of using a descriptive text instead of variable name.
classes/models/fields/FrmFieldCaptcha.php (1)
431-433: LGTM!The PHPDoc return annotation correctly follows the new convention.
classes/models/FrmEntry.php (1)
20-20: LGTM!All PHPDoc return annotations have been correctly updated to use descriptive text. The abbreviations like
idare properly converted to uppercaseID, consistent with the new sniff's logic.Also applies to: 32-32, 321-321, 336-336, 777-777, 797-797, 845-845, 999-999, 1135-1135, 1162-1162, 1235-1235, 1250-1250
phpcs-sniffs/Formidable/Sniffs/Commenting/ConvertReturnVariableToDescriptionSniff.php (2)
28-37: LGTM!The sniff class structure and registration are correctly implemented following PHP_CodeSniffer conventions.
47-87: LGTM!The process method correctly:
- Filters for
@returntags only- Uses a well-crafted regex to match
type $variablepatterns- Supports union types (
bool|int) and namespaced types- Provides fixable errors with clear messaging
phpcs-sniffs/Formidable/ruleset.xml (1)
39-42: LGTM!The new sniff rule is correctly added under the Commenting section, following the established naming convention and structure.
classes/helpers/FrmFieldsHelper.php (2)
1615-1619: LGTM!PHPDoc return annotation correctly updated from variable name format to descriptive text format, aligning with the new sniff's standardization effort.
1753-1757: LGTM!PHPDoc return annotation correctly updated to use descriptive text instead of variable name format.
✏️ Tip: You can disable this entire section by setting review_details to false in your review settings.
…sion
Summary by CodeRabbit
Documentation
Chores
✏️ Tip: You can customize this high-level summary in your review settings.