ci: upgrade PHPStan to v2 with baseline and full codebase coverage#11550
ci: upgrade PHPStan to v2 with baseline and full codebase coverage#11550
Conversation
- Upgrade phpstan/phpstan from 1.12.* to ^2.0 - Raise analysis level to max - Expand paths from 3 specific dirs to src/, app/, bin/, tests/ - Generate baseline capturing 95,365 existing errors for incremental adoption - Rename composer script from `check` to `analyze` - Add --memory-limit=1G to handle larger scan scope Co-Authored-By: Claude Sonnet 4.6 <[email protected]>
📝 WalkthroughWalkthroughThis PR upgrades PHPStan from version 1.12 to 2.0 across the project. The change includes updating the dependency in composer.json, renaming the composer script from "check" to "analyze" with an added memory-limit flag, updating the CI workflow to use the new script name, and adjusting phpstan.neon configuration to include a baseline file, increase the analysis level to max, and expand the analyzed paths while removing app/sdks from exclusions. Estimated code review effort🎯 3 (Moderate) | ⏱️ ~25 minutes 🚥 Pre-merge checks | ✅ 3✅ Passed checks (3 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches
🧪 Generate unit tests (beta)
📝 Coding Plan
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 |
Security Scan Results for PRDocker Image Scan Results
Source Code Scan Results🎉 No vulnerabilities found! |
Greptile SummaryThis PR upgrades PHPStan from v1.12 to v2.1, raises the analysis level to Key points:
Confidence Score: 4/5
Important Files Changed
Sequence DiagramsequenceDiagram
participant Dev as Developer
participant CI as GitHub Actions
participant Docker as composer:2.8 (Docker)
participant PHPStan as PHPStan v2.1
Dev->>CI: Push / open PR
CI->>Docker: composer install --ignore-platform-reqs
Docker-->>CI: Dependencies installed (incl. phpstan ^2.0)
CI->>Docker: composer analyze
Docker->>PHPStan: phpstan analyse -c phpstan.neon --memory-limit=1G
PHPStan->>PHPStan: Load phpstan-baseline.neon (95,365 suppressed errors)
PHPStan->>PHPStan: Analyse src/ app/ bin/ tests/ at level max
alt No new errors
PHPStan-->>CI: ✅ Exit 0
else New errors found (not in baseline)
PHPStan-->>CI: ❌ Exit 1 — new code is not clean
end
Last reviewed commit: 937d949 |
There was a problem hiding this comment.
🧹 Nitpick comments (1)
composer.json (1)
17-17: Consider adding a temporarycheckalias to ease migration.Renaming the script is fine, but keeping a short deprecation bridge avoids breaking local habits or external wrappers.
Suggested compatibility tweak
"scripts": { "test": "vendor/bin/phpunit", "lint": "vendor/bin/pint --test --config pint.json", "format": "vendor/bin/pint --config pint.json", "bench": "vendor/bin/phpbench run --report=benchmark", - "analyze": "./vendor/bin/phpstan analyse -c phpstan.neon --memory-limit=1G" + "analyze": "./vendor/bin/phpstan analyse -c phpstan.neon --memory-limit=1G", + "check": "@analyze" }🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed. In `@composer.json` at line 17, Add a temporary "check" composer script alias that points to the same command as the renamed "analyze" script to preserve compatibility with existing workflows; update the "scripts" object to include "check": "./vendor/bin/phpstan analyse -c phpstan.neon --memory-limit=1G" (or call the new "analyze" script from "check") so local habits and external wrappers continue to work during migration.
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.
Nitpick comments:
In `@composer.json`:
- Line 17: Add a temporary "check" composer script alias that points to the same
command as the renamed "analyze" script to preserve compatibility with existing
workflows; update the "scripts" object to include "check": "./vendor/bin/phpstan
analyse -c phpstan.neon --memory-limit=1G" (or call the new "analyze" script
from "check") so local habits and external wrappers continue to work during
migration.
ℹ️ Review info
⚙️ Run configuration
Configuration used: Path: .coderabbit.yaml
Review profile: CHILL
Plan: Pro
Run ID: 9d67a649-f9bf-4f70-986f-78c9fcf9f90e
⛔ Files ignored due to path filters (1)
composer.lockis excluded by!**/*.lock
📒 Files selected for processing (4)
.github/workflows/ci.ymlcomposer.jsonphpstan-baseline.neonphpstan.neon
🔄 PHP-Retry SummaryFlaky tests detected across commits: |
✨ Benchmark results
⚡ Benchmark Comparison
|
Summary
phpstan/phpstanfrom1.12.*to^2.0(latest: 2.1.40)max(was 8)src/,app/,bin/,tests/phpstan-baseline.neon) capturing 95,365 existing errors, enabling incremental adoption — new code must be cleanchecktoanalyze--memory-limit=1Grequired for the larger scopeTest plan
Checks / Analyzejob passescomposer analyzeruns locally with no errors🤖 Generated with Claude Code