Skip to content

Remove some phpstan exceptions after updating to v2 and fix some small issues#2673

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

Remove some phpstan exceptions after updating to v2 and fix some small issues#2673
Crabcyborg merged 1 commit into
masterfrom
remove_some_phpstan_exceptions_after_updating_to_v2

Conversation

@Crabcyborg
Copy link
Copy Markdown
Contributor

No description provided.

@Crabcyborg Crabcyborg added this to the 6.27 milestone Dec 18, 2025
@Crabcyborg Crabcyborg changed the title Remove some phpstan exceptions after updating to v2 Remove some phpstan exceptions after updating to v2 and fix some small issues Dec 18, 2025
@coderabbitai
Copy link
Copy Markdown
Contributor

coderabbitai Bot commented Dec 18, 2025

Walkthrough

Type 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

Cohort / File(s) Summary
Type annotation updates
classes/helpers/FrmEntriesListHelper.php, classes/helpers/FrmFieldGridHelper.php, classes/views/styles/components/FrmStyleComponent.php
Updated PHPDoc type annotations: parameter in FrmEntriesListHelper from false to mixed; property in FrmFieldGridHelper from bool|string to bool; static property in FrmStyleComponent from stdClass|null to FrmStyleComponent|null.
Static analysis configuration
phpstan.neon
Removed global ignore rule for property type issues; introduced new global ignore for array-type return mismatches; localized "string to float" return ignore to classes/models/FrmEmailStats.php.

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~10 minutes

  • Changes are homogeneous type annotation updates and configuration adjustments with no runtime logic modifications
  • Verify that type annotations accurately reflect actual code usage
  • Confirm phpstan.neon configuration changes are intentional and correctly scoped

Possibly related PRs

Suggested reviewers

  • truongwp

Pre-merge checks and finishing touches

❌ Failed checks (1 inconclusive)
Check name Status Explanation Resolution
Description check ❓ Inconclusive No description was provided by the author, making it impossible to assess whether it relates to the changeset. Add a pull request description explaining the purpose of the changes and why these phpstan exceptions were removed or modified.
✅ Passed checks (2 passed)
Check name Status Explanation
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
Title check ✅ Passed The title clearly describes the main change: removing PHPStan exceptions after upgrading to version 2. It directly relates to the primary modifications across multiple files.
✨ 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 remove_some_phpstan_exceptions_after_updating_to_v2

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

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 null when 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

📥 Commits

Reviewing files that changed from the base of the PR and between cabca40 and ed2a051.

📒 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|null to FrmStyleComponent|null accurately reflects the singleton pattern implementation.

classes/helpers/FrmEntriesListHelper.php (1)

515-515: Type annotation accurately broadened to mixed.

The change from false to mixed correctly reflects that the by-reference parameter $val can be assigned various types within the method (e.g., line 556).

classes/helpers/FrmFieldGridHelper.php (1)

9-9: Type annotation correctly narrowed to bool.

The removal of string from the type is accurate—the property is only assigned boolean values (lines 67, 173, 260).

@Crabcyborg Crabcyborg merged commit 150d818 into master Dec 18, 2025
36 checks passed
@Crabcyborg Crabcyborg deleted the remove_some_phpstan_exceptions_after_updating_to_v2 branch December 18, 2025 14:31
stephywells pushed a commit that referenced this pull request Apr 4, 2026
…ns_after_updating_to_v2

Remove some phpstan exceptions after updating to v2 and fix some small issues
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