jbelien/phpstan-sarif-formatter
SARIF error formatter for PHPStan (1.x/2.x). Outputs analysis results as SARIF JSON for easy integration with GitHub Code Scanning and CI pipelines. Configure via phpstan.neon and run phpstan analyze --error-format=sarif.
composer.json constraints, simplifying dependency management.Type\ArrayShape).ruleId in SARIF must match PHPStan 2.x’s new identifiers).helpUri)?extension.phar) need adjustments to work with both PHPStan 1.x and 2.x during transition?Type\ObjectType), enhancing SARIF’s accuracy.actions/upload-sarif with no changes.sarif-webapp will display PHPStan 2.x results without modification.phpstan diagnose to list all enabled rules and compare with SARIF’s ruleId fields.composer.json to require jbelien/phpstan-sarif-formatter:^1.2 and phpstan/phpstan:^2.0.vendor/bin/phpstan analyse --generate-sarif=report.sarif
feature/sarif-canary).composer why-not jbelien/phpstan-sarif-formatter:1.2).Type\ObjectType) are properly mapped.ruleId: "Type.ArrayShape" → ruleId: "Type.ObjectType").helpUri) as needed.Type\ArrayShape, ensure SARIF’s ruleId reflects the new naming convention.message or locations fields for accuracy.tool.driver field). Test annually.message.text, reducing false positives.relatedLocations to link related code sections (e.g., type hints and usage).Type\ObjectType mismatches).Type\ObjectType) during onboarding.hyperfine:
hyperfine --warmup 3 'vendor/bin/phpstan analyse --generate-sarif=report.sarif'
--memory-limit=1G to avoid timeouts during SARIF generation.helpUri). Mitigate by:
sarif-schema-cli).phpstan-sarif-formatter).tool.driver or ruleId formats change. Validate with:
npx @microsoft/sarif-cli validate report.sarif
Type.ArrayShape) may cause SARIF ambiguity. Resolve by:
ruleId prefixes (e.g., phpstan1:Type.ArrayShape, phpstan2:Type.ObjectType).How can I help you explore Laravel packages today?