Skip to content

Ignore phpstan errors in fewer files#2709

Merged
Crabcyborg merged 2 commits into
masterfrom
ignore_phpstan_errors_in_fewer_files
Jan 5, 2026
Merged

Ignore phpstan errors in fewer files#2709
Crabcyborg merged 2 commits into
masterfrom
ignore_phpstan_errors_in_fewer_files

Conversation

@Crabcyborg
Copy link
Copy Markdown
Contributor

@Crabcyborg Crabcyborg commented Jan 5, 2026

Bumping the baseline so these rules are enforced in most files.

@coderabbitai
Copy link
Copy Markdown
Contributor

coderabbitai Bot commented Jan 5, 2026

Walkthrough

Reworks PHPStan ignoreErrors in phpstan.neon, replacing several global ignore patterns with file-scoped ignore blocks for specific messages (e.g., "but returns mixed", "mixed given", "cannot be converted to string.", "Cannot access an offset on mixed", "array_map expects", "array given") across many PHP files.

Changes

Cohort / File(s) Summary
PHPStan configuration
phpstan.neon
Converted multiple global ignoreErrors patterns into per-path blocks. Added file-scoped ignores for messages including "but returns mixed", "mixed given", "cannot be converted to string.", "Cannot access an offset on mixed", "function array_map expects", and "array given", targeting numerous controllers, helpers, models, view files, and Stripe/Square-related files.

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~10 minutes

Possibly related PRs

Pre-merge checks

✅ Passed checks (3 passed)
Check name Status Explanation
Title check ✅ Passed The title 'Ignore phpstan errors in fewer files' directly describes the main change: converting global PHPStan error ignores to per-file scopes, reducing the number of files with broad ignore rules.
Description check ✅ Passed The description 'Bumping the baseline so these rules are enforced in most files' clearly relates to the changeset, explaining the purpose of moving from global to file-specific PHPStan error configurations.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.

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 (2)
phpstan.neon (2)

255-278: Good improvement to enforce stricter type safety.

Converting global error suppressions to file-specific ones is a solid step toward improving type safety across the codebase. This ensures that new code in other files won't be allowed to return mixed types without proper type declarations.

Consider creating a plan to gradually fix the underlying type safety issues in these 21 files to fully eliminate this suppression.


335-335: Remove trailing whitespace.

There are extra spaces at the end of this line. While YAML tolerates trailing whitespace, it's cleaner to remove it.

🔎 Proposed fix
-				- classes/helpers/FrmAppHelper.php  
+				- classes/helpers/FrmAppHelper.php
📜 Review details

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 7f049ce and 1ec754e.

📒 Files selected for processing (1)
  • phpstan.neon
⏰ 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 (1)
phpstan.neon (1)

341-343: Pattern #array given# is too generic and could suppress multiple unrelated errors.

The pattern would match any PHPStan error containing "array given"—for example, "expects string but array given", "expects object but array given", etc. Given FrmFieldsHelper.php has numerous functions with specific array parameter type hints, this single pattern likely suppresses multiple distinct error types.

Make the pattern more specific by including the parameter type expectation, such as #expects string but array given#, or identify the exact error message(s) by running PHPStan on the file.

@Crabcyborg Crabcyborg merged commit a6d4ca7 into master Jan 5, 2026
15 of 16 checks passed
@Crabcyborg Crabcyborg deleted the ignore_phpstan_errors_in_fewer_files branch January 5, 2026 21:33
stephywells pushed a commit that referenced this pull request Apr 4, 2026
…er_files

Ignore phpstan errors in fewer files
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