Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

highlight expected and actual value in error messages #13

Open
staabm opened this issue Sep 23, 2024 · 3 comments
Open

highlight expected and actual value in error messages #13

staabm opened this issue Sep 23, 2024 · 3 comments

Comments

@staabm
Copy link

staabm commented Sep 23, 2024

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

grafik

@yamadashy
Copy link
Owner

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.

@staabm
Copy link
Author

staabm commented Sep 25, 2024

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)

@yamadashy
Copy link
Owner

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants