Skip to content

feat(php): add PHPStan analyse filter module#1110

Open
LucianoVandi wants to merge 1 commit intortk-ai:developfrom
LucianoVandi:feat/phpstan-filter-module
Open

feat(php): add PHPStan analyse filter module#1110
LucianoVandi wants to merge 1 commit intortk-ai:developfrom
LucianoVandi:feat/phpstan-filter-module

Conversation

@LucianoVandi
Copy link
Copy Markdown

Summary

Adds a new php ecosystem module with a filter for PHPStan.

What it does

  • injects --error-format=json for analyse / analyze
  • groups errors by file, sorted by error count descending
  • shows up to 10 files × 5 messages each, with truncation hints
  • auto-detects vendor/bin/phpstan before falling back to phpstan on PATH
  • falls back to text parsing when a custom --error-format is requested
  • falls back safely to fallback_tail() if JSON parsing fails
  • leaves utility commands like --version, list, and clear-result-cache as real passthrough

Rewrite coverage

Adds rewrite support for:

  • phpstan analyse
  • vendor/bin/phpstan analyse
  • ./vendor/bin/phpstan analyse
  • php vendor/bin/phpstan analyse

Tests

Added module tests covering:

  • zero-error and error JSON output
  • truncation behavior
  • token savings on a realistic fixture
  • malformed / empty output handling
  • text fallback behavior
  • classify / rewrite behavior, including negative coverage for utility commands

Validation

cargo fmt --all --check
cargo clippy --all-targets
cargo test --all

Notes

Snapshot tests were not added because insta is not currently a repo dependency. This PR uses explicit assertions and fixture-based coverage instead.

@CLAassistant
Copy link
Copy Markdown

CLAassistant commented Apr 9, 2026

CLA assistant check
All committers have signed the CLA.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants