Excluded path: include example for optional path#3883
Excluded path: include example for optional path#3883ondrejmirtes merged 4 commits intophpstan:2.1.xfrom thePanz:patch-1
Conversation
src/Command/CommandHelper.php
Outdated
| $errorOutput->writeLineFormatted('If the excluded path can sometimes exist, append <fg=cyan>(?)</>'); | ||
| $errorOutput->writeLineFormatted('to its config entry to mark it as optional.'); | ||
| $errorOutput->writeLineFormatted('to its config entry to mark it as optional. Example:'); | ||
| $errorOutput->writeLineFormatted(' <fg=cyan>- path/something (?)</>'); |
There was a problem hiding this comment.
Would be great to show the full example including excludePaths: and to use the actual path in question, not just path/something. Thanks.
There was a problem hiding this comment.
I tried to achieve that as my first contribution to PHPStan :)
I proposed a first change to be able to track which paths should be suggested.
from my understanding: paths adhering to FileExcluder::isFnmatchPattern() are not evaluated, thus I opted to not suggest those as Optional. Let me know if those should be added too as suggestions.
|
Also I just noticed there's a typo: |
|
The example should use relative paths. |
|
It should but right now it's impossible to get the correct relative path. Because relative path depends on the location of the config file, but at this point we have the whole parameters array decoded from all the config files at once. I don't need OP to tackle this. I can look at it myself once the PR works. |
|
Some brain dump while trying to implement the feature:
|
|
Please mark it as ready for review if it's done from your side. |
|
This pull request has been marked as ready for review. |
Make more clear how to mark an excluded path optional, with the use of `(?)` suffix
|
I've pushed two commits, feel free to inspect them 😊 |
|
Thank you! |


Make more clear how to mark an excluded path optional, with the use of
(?)suffix