Remove some phpstan exceptions after updating to v2 and fix some small issues#2673
Conversation
WalkthroughType annotations and documentation across helper and style component classes were refined to improve static analysis accuracy. PHPStan configuration was updated to localize and expand ignore rules, moving from global to file-scoped patterns. Changes
Estimated code review effort🎯 2 (Simple) | ⏱️ ~10 minutes
Possibly related PRs
Suggested reviewers
Pre-merge checks and finishing touches❌ Failed checks (1 inconclusive)
✅ Passed checks (2 passed)
✨ Finishing touches
🧪 Generate unit tests (beta)
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: 0
Caution
Some comments are outside the diff and can’t be posted inline due to platform limitations.
⚠️ Outside diff range comments (1)
classes/views/styles/components/FrmStyleComponent.php (1)
96-103: Fix inverted singleton logic.The method returns
nullwhen an instance already exists (line 98), but should return the existing instance. This breaks the singleton pattern.🔎 Apply this diff to fix the logic:
protected static function get_instance() { - if ( self::$instance ) { - return null; + if ( ! self::$instance ) { + self::$instance = new FrmStyleComponent(); } - - self::$instance = new FrmStyleComponent(); return self::$instance; }
🧹 Nitpick comments (1)
phpstan.neon (1)
266-269: Consider addressing the underlying type issues.While localizing the float-return ignore to
FrmEmailStats.php(lines 268-269) is an improvement over a global suppress, the broad array-type ignore added at line 266 affects many files. Consider whether these return type mismatches could be resolved with proper type annotations rather than suppression.Would you like me to generate a script to identify which specific methods trigger the array return type warning? This could help prioritize fixes.
📜 Review details
Configuration used: Organization UI
Review profile: CHILL
Plan: Pro
📒 Files selected for processing (4)
classes/helpers/FrmEntriesListHelper.php(1 hunks)classes/helpers/FrmFieldGridHelper.php(1 hunks)classes/views/styles/components/FrmStyleComponent.php(1 hunks)phpstan.neon(1 hunks)
⏰ 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 trunk
- GitHub Check: PHP 7.4 tests in WP trunk
- GitHub Check: Cypress
- GitHub Check: PHP 7.4 tests in WP trunk
- GitHub Check: PHP 8 tests in WP trunk
🔇 Additional comments (3)
classes/views/styles/components/FrmStyleComponent.php (1)
66-66: Type annotation correctly updated for singleton pattern.The change from
stdClass|nulltoFrmStyleComponent|nullaccurately reflects the singleton pattern implementation.classes/helpers/FrmEntriesListHelper.php (1)
515-515: Type annotation accurately broadened tomixed.The change from
falsetomixedcorrectly reflects that the by-reference parameter$valcan be assigned various types within the method (e.g., line 556).classes/helpers/FrmFieldGridHelper.php (1)
9-9: Type annotation correctly narrowed tobool.The removal of
stringfrom the type is accurate—the property is only assigned boolean values (lines 67, 173, 260).
…ns_after_updating_to_v2 Remove some phpstan exceptions after updating to v2 and fix some small issues
No description provided.