highlight expected and actual value in error messages
Opened this issue · 3 comments
thank you for this nice formatter.
I want to suggest to color or format the expected and actual value of rule errors, since these are usually the most important part of an error message. additionaly these are often-times only separated by a single ,
so e.g. on big array shapes its pretty hard to see where the actual value ended and where the expected value begins
something like
Thank you for your feedback and suggestion!
I understand you're proposing to make PHPStan's error messages more human-readable and easier to understand. You're right; if we can achieve this as a formatter, it would indeed be very helpful.
Currently, our formatter is outputting PHPStan's error messages as-is. These messages lack consistency in their format, which could make parsing them challenging. However, I think it's worth exploring this idea further.
thanks for getting back to me.
there is currently a discussion on how the data can/needs to be represented to ease use from error formatters:
phpstan/phpstan#11581 (reply in thread)
Thank you for following up and sharing that discussion link. I wasn't aware of this ongoing conversation about improving error formatters in PHPStan.
The approach discussed in phpstan/phpstan#11581 indeed looks promising. It would be a significant enhancement if such functionality were integrated directly into PHPStan. This kind of improvement could greatly benefit all error formatters, including ours.
While i want to avoid simply copying their ideas, I'll review the thread carefully and see how i might incorporate similar concepts in a way that's appropriate for friendly formatter.
Thank you again for bringing this to our attention.