Skip to content

Updated PHPStan config to ignore array types for hooks '@return' params.#2453

Merged
AlexSkrypnyk merged 1 commit intomainfrom
feature/update-phpstan-config-return
Apr 8, 2026
Merged

Updated PHPStan config to ignore array types for hooks '@return' params.#2453
AlexSkrypnyk merged 1 commit intomainfrom
feature/update-phpstan-config-return

Conversation

@AlexSkrypnyk
Copy link
Copy Markdown
Member

@AlexSkrypnyk AlexSkrypnyk commented Apr 7, 2026

Summary

Updated the PHPStan ignoreErrors configuration in phpstan.neon and all installer test fixture variants to broaden the hook implementations rule. The previous pattern #.* with no value type specified in iterable type array# was too narrow and missed cases where the error message uses @return annotation wording; it has been replaced with a unified #.*no value type specified in iterable type array# pattern (without the leading with) that covers both parameter and return-value contexts. The entries were also reordered so the broader hook and settings ignores appear before the test-specific one, and reportUnmatched: false was removed from the hooks rule since matches are now guaranteed.

Changes

  • phpstan.neon — Replaced the two separate ignoreErrors entries for hook implementations and settings includes with consolidated, reordered entries; updated the hook rule pattern to match both parameter and return-value array-type errors.
  • Installer test fixtures (_baseline, hosting_acquia, hosting_project_name___acquia, theme_claro, theme_olivero, theme_stark, tools_groups_no_fe_lint_no_theme, tools_groups_no_fe_lint_no_theme_circleci, tools_no_eslint_no_theme, tools_no_stylelint_no_theme) — Applied the same pattern and ordering changes; Acquia-hosted fixtures also updated paths from web/ to docroot/.
  • tools_groups_no_be_tests, tools_groups_no_be_tests_circleci, tools_no_phpunit, tools_no_phpunit_circleci — Updated diff line references to match the new line numbers after the reordering.
  • tools_groups_no_fe_lint_no_theme — Removed a stale empty test file web/modules/custom/sw_demo/js/-sw_demo.test.js.

Summary by CodeRabbit

  • Chores
    • Refined static analysis suppression rules to be more precise and adjusted reporting behavior for unmatched rules.
    • Improves diagnostics accuracy and visibility of real issues, supporting better code quality management without altering functionality.

@coderabbitai
Copy link
Copy Markdown

coderabbitai bot commented Apr 7, 2026

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Repository UI

Review profile: ASSERTIVE

Plan: Pro

Run ID: 31bebd60-8e3a-4372-ad30-1aebe6eec1c6

📥 Commits

Reviewing files that changed from the base of the PR and between 2d901dc and b58b3d1.

