-
-
Notifications
You must be signed in to change notification settings - Fork 288
fix: prevent error when detail message has console style #447
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
fix: prevent error when detail message has console style #447
Conversation
I have an error on CI: It is PHPStan but with different files:
Why do I have these errors? Thanks. |
Hi @misaert ! This fix seems legit 👍 But I don't see in which case the error is raised. I wonder what is the output in the formatter. For the PHPStan error, I have to check that. I come back to you when I have found 🙃 |
@Jibbarth Maybe it's because of the new rules in PHPstan? Because it's OK on old versions. I think PHPstan changes in new versions is cause of this error. |
Hi @Jibbarth, The issue is With the fix, the output is:
I manually test it, yes. Bu I wonder if I have to test with PHPUnit and how if needed 😉 Thanks 🙂 |
Hi @misaert, I just merged master in your branch to get the new Github Action workflows, and I added some phpunit tests on this fix. Thanks for contributing on this, really appreciated 👍 |
Thank you 👍 |
Before when we have a variable in console command with color (example:
$io->text("Status: <fg=$statusColor>$status</>");
, PHP Insights throws an exception:It is because the method
writeln
(https://github.com/nunomaduro/phpinsights/blob/master/src/Application/Console/Formatters/Console.php#L416) interprets colors in the code.The fix escapes lines of detail message to prevent this.
I don't know if I have to test it and how to do it.