Skip to content

Put back phpstan strict rules and use an updated version#2675

Merged
Crabcyborg merged 1 commit into
masterfrom
put_back_phpstan_strict_rules_updated_version
Dec 18, 2025
Merged

Put back phpstan strict rules and use an updated version#2675
Crabcyborg merged 1 commit into
masterfrom
put_back_phpstan_strict_rules_updated_version

Conversation

@Crabcyborg
Copy link
Copy Markdown
Contributor

I removed these to get PHPStan up to date.

I think I just needed to update this as well though.

@coderabbitai
Copy link
Copy Markdown
Contributor

coderabbitai Bot commented Dec 18, 2025

Walkthrough

The PR updates static method calling patterns in two controllers (FrmAppController, FrmFormsController) by replacing instance-based calls to FrmInbox::check_for_error() with static calls. Additionally, PHPStan configuration is expanded with multiple new ignore rules and file-specific error suppressions, while one existing rule is removed.

Changes

Cohort / File(s) Summary
Controller static method refactoring
classes/controllers/FrmAppController.php, classes/controllers/FrmFormsController.php
Replaced instance method calls to FrmInbox::check_for_error() with static method calls (e.g., new FrmInbox()->check_for_error()FrmInbox::check_for_error()). No control flow changes.
FrmInbox formatting
classes/models/FrmInbox.php
Added blank line before return statement in check_for_error() method. Formatting only, no behavioral change.
PHPStan configuration updates
phpstan.neon
Removed one ignore rule (#expects false, string given#). Added 12+ new ignore rules for type strictness, comparison semantics, and variable operations. Added contravariance rules for specific files (FrmFormsListHelper.php, FrmInstallerSkin.php). Associated numeric-type and foreach override rules with specific file paths.

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~12 minutes

  • Verify that the FrmInbox::check_for_error() method is properly declared as static and that all call sites have been consistently updated
  • Review phpstan.neon additions to ensure each ignore rule is intentional and that the removed rule no longer applies
  • Confirm file-specific path associations in PHPStan rules are correct and represent actual code patterns in those files

Possibly related PRs

Pre-merge checks and finishing touches

✅ Passed checks (3 passed)
Check name Status Explanation
Title check ✅ Passed The title 'Put back phpstan strict rules and use an updated version' clearly and specifically describes the main changes in the pull request: reintroducing PHPStan strict rules and updating to a newer PHPStan version.
Description check ✅ Passed The description relates to the changeset by explaining the rationale: the author previously removed strict rules to update PHPStan and is now putting them back with necessary configuration updates.
Docstring Coverage ✅ Passed Docstring coverage is 100.00% which is sufficient. The required threshold is 80.00%.
✨ Finishing touches
  • 📝 Generate docstrings
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment
  • Commit unit tests in branch put_back_phpstan_strict_rules_updated_version

📜 Recent review details

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 1c4c780 and 980e231.

⛔ Files ignored due to path filters (1)
  • composer.json is excluded by !**/*.json
📒 Files selected for processing (4)
  • classes/controllers/FrmAppController.php (1 hunks)
  • classes/controllers/FrmFormsController.php (1 hunks)
  • classes/models/FrmInbox.php (1 hunks)
  • phpstan.neon (1 hunks)
🧰 Additional context used
🧬 Code graph analysis (2)
classes/controllers/FrmFormsController.php (1)
classes/models/FrmInbox.php (2)
  • FrmInbox (9-603)
  • check_for_error (591-602)
classes/controllers/FrmAppController.php (1)
classes/models/FrmInbox.php (2)
  • FrmInbox (9-603)
  • check_for_error (591-602)
⏰ 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: PHP 8 tests in WP trunk
  • GitHub Check: Cypress
  • GitHub Check: PHP 7.4 tests in WP trunk
  • GitHub Check: PHP 7.4 tests in WP trunk
  • GitHub Check: PHP 8 tests in WP trunk
  • GitHub Check: Cypress
🔇 Additional comments (4)
phpstan.neon (1)

278-303: LGTM - Pragmatic approach for strict rules enablement.

Adding numerous ignore rules is a standard practice when initially enabling stricter PHPStan rules. This establishes a baseline to prevent new violations while existing issues can be addressed incrementally. The suppressions cover common strict-mode violations (loose comparisons, non-boolean conditions, variable property/method access, etc.) and include file-specific exceptions where needed.

classes/models/FrmInbox.php (1)

600-600: LGTM - Minor formatting improvement.

The blank line improves readability by visually separating the loop from the return statement.

classes/controllers/FrmAppController.php (1)

1633-1633: LGTM - Correct static method call.

The change from instance-based to static method call is correct and improves code clarity. Since FrmInbox::check_for_error() is declared as a static method, calling it directly on the class is the proper approach. This change likely addresses PHPStan strict rule violations regarding variable static method calls.

classes/controllers/FrmFormsController.php (1)

1215-1215: LGTM - Correct static method call.

Consistent with the change in FrmAppController.php, this correctly calls the static method FrmInbox::check_for_error() directly on the class rather than through an instance. This aligns with best practices and PHPStan strict rules.


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.

@Crabcyborg Crabcyborg merged commit 02d8f76 into master Dec 18, 2025
36 checks passed
@Crabcyborg Crabcyborg deleted the put_back_phpstan_strict_rules_updated_version branch December 18, 2025 18:31
stephywells pushed a commit that referenced this pull request Apr 4, 2026
…s_updated_version

Put back phpstan strict rules and use an updated version
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