⛔ Files ignored due to path filters (15)
  • .vortex/installer/tests/Fixtures/handler_process/_baseline/phpstan.neon is excluded by !.vortex/installer/tests/Fixtures/**
  • .vortex/installer/tests/Fixtures/handler_process/hosting_acquia/phpstan.neon is excluded by !.vortex/installer/tests/Fixtures/**
  • .vortex/installer/tests/Fixtures/handler_process/hosting_project_name___acquia/phpstan.neon is excluded by !.vortex/installer/tests/Fixtures/**
  • .vortex/installer/tests/Fixtures/handler_process/theme_claro/phpstan.neon is excluded by !.vortex/installer/tests/Fixtures/**
  • .vortex/installer/tests/Fixtures/handler_process/theme_olivero/phpstan.neon is excluded by !.vortex/installer/tests/Fixtures/**
  • .vortex/installer/tests/Fixtures/handler_process/theme_stark/phpstan.neon is excluded by !.vortex/installer/tests/Fixtures/**
  • .vortex/installer/tests/Fixtures/handler_process/tools_groups_no_be_tests/phpstan.neon is excluded by !.vortex/installer/tests/Fixtures/**
  • .vortex/installer/tests/Fixtures/handler_process/tools_groups_no_be_tests_circleci/phpstan.neon is excluded by !.vortex/installer/tests/Fixtures/**
  • .vortex/installer/tests/Fixtures/handler_process/tools_groups_no_fe_lint_no_theme/phpstan.neon is excluded by !.vortex/installer/tests/Fixtures/**
  • .vortex/installer/tests/Fixtures/handler_process/tools_groups_no_fe_lint_no_theme/web/modules/custom/sw_demo/js/-sw_demo.test.js is excluded by !.vortex/installer/tests/Fixtures/**
  • .vortex/installer/tests/Fixtures/handler_process/tools_groups_no_fe_lint_no_theme_circleci/phpstan.neon is excluded by !.vortex/installer/tests/Fixtures/**
  • .vortex/installer/tests/Fixtures/handler_process/tools_no_eslint_no_theme/phpstan.neon is excluded by !.vortex/installer/tests/Fixtures/**
  • .vortex/installer/tests/Fixtures/handler_process/tools_no_phpunit/phpstan.neon is excluded by !.vortex/installer/tests/Fixtures/**
  • .vortex/installer/tests/Fixtures/handler_process/tools_no_phpunit_circleci/phpstan.neon is excluded by !.vortex/installer/tests/Fixtures/**
  • .vortex/installer/tests/Fixtures/handler_process/tools_no_stylelint_no_theme/phpstan.neon is excluded by !.vortex/installer/tests/Fixtures/**
📒 Files selected for processing (1)
  • phpstan.neon

Walkthrough

Refines PHPStan ignoreErrors entries in phpstan.neon: replaces two prior ignore rules with more specific patterns scoped to web/modules/custom/* and web/themes/custom/*, and re-adds a variable-not-defined ignore for web/sites/default/includes with reportUnmatched: false. No code changes.

Changes

Cohort / File(s) Summary
PHPStan Configuration
phpstan.neon
Replaced broader iterable-type ignore patterns with more specific #.*no value type specified in iterable type array# rules scoped to web/modules/custom/* and web/themes/custom/*. Re-added the Variable might not be defined ignore for web/sites/default/includes with reportUnmatched: false.

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~10 minutes

Possibly related PRs

Suggested labels

AUTOMERGE

Poem

🐇 I hopped through configs, neat and spry,
Tweaked the rules so warnings fly,
Scoped the paths where errors hide,
Cleaned the traces, short and spry,
A tiny rabbit's tidy try ✨

🚥 Pre-merge checks | ✅ 2 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Title check ⚠️ Warning The title mentions updating PHPStan config for hook '@return' params, but the raw summary shows changes to ignore errors for array type specifications across modules/themes, not specifically for hook return parameters. Revise the title to accurately reflect the main changes, such as 'Updated PHPStan ignore patterns for array type errors' or 'Refined PHPStan configuration ignore patterns for iterable types'.
✅ Passed checks (2 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch feature/update-phpstan-config-return

Comment @coderabbitai help to get the list of available commands and usage tips.

@github-actions

This comment has been minimized.

@AlexSkrypnyk AlexSkrypnyk force-pushed the feature/update-phpstan-config-return branch from 2d901dc to b58b3d1 Compare April 8, 2026 00:39
@AlexSkrypnyk AlexSkrypnyk added this to the 1.38.0 milestone Apr 8, 2026
@AlexSkrypnyk AlexSkrypnyk moved this from BACKLOG to In progress in Vortex Apr 8, 2026
@github-actions
Copy link
Copy Markdown

github-actions bot commented Apr 8, 2026

Code coverage (threshold: 90%)

  Classes: 100.00% (1/1)
  Methods: 100.00% (2/2)
  Lines:   98.53% (201/204)
Per-class coverage
Drupal\ys_demo\Plugin\Block\CounterBlock
  Methods: 100.00% ( 2/ 2)   Lines: 100.00% ( 10/ 10)

@AlexSkrypnyk

This comment has been minimized.

2 similar comments
@AlexSkrypnyk

This comment has been minimized.

@AlexSkrypnyk
Copy link
Copy Markdown
Member Author

Code coverage (threshold: 90%)

  Classes: 100.00% (1/1)
  Methods: 100.00% (2/2)
  Lines:   98.53% (201/204)
Per-class coverage
Drupal\ys_demo\Plugin\Block\CounterBlock
  Methods: 100.00% ( 2/ 2)   Lines: 100.00% ( 10/ 10)

@codecov
Copy link
Copy Markdown

codecov bot commented Apr 8, 2026

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 79.42%. Comparing base (794d348) to head (b58b3d1).
⚠️ Report is 1 commits behind head on main.

Additional details and impacted files
@@            Coverage Diff             @@
##             main    #2453      +/-   ##
==========================================
- Coverage   79.88%   79.42%   -0.47%     
==========================================
  Files         128      121       -7     
  Lines        6861     6702     -159     
  Branches       47        3      -44     
==========================================
- Hits         5481     5323     -158     
+ Misses       1380     1379       -1     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@AlexSkrypnyk AlexSkrypnyk enabled auto-merge (rebase) April 8, 2026 00:52
@AlexSkrypnyk AlexSkrypnyk merged commit d004d99 into main Apr 8, 2026
30 checks passed
@AlexSkrypnyk AlexSkrypnyk deleted the feature/update-phpstan-config-return branch April 8, 2026 01:01
@github-project-automation github-project-automation bot moved this from In progress to Release queue in Vortex Apr 8, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Status: Release queue

Development

Successfully merging this pull request may close these issues.

1 participant