Skip to content

Organize the rector config#2718

Merged
Crabcyborg merged 5 commits into
masterfrom
rector_tweaks
Jan 6, 2026
Merged

Organize the rector config#2718
Crabcyborg merged 5 commits into
masterfrom
rector_tweaks

Conversation

@Crabcyborg
Copy link
Copy Markdown
Contributor

@Crabcyborg Crabcyborg commented Jan 6, 2026

  • Split the config up by category.
  • Dropping typeDeclaration prepared set because we aren't using types this way yet.
  • Also dropping naming for now as I don't intend to change the name of anything at the moment.
  • Now applying the UseIdenticalOverEqualWithSameTypeRector rule.

@Crabcyborg Crabcyborg marked this pull request as ready for review January 6, 2026 16:51
@coderabbitai
Copy link
Copy Markdown
Contributor

coderabbitai Bot commented Jan 6, 2026

Warning

Rate limit exceeded

@Crabcyborg has exceeded the limit for the number of commits that can be reviewed per hour. Please wait 17 minutes and 4 seconds before requesting another review.

⌛ How to resolve this issue?

After the wait time has elapsed, a review can be triggered using the @coderabbitai review command as a PR comment. Alternatively, push new commits to this PR.

We recommend that you space out your commits to avoid hitting the rate limit.

🚦 How do rate limits work?

CodeRabbit enforces hourly rate limits for each developer per organization.

Our paid plans have higher rate limits than the trial, open-source and free plans. In all cases, we re-allow further reviews after a brief timeout.

Please see our FAQ for further information.

📥 Commits

Reviewing files that changed from the base of the PR and between c2e1afa and a6ee8a4.

📒 Files selected for processing (1)
  • rector.php

Walkthrough

Replaced multiple loose equality checks with strict comparisons across several PHP files and reorganized the project's Rector configuration, updating enabled/disabled rules, the withSkip list, and the prepared sets (notably toggling typeDeclarations).

Changes

Cohort / File(s) Summary
Strict equality replacements
classes/helpers/FrmAppHelper.php, classes/helpers/FrmFormsHelper.php, classes/models/FrmEntry.php, classes/models/FrmStyle.php, classes/views/frm-form-actions/_action_inside.php
Replaced == with === (and analogous strict checks) in conditional expressions: length/count/json error/parity checks. No function signatures or public APIs changed.
Rector configuration reorganization
rector.php
Rebalanced Rector rules: moved many rule imports between enabled/disabled groups, expanded/changed the withSkip exclusions, adjusted prepared sets (e.g., typeDeclarations from true→false) and reorganized rule groupings.

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~25 minutes

Possibly related PRs

Pre-merge checks and finishing touches

✅ Passed checks (3 passed)
Check name Status Explanation
Title check ✅ Passed The title accurately describes the main change: reorganizing the Rector configuration file by splitting it into categories and enabling a new rule.
Description check ✅ Passed The description is directly related to the changeset, explaining the configuration reorganization, removal of prepared sets, and enabling of the UseIdenticalOverEqualWithSameTypeRector rule.
Docstring Coverage ✅ Passed Docstring coverage is 100.00% which is sufficient. The required threshold is 80.00%.

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

Copy link
Copy Markdown
Contributor

@coderabbitai coderabbitai Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 0

🧹 Nitpick comments (1)
rector.php (1)

72-73: Unused import: RenameFunctionRector.

This import is not referenced in the withSkip array or elsewhere in the configuration. If not needed, remove it to keep imports clean.

🔎 Proposed fix
-// Renaming
-use Rector\Renaming\Rector\FuncCall\RenameFunctionRector;
-
📜 Review details

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between d1f4e41 and 19aac5a.

📒 Files selected for processing (6)
  • classes/helpers/FrmAppHelper.php
  • classes/helpers/FrmFormsHelper.php
  • classes/models/FrmEntry.php
  • classes/models/FrmStyle.php
  • classes/views/frm-form-actions/_action_inside.php
  • rector.php
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (1)
  • GitHub Check: Cypress
🔇 Additional comments (7)
classes/models/FrmEntry.php (1)

660-666: Strict comparison on count($where) is safe and consistent

count($where) === 1 is type‑correct here (count returns int and $where is confirmed array) and doesn’t change behavior from == 1, while aligning with the new strict‑equality rule. No further changes needed.

classes/helpers/FrmFormsHelper.php (1)

1868-1885: Consistent strict equality on unsafe param count

Using $count === 1 (with $count from count()) is type‑correct and brings this branch in line with the existing $count === 0 check, without changing behavior.

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

33-43: Single‑event check now uses strict comparison

count( $action_control->action_options['event'] ) === 1 is appropriate here (int on both sides) and doesn’t alter behavior, while matching the project’s move toward strict equality.

classes/models/FrmStyle.php (1)

