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

Feature Request: More thorough filtering #1078

Open
ondrejmirtes opened this issue Jul 11, 2022 · 3 comments
Open

Feature Request: More thorough filtering #1078

ondrejmirtes opened this issue Jul 11, 2022 · 3 comments

Comments

@ondrejmirtes
Copy link

I use this custom filter: https://github.com/phpstan/phpstan-src/blob/1.8.x/apigen/src/Filter.php

My problem is that the filtered classes still show up in some places:

  1. ShouldNotHappenException under Exceptions in this listing https://apiref.phpstan.org/1.8.x/namespace-PHPStan.html
  2. In tree hierarchies https://apiref.phpstan.org/1.8.x/PHPStan.Rules.RuleError.html (these classes are even marked as @internal), another example https://apiref.phpstan.org/1.8.x/PHPStan.Command.ErrorFormatter.ErrorFormatter.html
  3. Search should prioritize and sort primary symbols on top.

Ideally I'd like to NOT render pages like https://apiref.phpstan.org/1.8.x/PHPStan.Rules.RuleErrors.RuleError107.html at all because it creates a lot of noise. But I understand it's not trivial because it's going to be linked in many places and those links should no longer be links.

@JanTvrdik
Copy link
Member

ShouldNotHappenException has __construct() with @api, so that seems fine to me.


The analysis filter used to completely exclude class-likes from index, but it resulted in lot of "missing symbol" errors, so the behavior was changed 16 days ago to only mark them as non-primary which affects rendering.

The primary flag is currently used to avoid rendering source code of non-primary files and hiding them in menu. But there is no control over this. So as the first step I added Renderer\Filter which controls which pages are rendered.

@ondrejmirtes
Copy link
Author

Awesome, it works really well for me! phpstan/phpstan-src@326fbf6

So now I'd just wish for being able to completely hide some symbols from trees like here https://apiref.phpstan.org/1.8.x/PHPStan.DependencyInjection.Container.html (NetteContainer and MemoizingContainer). I understand it's not trivial because in some cases the filtered-out pages are actually parents of the current page (https://apiref.phpstan.org/1.8.x/PHPStan.Testing.PHPStanTestCase.html) so I can live with the current status too.

The search problem solved itself by filtering the rendered pages, I'm quite happy with the results now. Although for some cases it could be improved - for example if I search for templatetype, there's an interface with this exact name (https://apiref.phpstan.org/1.8.x/PHPStan.Type.Generic.TemplateType.html) but the autocomplete prioritizes other things. But it's not that important :)

Feel free to close this issue, thank you very much, I really appreciate it!

@ondrejmirtes
Copy link
Author

But I think it'd make sense to filter out not-rendered children in trees like here: https://apiref.phpstan.org/1.8.x/PHPStan.Rules.Rule.html

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