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

Expose Output::isDecorated and Output::isVeryVerbose #3436

Merged
merged 3 commits into from
Sep 13, 2024

Conversation

ruudk
Copy link
Contributor

@ruudk ruudk commented Sep 13, 2024

This can be used by an ErrorFormatter to determine if --ansi or --no-ansi was used.

A use case can be to toggle rendering of colors or hyperlinks.

When ansi is not enabled, one might want to render a link differently.

Needed for https://github.com/TicketSwap/phpstan-error-formatter

@ruudk ruudk changed the base branch from 2.0.x to 1.12.x September 13, 2024 06:35
@phpstan-bot
Copy link
Collaborator

You've opened the pull request against the latest branch 2.0.x. PHPStan 2.0 is not going to be released for months. If your code is relevant on 1.12.x and you want it to be released sooner, please rebase your pull request and change its target to 1.12.x.

@ruudk
Copy link
Contributor Author

ruudk commented Sep 13, 2024

@ondrejmirtes This might be a breaking change for 1.12. Maybe we can add the method to the SymfonyOutput in 1.12 . And add it to the Output interface in 2.x?

Then in my code, I can do a check if isDecorated exists, and use it.

This can be used by an ErrorFormatter to determine if `--ansi` or `--no-ansi` was used.

A use case can be to toggle rendering of colors or hyperlinks.

When ansi is not enabled, one might want to render a link differently.
@ondrejmirtes
Copy link
Member

This might be a breaking change for 1.12.

I don't think so. No one has a reason to implement a custom Output. Please add the interface to BcUncoveredInterface (a list of interfaces that users can use but not implement).

@ruudk
Copy link
Contributor Author

ruudk commented Sep 13, 2024

Updated the PR

@ruudk ruudk changed the title Expose Output::isDecorated Expose Output::isDecorated and Output::isVeryVerbose Sep 13, 2024
@ondrejmirtes ondrejmirtes merged commit da764a2 into phpstan:1.12.x Sep 13, 2024
477 of 499 checks passed
@ondrejmirtes
Copy link
Member

Thank you!

This pull request was closed.
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

Successfully merging this pull request may close these issues.

3 participants