Skip to content

feat: add AnalysisResult::withFileSpecificErrors() to public API#5034

Open
janedbal wants to merge 1 commit intophpstan:2.1.xfrom
janedbal:analysis-result-with-methods
Open

feat: add AnalysisResult::withFileSpecificErrors() to public API#5034
janedbal wants to merge 1 commit intophpstan:2.1.xfrom
janedbal:analysis-result-with-methods

Conversation

@janedbal
Copy link
Contributor

Custom ErrorFormatter implementations that need to filter or modify file-specific errors currently have to call the AnalysisResult constructor directly, which is not part of the public API.

This adds an @api withFileSpecificErrors() method that returns a copy of the result with different file-specific errors, allowing extensions to create modified results without relying on internal constructor.

See example usecase: shipmonk-rnd/dead-code-detector#292

Custom ErrorFormatter implementations that need to filter or modify
file-specific errors currently have to call the AnalysisResult
constructor directly, which is not part of the public API.

This adds an @api withFileSpecificErrors() method that returns a copy
of the result with different file-specific errors, allowing extensions
to create modified results without relying on internal constructor.

See shipmonk-rnd/dead-code-detector#292
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.

1 participant