Move some phpstan exceptions to problematic files only#2236
Conversation
WalkthroughThe pull request modifies the Changes
Possibly related PRs
Thank you for using CodeRabbit. We offer it for free to the OSS community and would appreciate your support in helping us grow. If you find it useful, would you consider giving us a shout-out on your favorite social media? 🪧 TipsChatThere are 3 ways to chat with CodeRabbit:
Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments. CodeRabbit Commands (Invoked using PR comments)
Other keywords and placeholders
CodeRabbit Configuration File (
|
There was a problem hiding this comment.
Actionable comments posted: 0
🧹 Nitpick comments (2)
phpstan.neon (2)
133-136: Consider documenting required variables for views.While the configuration is appropriately scoped to view files, consider adding PHPDoc blocks in the view files to document the expected variables. This would make the code more maintainable and help prevent errors.
Example documentation format:
/** * Required variables for this view: * @var string $title * @var array $options * @var int $form_id */
117-136: Overall improvement in PHPStan configuration.The changes successfully move from global error suppression to file-specific configurations, which is a positive step toward better code quality. However, consider:
- Removing the
css/*path from undefined variables configuration- Planning to address the technical debt in controller files
- Adding variable documentation in view files
This more granular approach will help identify and fix issues in files that don't actually need these exceptions.
📜 Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro
📒 Files selected for processing (1)
phpstan.neon(1 hunks)
⏰ Context from checks skipped due to timeout of 90000ms (9)
- GitHub Check: Run PHP Syntax inspection (8.3)
- GitHub Check: PHP 8 tests in WP trunk
- GitHub Check: PHP 7.4 tests in WP trunk
- GitHub Check: PHP 8 tests in WP trunk
- GitHub Check: Cypress
- GitHub Check: Cypress
- GitHub Check: PHP 8 tests in WP trunk
- GitHub Check: PHP 7.4 tests in WP trunk
- GitHub Check: Cypress
🔇 Additional comments (2)
phpstan.neon (2)
127-132: Well-scoped configuration for protected method access.Good job on narrowing down the protected method access exceptions to specific view files instead of applying them globally. This improves code safety while maintaining necessary functionality.
117-126: Review inclusion of CSS directory and consider refactoring controllers.A few concerns about the paths configuration:
- The
css/*path inclusion seems unnecessary as CSS files shouldn't contain PHP code.- Including controller files suggests potential technical debt that should be addressed rather than suppressed.
Let's verify if there are any PHP files in the CSS directory and check the variable usage in the specified controllers:
This helps to improve our coverage in other files that do not have these issues.