Add new sniff to enforce more consistent spacing within functions#2750
Conversation
WalkthroughAdds a new PHPCS sniff enforcing blank lines before returns after closing braces and applies whitespace-only edits across many files; also includes three small behavioral changes: CSV upload support for Pro, explicit fallback return in Square connect helper, and a custom_css short‑circuit in settings. Changes
Sequence Diagram(s)(Skipped — changes are formatting-focused and the new PHPCS sniff does not introduce a multi-component runtime control flow requiring a sequence diagram.) Estimated code review effort🎯 4 (Complex) | ⏱️ ~40 minutes Possibly related PRs
🚥 Pre-merge checks | ✅ 3✅ Passed checks (3 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing touches
📜 Recent review detailsConfiguration used: Organization UI Review profile: CHILL Plan: Pro 📒 Files selected for processing (1)
🚧 Files skipped from review as they are similar to previous changes (1)
⏰ 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)
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
@phpcs-sniffs/Formidable/Sniffs/WhiteSpace/BlankLineBeforeReturnAfterBraceSniff.php:
- Around line 1-31: Run the PHP CS Fixer to apply the project's coding standards
to this file: execute ./vendor/bin/php-cs-fixer fix and commit the resulting
changes for Formidable\Sniffs\WhiteSpace\BlankLineBeforeReturnAfterBraceSniff
(class BlankLineBeforeReturnAfterBraceSniff) so the file formatting matches CI
expectations; ensure the namespace, use statements, class docblock and
indentation are corrected by the fixer and no remaining fixable issues are
reported.
🧹 Nitpick comments (1)
phpcs-sniffs/Formidable/Sniffs/WhiteSpace/BlankLineBeforeReturnAfterBraceSniff.php (1)
142-157: Implementation is correct.The backward iteration with scope boundary checks correctly finds the innermost containing function or closure.
Consider using
$phpcsFile->getConditions($stackPtr)as an alternative, which returns the condition tokens (including functions) that contain the given position—this is a built-in utility that handles scope resolution. However, the current approach works correctly.
📜 Review details
Configuration used: Organization UI
Review profile: CHILL
Plan: Pro
⛔ Files ignored due to path filters (1)
phpcs.xmlis excluded by!**/*.xml
📒 Files selected for processing (66)
classes/controllers/FrmAddonsController.phpclasses/controllers/FrmAppController.phpclasses/controllers/FrmDashboardController.phpclasses/controllers/FrmFieldsController.phpclasses/controllers/FrmFormActionsController.phpclasses/controllers/FrmSettingsController.phpclasses/controllers/FrmSimpleBlocksController.phpclasses/controllers/FrmStylesController.phpclasses/controllers/FrmUsageController.phpclasses/controllers/FrmXMLController.phpclasses/helpers/FrmApiHelper.phpclasses/helpers/FrmAppHelper.phpclasses/helpers/FrmCSVExportHelper.phpclasses/helpers/FrmCurrencyHelper.phpclasses/helpers/FrmEmailHelper.phpclasses/helpers/FrmFieldGridHelper.phpclasses/helpers/FrmFieldsHelper.phpclasses/helpers/FrmFormMigratorsHelper.phpclasses/helpers/FrmFormsHelper.phpclasses/helpers/FrmShortcodeHelper.phpclasses/helpers/FrmStringReaderHelper.phpclasses/helpers/FrmStylesHelper.phpclasses/helpers/FrmSubmitHelper.phpclasses/helpers/FrmTipsHelper.phpclasses/helpers/FrmXMLHelper.phpclasses/models/FrmAntiSpam.phpclasses/models/FrmApplicationTemplate.phpclasses/models/FrmEntry.phpclasses/models/FrmEntryMeta.phpclasses/models/FrmEntryValidate.phpclasses/models/FrmFieldFormHtml.phpclasses/models/FrmForm.phpclasses/models/FrmFormAction.phpclasses/models/FrmFormState.phpclasses/models/FrmHoneypot.phpclasses/models/FrmInbox.phpclasses/models/FrmSalesApi.phpclasses/models/FrmSettings.phpclasses/models/FrmSolution.phpclasses/models/FrmSpamCheck.phpclasses/models/FrmSpamCheckDenylist.phpclasses/models/FrmSpamCheckWPDisallowedWords.phpclasses/models/FrmStyle.phpclasses/models/FrmTableHTMLGenerator.phpclasses/models/FrmUsage.phpclasses/models/fields/FrmFieldEmail.phpclasses/models/fields/FrmFieldName.phpclasses/models/fields/FrmFieldType.phpclasses/views/styles/components/FrmStyleComponent.phpphpcs-sniffs/Formidable/Sniffs/WhiteSpace/BlankLineBeforeReturnAfterBraceSniff.phpsquare/controllers/FrmSquareLiteActionsController.phpsquare/controllers/FrmSquareLiteEventsController.phpsquare/helpers/FrmSquareLiteConnectHelper.phpstripe/controllers/FrmStrpLiteActionsController.phpstripe/controllers/FrmStrpLiteEventsController.phpstripe/controllers/FrmTransLiteActionsController.phpstripe/helpers/FrmStrpLiteAppHelper.phpstripe/helpers/FrmStrpLiteConnectApiAdapter.phpstripe/helpers/FrmStrpLiteConnectHelper.phpstripe/helpers/FrmStrpLiteLinkRedirectHelper.phpstripe/helpers/FrmStrpLiteSubscriptionHelper.phpstripe/helpers/FrmTransLiteAppHelper.phpstripe/models/FrmStrpLiteAuth.phpstripe/models/FrmTransLiteLog.phptests/phpunit/base/frm_factory.phptests/phpunit/stripe/FrmStrpLiteUnitTest.php
🧰 Additional context used
🪛 GitHub Actions: Inspections
phpcs-sniffs/Formidable/Sniffs/WhiteSpace/BlankLineBeforeReturnAfterBraceSniff.php
[error] 1-1: PHP CS Fixer reported 1 file that can be fixed (BlankLineBeforeReturnAfterBraceSniff.php). Exit code 8 due to fixable issues. Run './vendor/bin/php-cs-fixer fix' to auto-fix.
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (6)
- GitHub Check: Cypress
- GitHub Check: PHP 8 tests in WP 6.9
- GitHub Check: PHP 7.4 tests in WP 6.9
- GitHub Check: PHP 7.4 tests in WP 6.9
- GitHub Check: Cypress
- GitHub Check: PHP 8 tests in WP 6.9
🔇 Additional comments (88)
square/controllers/FrmSquareLiteEventsController.php (1)
202-203: Formatting improvement aligns with sniff objectives.The added blank line before the
returnstatement follows the new sniff's pattern: enforcing consistent spacing after closing braces. This improves readability and maintains uniformity throughout the method.classes/models/FrmTableHTMLGenerator.php (1)
442-459: Formatting change appropriately applied per sniff rule.The blank line added before the return statement at line 458 is correctly applied. Since the
add_row_classmethod contains multiple conditional blocks with internal blank lines (lines 444, 449, 453), the sniff rule to enforce consistent spacing by adding a blank line before the final return is appropriate here.classes/models/FrmSpamCheck.php (1)
35-47: LGTM! Formatting change aligns with spacing sniff intent.The blank line added before the final
returnstatement improves consistency given the existing empty lines within the method. This change implements the PR's sniff objective of enforcing uniform spacing before return statements following closing braces when multiple empty lines exist within a function.classes/models/FrmAntiSpam.php (1)
202-225: Spacing change aligns with sniff intent.The added blank line at line 215 follows the new sniff's rule: when a function contains empty lines, enforce a blank line between a closing brace and a subsequent return statement. The change is purely cosmetic with no functional impact.
classes/models/FrmEntryValidate.php (1)
330-345: LGTM!The added blank line (line 343) properly separates the filter management block from the return statement, improving code readability without affecting functionality. The method's defensive coding—saving and re-applying the wpautop filter—is sound and correctly implemented.
classes/models/FrmFormState.php (1)
153-157: Formatting changes align well with the sniff's intent.Both modifications add consistent blank lines after
foreachblocks that precedereturnstatements, improving visual separation and readability. This is consistent with the PR objective to enforce uniform spacing within functions that already contain internal blank lines.Also applies to: 209-213
classes/models/FrmSolution.php (1)
743-751: Formatting change aligns with sniff objectives.The blank line added at line 749 between the closing brace of the conditional and the subsequent return statement improves spacing consistency, matching the PR's intent to enforce more uniform spacing within functions.
classes/models/fields/FrmFieldType.php (1)
1258-1262: LGTM!The blank line additions are consistently applied across three functions (
prepare_esc_value,value_has_already_been_validated_as_unique, andmaintain_option_values) to enforce the new sniff's rule: spacing between closing braces and return statements. No functional changes—purely formatting improvements that align with the PR's stated objective.Also applies to: 1650-1656, 1971-1977
classes/models/FrmSpamCheckDenylist.php (1)
293-293: Change aligns with coding standards enforcement.This blank line addition is part of the new sniff that enforces consistent spacing between closing braces and return statements in functions. The change is purely cosmetic and aligns with the existing blank-line pattern throughout the method.
square/controllers/FrmSquareLiteActionsController.php (1)
78-91: Whitespace changes align with sniff intent.The blank lines added before return statements (lines 89 and 575) appropriately enforce the new sniff's rule. Both functions already contain internal empty lines, making the additional spacing before returns consistent with the PR's objective of enforcing more uniform spacing within functions.
Also applies to: 569-577
stripe/helpers/FrmTransLiteAppHelper.php (5)
210-211: Formatting change aligns with sniff rule.Blank line correctly added between closing brace (line 209) and return statement (line 211), consistent with the new sniff enforcing spacing when internal empty lines exist.
226-227: Formatting change aligns with sniff rule.Blank line correctly added between closing brace (line 225) and return statement (line 227), consistent with the new sniff enforcing spacing when internal empty lines exist.
272-273: Formatting change aligns with sniff rule.Blank line correctly added between closing brace (line 271) and return statement (line 273), consistent with the new sniff enforcing spacing when internal empty lines exist.
400-401: Formatting change aligns with sniff rule.Blank line correctly added between closing brace (line 399) and return statement (line 401), consistent with the new sniff enforcing spacing when internal empty lines exist.
542-543: Formatting change aligns with sniff rule.Blank line correctly added between closing brace (line 541) and return statement (line 543), consistent with the new sniff enforcing spacing when internal empty lines exist.
classes/models/FrmFieldFormHtml.php (1)
310-324: LGTM!This formatting change correctly adds a blank line before the
returnstatement following the closing brace, consistent with the new sniff's requirement for uniform spacing within functions that already contain empty lines.classes/helpers/FrmStringReaderHelper.php (1)
52-60: Blank line formatting aligns with PR's spacing sniff.The added blank line at line 58 properly enforces consistent spacing between the while loop's closing brace and the subsequent return statement. This change is purely cosmetic, preserves the method's logic and return behavior, and aligns with the PR's stated objective.
classes/models/FrmFormAction.php (2)
210-218: Formatting change aligns with PR objective.The blank line insertion between the closing brace and return statement follows the spacing enforcement rule described in the PR objective. No functional changes.
601-615: Formatting change aligns with PR objective.The blank line insertion between the closing brace and return statement is consistent with the spacing enforcement rule from the new sniff. No functional changes.
classes/helpers/FrmTipsHelper.php (1)
98-98: Formatting changes look good.Both blank lines are added consistently between closing braces and subsequent return statements, aligning with the new sniff's intent to enforce uniform spacing when functions contain multiple empty lines. The changes improve visual hierarchy without affecting any logic or functionality.
Also applies to: 118-118
stripe/helpers/FrmStrpLiteSubscriptionHelper.php (1)
111-112: LGTM! Formatting improvement aligns with the new sniff.The added blank line improves consistency within the function by separating the conditional logic from the return statement, which aligns with the PR's objective of enforcing consistent spacing.
classes/models/FrmSpamCheckWPDisallowedWords.php (1)
46-56: Formatting change aligns with sniff intent. The blank line added before the return statement follows the sniff's requirement to enforce consistent spacing when functions contain other empty lines.classes/models/FrmApplicationTemplate.php (1)
283-291: Formatting change aligns with sniff intent. The blank line added before the return statement enforces consistent spacing within the function where other empty lines separate logical blocks.classes/models/FrmStyle.php (1)
263-277: Formatting changes align with sniff intent across all four methods. Each blank line added before a return statement (lines 275, 347, 840, 859) enforces consistent spacing in functions where other empty lines separate logical blocks. These are pure formatting adjustments with no behavioral impact.Also applies to: 331-349, 823-842, 853-861
classes/models/FrmSalesApi.php (1)
348-349: LGTM!The added blank line before the return statement follows the new sniff's rule for consistent spacing after closing braces.
classes/helpers/FrmEmailHelper.php (1)
57-58: LGTM!Formatting change adds consistent spacing before the final return statement, aligning with the new sniff rule.
classes/controllers/FrmSettingsController.php (1)
246-247: LGTM!The blank line before the return statement follows the new consistent spacing rule enforced by the sniff.
classes/helpers/FrmShortcodeHelper.php (1)
82-83: LGTM!Added blank line before return statement after the foreach loop, consistent with the new spacing rule.
classes/controllers/FrmFieldsController.php (1)
906-907: LGTM!Blank line added before the final return statement, consistent with the new formatting rule for spacing after closing braces.
classes/helpers/FrmStylesHelper.php (2)
255-256: LGTM!Formatting change adds consistent spacing before the return statement after the closing brace.
1160-1161: LGTM!Added blank line before the return statement, following the new consistent spacing rule.
tests/phpunit/stripe/FrmStrpLiteUnitTest.php (1)
218-219: LGTM!Formatting change in test file follows the same consistent spacing rule applied across the codebase.
classes/models/FrmUsage.php (1)
447-461: Blank line spacing enforced correctly.The added blank line before the return statement (line 459) follows the new sniff rule consistently. No functional impact.
classes/controllers/FrmStylesController.php (1)
873-894: Blank line spacing enforced correctly.The added blank line before the return statement (line 879) within the conditional block follows the new sniff rule consistently. No functional impact.
stripe/controllers/FrmStrpLiteActionsController.php (1)
73-86: Blank line spacing enforced correctly.The added blank line before the return statement (line 84) follows the new sniff rule consistently. No functional impact.
classes/helpers/FrmApiHelper.php (1)
39-44: Consistent spacing applied correctly.The blank line added before the return statement (line 42) is appropriate. The function already has multiple blank lines separating conditional blocks (lines 25, 30, 34, 38), so enforcing the same spacing before the final return aligns with the new sniff's intent.
stripe/controllers/FrmTransLiteActionsController.php (1)
460-465: Consistent spacing applied correctly.The blank line added before the return statement (line 463) is appropriate. The function already has blank lines at lines 458 and 460 separating the assignment statements, so enforcing the same spacing before the final return aligns with the sniff's intent.
classes/controllers/FrmSimpleBlocksController.php (1)
231-236: Consistent spacing applied correctly.The blank line added before the return statement (line 234) is appropriate. The function already has blank lines separating logical blocks (e.g., line 220 after parameter setup, lines around 224-227 for comments), so enforcing the same spacing before the final return aligns with the sniff's intent.
classes/controllers/FrmDashboardController.php (1)
524-536: LGTM!The added blank line before the final
returnstatement improves readability and aligns with the new sniff enforcing consistent spacing within functions.classes/controllers/FrmUsageController.php (1)
30-37: LGTM!The blank line before the
returnstatement following the closing brace improves visual separation and aligns with the new spacing sniff.classes/helpers/FrmCurrencyHelper.php (1)
17-30: LGTM!The added blank line before the
returnstatement improves readability after the conditional block and is consistent with the new spacing sniff.classes/models/FrmEntry.php (1)
232-246: LGTM!The blank line before the
returnstatement following theforeachloop enhances readability and aligns with the new spacing sniff.classes/helpers/FrmSubmitHelper.php (1)
205-217: LGTM!The blank line before the
returnstatement following theforeachloop improves visual separation and is consistent with the new spacing sniff.classes/models/fields/FrmFieldEmail.php (1)
48-60: LGTM!The blank line before the
returnstatement after the conditional block improves readability and aligns with the new spacing sniff.stripe/helpers/FrmStrpLiteLinkRedirectHelper.php (1)
125-138: LGTM!The blank line before the final
returnstatement following the conditional block improves visual separation and is consistent with the new spacing sniff.stripe/controllers/FrmStrpLiteEventsController.php (1)
428-438: LGTM! Formatting improvement enhances consistency.The added blank line before the return statement improves visual separation and aligns with the PR's spacing consistency objective.
classes/models/FrmEntryMeta.php (1)
467-491: LGTM! Spacing improvement enhances readability.The blank line before the return statement provides clear visual separation after the conditional logic block, consistent with the PR's formatting objective.
classes/models/FrmHoneypot.php (1)
331-340: LGTM! Consistent spacing applied.The added blank line before the return statement maintains consistent spacing throughout the method, aligning with the PR's formatting standards.
classes/helpers/FrmCSVExportHelper.php (1)
644-654: LGTM! Formatting enhances code structure.The blank line before the return statement clearly separates the loop logic from the fallback return, improving readability and consistency.
classes/helpers/FrmFormMigratorsHelper.php (1)
70-91: LGTM! Consistent formatting applied.The blank line before the return statement provides clear visual separation after the loop logic, maintaining consistency with the PR's spacing standards.
classes/controllers/FrmAddonsController.php (5)
410-412: ✓ Consistent spacing enforcement applied in fallback_plugin_list().The blank line added before the return statement aligns with the sniff's objective to enforce consistent spacing in functions with internal blank lines. The change maintains readability without affecting logic.
746-748: ✓ Spacing consistency applied in get_addon().Blank line before return appropriately placed after the foreach loop block, following the new sniff pattern.
762-764: ✓ Spacing consistency applied in get_license_type().Blank line logically placed between the conditional block and final return.
1119-1121: ✓ Spacing consistency applied in install_addon().Blank line before return statement after conditional block handling, consistent with sniff pattern.
1237-1242: ✓ Spacing consistency applied in handle_addon_action().Blank line inserted between error-handling block and return, improving visual separation as intended by the sniff.
stripe/models/FrmTransLiteLog.php (1)
22-23: ✓ Spacing consistency applied in log_message().Blank line appropriately placed before early return statement following the error_log() call and conditional logic. Improves readability without affecting behavior.
classes/controllers/FrmFormActionsController.php (1)
256-258: ✓ Spacing consistency applied in active_actions().Blank line inserted between the foreach loop and final return statement, consistent with the sniff's objective to improve function spacing readability.
tests/phpunit/base/frm_factory.php (1)
113-117: Formatting change aligns with the new sniff rule.The blank line added between the closing brace of the
foreachloop and thereturnstatement is consistent with the PR's objective to enforce spacing after closing braces before returns.stripe/helpers/FrmStrpLiteConnectApiAdapter.php (1)
24-39: Formatting change aligns with the new sniff rule.The blank line added between the closing brace of the
if-elseblock and thereturnstatement follows the consistent spacing convention being enforced by this PR.classes/models/fields/FrmFieldName.php (1)
94-102: Formatting change aligns with the new sniff rule.The blank line added between the closing brace of the
ifblock and thereturnstatement follows the consistent spacing convention being enforced by this PR.classes/models/FrmForm.php (1)
868-874: Formatting change aligns with the new sniff rule.The blank line added between the closing brace of the
ifblock and thereturnstatement follows the consistent spacing convention being enforced by this PR.stripe/helpers/FrmStrpLiteAppHelper.php (1)
69-77: Formatting change aligns with the new sniff rule.The blank line added between the closing brace of the
ifblock and thereturnstatement follows the consistent spacing convention being enforced by this PR.classes/controllers/FrmXMLController.php (1)
145-153: Formatting change aligns with the new sniff rule.The blank line added between the closing brace of the early-return
ifblock and the subsequentreturnstatement follows the consistent spacing convention being enforced by this PR.classes/helpers/FrmXMLHelper.php (3)
1243-1251: Formatting change aligns with the new sniff rule.The blank line added between the closing brace of the
ifblock and thereturnstatement follows the consistent spacing convention being enforced by this PR.
1825-1833: Formatting change aligns with the new sniff rule.The blank line added between the closing brace of the
ifblock and thereturnstatement follows the consistent spacing convention being enforced by this PR.
2438-2447: CSV upload support added for Pro versions.This functional change conditionally enables CSV file uploads when Pro is installed. The implementation is clean and follows the existing pattern for feature gating.
stripe/helpers/FrmStrpLiteConnectHelper.php (1)
42-43: LGTM! Formatting changes align with PR objectives.The blank lines added before return statements enforce consistent spacing within functions as described in the PR. No functional changes detected.
Also applies to: 179-180, 486-487, 572-573, 590-591, 712-713, 752-753, 767-768, 880-881, 914-915
classes/helpers/FrmFieldsHelper.php (1)
505-506: LGTM! Consistent formatting improvements.The added blank lines before return statements maintain consistent spacing within these helper methods, aligning with the new sniff described in the PR.
Also applies to: 1134-1135, 1867-1868
classes/models/FrmInbox.php (1)
67-68: LGTM! Formatting improvements for consistency.The blank lines added before return statements in
get_messages()andunread()enhance readability and enforce consistent spacing per the new sniff.Also applies to: 364-365
stripe/models/FrmStrpLiteAuth.php (1)
662-663: LGTM! Formatting enhancements for readability.The blank lines added before return statements in
statement_descriptor_is_valid()andget_message_url()improve visual consistency per the new spacing sniff.Also applies to: 791-792
classes/helpers/FrmFieldGridHelper.php (1)
165-166: LGTM! Consistent spacing improvements.The blank lines added before return statements in
should_first_close_the_active_field_wrapper()andsync_list_size()enforce consistent spacing within these methods.Also applies to: 230-231
classes/controllers/FrmAppController.php (1)
145-146: LGTM! Formatting changes align with PR objective.The added blank lines before return statements improve visual consistency within these functions, which is exactly what the new sniff is designed to enforce.
Also applies to: 1463-1464
square/helpers/FrmSquareLiteConnectHelper.php (1)
204-205: LGTM! Consistent spacing improvements throughout.The added blank lines before return statements enhance readability and maintain consistency with the function spacing pattern. All changes are purely formatting with no functional impact.
Also applies to: 285-286, 319-320, 552-553, 649-650, 817-818
classes/helpers/FrmFormsHelper.php (1)
1007-1008: LGTM! Spacing improvements enhance readability.The added blank lines before return statements maintain consistent spacing patterns within functions. These formatting changes align perfectly with the PR's objective.
Also applies to: 1308-1309, 2082-2083
classes/models/FrmSettings.php (1)
428-429: LGTM! Spacing improves code clarity.The blank line added between the conditional early return and the sanitization return statement improves visual separation and makes the code flow clearer.
classes/views/styles/components/FrmStyleComponent.php (1)
152-153: LGTM! Formatting enhances consistency.The added blank lines before return statements align with the PR's spacing consistency objective and improve readability.
Also applies to: 180-181
classes/helpers/FrmAppHelper.php (10)
424-433: Whitespace-only formatting change.Blank line added before return statement in
is_form_builder_page()to enforce consistent spacing. No functional changes.
891-912: Whitespace-only formatting change.Blank line added before return statement in
sanitize_value()within the array handling section. No functional changes.
1081-1110: Whitespace-only formatting change.Blank line added before return statement in
kses_submit_button(). No functional changes.
1480-1492: Whitespace-only formatting change.Blank line added before return statement in
is_a_valid_color(). No functional changes.
2762-2776: Whitespace-only formatting change.Blank line added before return statement in
maybe_truncate_key_before_appending(). No functional changes.
2813-2833: Whitespace-only formatting change.Blank line added before return statement in
prevent_numeric_and_reserved_keys(). No functional changes.
3355-3369: Whitespace-only formatting change.Blank line added before return statement in
get_unit(). No functional changes.
3725-3747: Whitespace-only formatting change.Blank line added before return statement in
maybe_utf8_encode(). No functional changes.
4233-4243: Whitespace-only formatting change.Blank line added before return statement in
get_menu_icon_class(). No functional changes.
5016-5028: Whitespace-only formatting change.Blank line added before return statement in
is_valid_utf8(). No functional changes.phpcs-sniffs/Formidable/Sniffs/WhiteSpace/BlankLineBeforeReturnAfterBraceSniff.php (2)
50-132: LGTM!The
process()method logic is well-structured:
- Correctly identifies the containing function and checks for existing blank lines before enforcing the rule.
- Properly validates that the return is the first non-whitespace token on its line.
- The fix using
addNewlineBefore()is the correct approach.
167-197: LGTM!The blank line detection logic is efficient and correct. Building a map of lines with content and then checking for gaps is a clean approach.
…e_consistent_spacing_within_functions Add new sniff to enforce more consistent spacing within functions
This new sniff makes sure, that if the function has other empty new lines, that there is another empty new line added between
}andreturn, so the function is more likely to have consistent spacing, and not empty lines between statements everywhere but at the end.