- How do I integrate this formatter into my Laravel project’s PHPStan setup?
- Run `composer require --dev ticketswap/phpstan-error-formatter` and add `parameters: errorFormat: ticketswap` to your `phpstan.neon`. If using `phpstan/extension-installer`, no extra steps are needed—it auto-loads the extension.
- Will this work with Laravel’s Artisan commands or CI/CD pipelines?
- Yes, it’s designed for CLI output. For CI, ensure your terminal/IDE supports clickable links (e.g., GitHub Actions with VS Code). If not, it falls back to readable plaintext with `file://` URLs for IDEs like PhpStorm.
- Does this formatter support PHPStan 1.x, 2.x, or 3.0 for Laravel projects?
- It officially supports PHPStan 1.x and 2.x. PHPStan 3.0 compatibility is untested—check GitHub issues for updates. Laravel projects typically use 1.x/2.x, so this is unlikely to be a concern.
- Can I customize the IDE/editor URL scheme (e.g., for PhpStorm or VS Code)?
- Absolutely. Add `editorUrl: 'vscode://file/%%file%%:%%line%%'` or `phpstorm://` to your `phpstan.neon` under `parameters`. This overrides the default clickable link behavior.
- Will this break existing PHPStan rules or slow down analysis in Laravel?
- No, it’s a presentation layer only—no core logic changes. Benchmarks show <50ms overhead for highlighting. Laravel’s static analysis workflows (e.g., `phpstan:parallel`) remain unaffected.
- How does it handle long file paths in Laravel’s nested `app/` or `src/` directories?
- Paths are visually truncated (e.g., `src/App/../Entity/User.php`) but retain full clickable links. For example, `vendor/ticketswap/...` becomes `[vendor/...]` while keeping the original path intact.
- Is there a fallback if this formatter fails to load in production?
- Yes, PHPStan gracefully degrades to its default formatter. No runtime errors occur—just standard output. Ideal for CI or environments where extensions might be disabled.
- Does this work with Laravel Pint or other code-quality tools?
- Yes, it’s independent of Pint. Use it alongside Pint or Telescope for consistent error formatting. The formatter focuses on PHPStan output, so it won’t interfere with other tools.
- Can I use this with custom PHPStan rules or Laravel-specific extensions?
- Absolutely. The formatter is rule-agnostic—it processes all PHPStan errors uniformly. Test with your custom rules to ensure no conflicts, but it’s designed to work with any extension.
- How do I test if clickable links work in my terminal or CI environment?
- Run `phpstan` in your terminal and hover over file paths. For CI, check if your runner (e.g., GitHub Actions) supports ANSI escape codes. If not, verify `file://` URLs are parsed by your IDE or CI logs.