yamadashy / phpstan-friendly-formatter
Simple error formatter for PHPStan that display code frame
Installs: 36 531
Dependents: 4
Suggesters: 0
Security: 0
Stars: 48
Watchers: 2
Forks: 1
Open Issues: 2
Type:phpstan-extension
Requires
- php: ^7.4 || ^8.0
- php-parallel-lint/php-console-highlighter: ^0.3 || ^0.4 || ^0.5 || ^1.0
- phpstan/phpstan: ^0.12 || ^1.0 || ^2.0
Requires (Dev)
- friendsofphp/php-cs-fixer: ^3.4.0
- phpstan/phpstan-phpunit: ^2.0
- phpunit/phpunit: ^8.5.26 || ^10.0.0
README
Enhance your PHPStan experience with a formatter that brings your code to life! 🚀
🌟 Features
- Display Code Frame: See the problematic code right where the error occurs
- Error Identifier Summary: Get a quick overview of error types and their frequencies
- Beautiful Output: Enjoy a visually appealing and easy-to-read error report
🎯 Motivation
Ever felt lost in a sea of file paths and line numbers? We've been there! That's why we created this formatter to:
- Instantly pinpoint what's wrong in your code
- Reduce mental overhead when interpreting error messages
- Accelerate your debugging process
🚀 Getting Started
- You may use Composer to install this package as a development dependency.
composer require --dev yamadashy/phpstan-friendly-formatter
- Register error formatter into your
phpstan.neon
orphpstan.neon.dist
:
includes: - ./vendor/yamadashy/phpstan-friendly-formatter/extension.neon
- Finally, set the
errorFormat
parameter:
parameters: errorFormat: friendly
Optional: Simplify Your Workflow
If you want to make it simpler, setting scripts
in composer.json
as follows:
{ "scripts": { "analyze": "phpstan analyze --error-format friendly" } }
You can run a short command like this:
composer analyze
⚙️ Configuration Options
You can customize in your phpstan.neon
:
parameters: friendly: # default is 3 lineBefore: 3 lineAfter: 3 # default is null editorUrl: 'phpstorm://open?file=%%file%%&line=%%line%%'
lineBefore
... Number of lines to display before error linelineAfter
... Number of lines to display after error lineeditorUrl
... URL with placeholders like [table formatter config](URL for editor like table formatter)
🖼️ Example
When you actually introduce it in GitHub Actions, it will be displayed as follows.
https://github.com/yamadashy/laravel-blade-minify-directive/actions/runs/4714024802/jobs/8360104870
📜 License
Distributed under the MIT license.