820-836: Even/odd quote check tightened with strict equality

$is_balanced = $char_count % 2 === 0; keeps the same parity logic as before while using a strict numeric comparison. No issues spotted.

classes/helpers/FrmAppHelper.php (1)

3070-3085: Strict comparisons added in truncate, json_to_array, and maybe_json_decode look correct

  • truncate: $length is cast to int, so $length === 0 is an appropriate strict check and equivalent to the old == 0.
  • json_to_array: $p and $last are numeric indexes, so $p === $last is a safe refinement with no behavioral change.
  • maybe_json_decode: json_last_error() === JSON_ERROR_NONE is the idiomatic, type‑correct check for a successful decode.

All three updates align with the stricter‑equality Rector rule without altering runtime behavior.

Also applies to: 3460-3475, 3695-3707

rector.php (2)

95-128: Configuration organization is clear and well-documented.

The inline comments explaining each boolean parameter improve maintainability. Disabling typeDeclarations (line 103) aligns with the PR objective that the codebase isn't ready for that type approach yet.


149-229: Well-organized skip list with helpful rationale comments.

The category-based organization mirrors the import structure, making it easy to cross-reference. The inline comments explaining specific exclusions (e.g., JoinStringConcatRector changing \t to actual tabs, WP standard not encouraging Elvis operator) provide valuable context for future maintainers.

Copy link
Copy Markdown
Contributor

@coderabbitai coderabbitai Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 0

Caution

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

⚠️ Outside diff range comments (1)
rector.php (1)

1-213: PR description inconsistency: "Split into multiple files" vs. single organized file.

The PR description states: "Split the Rector configuration into multiple files grouped by category," but the changes show a single rector.php file with internal organization using section comments. The actual work accomplished is valuable—improving maintainability through categorization—but it's not a split into multiple files.

Please clarify:

  1. Was the intention to split into multiple files in a future PR?
  2. Should the PR description be updated to reflect "Organized the Rector configuration with category groupings"?
📜 Review details

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 19aac5a and 91e679f.

📒 Files selected for processing (1)
  • rector.php
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (3)
  • GitHub Check: Cypress
  • GitHub Check: PHP 8 tests in WP 6.9
  • GitHub Check: PHP 7.4 tests in WP 6.9
🔇 Additional comments (4)
rector.php (4)

93-93: LGTM: typeDeclarations set to false as described.

This change aligns with the PR description: "Removed the prepared typeDeclaration set because the codebase is not using that type approach yet."


139-213: Excellent organization of skip rules by category.

The categorization of skip rules matches the import organization and significantly improves maintainability. The inline explanatory comments (e.g., lines 152-153, 157-158, 190-191, 202-203) provide valuable context for why specific rules are skipped.


4-72: The import organization improves readability; no action needed.

The changes are a straightforward refactoring of the rector.php configuration with category comments grouping related imports. The structure is appropriate and maintainable. No missing rule configuration or inconsistency exists.


99-99: Clarify the intentional naming flag change in the PR description.

The commit message "Try naming too" documents this change, confirming it's intentional. However, since the PR description doesn't mention this flag modification, consider explicitly documenting why the naming Rector rule was disabled as part of the PR summary for future reviewers.

Copy link
Copy Markdown
Contributor

@coderabbitai coderabbitai Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 1

🤖 Fix all issues with AI Agents
In @rector.php:
- Line 11: The import ExplicitReturnNullRector is unused in this configuration;
either remove the unused use statement for ExplicitReturnNullRector or add
ExplicitReturnNullRector::class to the withSkip array so the rule is explicitly
skipped; locate the use
Rector\CodeQuality\Rector\ClassMethod\ExplicitReturnNullRector; statement and
either delete it or add ExplicitReturnNullRector::class into the existing
withSkip([...]) configuration entry.
📜 Review details

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 91e679f and c2e1afa.

📒 Files selected for processing (1)
  • rector.php
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (3)
  • GitHub Check: Cypress
  • GitHub Check: PHP 7.4 tests in WP 6.9
  • GitHub Check: PHP 8 tests in WP 6.9
🔇 Additional comments (2)
rector.php (2)

5-71: Clean organization with helpful category groupings.

The import statements are well-organized by category with clear section comments. This improves maintainability and makes it easier to locate and manage specific rules.


139-214: Well-documented skip list with explanatory comments.

The inline comments explaining why specific rules are skipped (e.g., WP standard compatibility, readability preferences) are valuable for maintainability.

Comment thread rector.php Outdated
@Crabcyborg Crabcyborg merged commit 71068d2 into master Jan 6, 2026
16 checks passed
@Crabcyborg Crabcyborg deleted the rector_tweaks branch January 6, 2026 17:07
@Crabcyborg Crabcyborg restored the rector_tweaks branch January 6, 2026 17:07
stephywells pushed a commit that referenced this pull request Apr 4, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant