-
-
Notifications
You must be signed in to change notification settings - Fork 9.6k
[Console] Make CompletionSuggestions final #44229
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
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
👍
I would widen it now, making it easier to write code support 5.4 and 6.1 by always providing the suggestion with description in the command |
Note that your current plan also requires widening the |
@wouterj if you want to go for the widening type version, you need to tag |
Widening a return type is not a BC break so we could do it later. |
Are you sure? This means that you can never safely rely on the return type if you're the calling side of the code. |
it definitely is a BC break for callers (which is also why child classes are not allow to widen a return type of their parent). |
It's a behavioral BC break if something unexpected is returned, but if there's an opt-in on the input side of the API, then it's fine. |
so you would want to have We cannot rely on |
Oh: "Changing a return type is only possible with a child type.". As the proposed new suggestion class would be |
The BC doc needs to tell about widening/narrowing :) |
@wouterj |
So let's widen now indeed to be on the safe side. |
I've proposed the alternative solution in a new PR: #44230 |
@nicolas-grekas widening a return type is a BC break all the time. Narrowing it is a BC break for child classes (requiring them to narrow their own return type in advance, which is the whole reason for tentative return types in PHP 8.1 core and our work in DebugClassLoader). |
Let's close in favor of the new one, didn't see the conclusion before creating the other PR. |
…n suggestion (wouterj) This PR was merged into the 5.4 branch. Discussion ---------- [Console] Add Suggestion class for more advanced completion suggestion | Q | A | ------------- | --- | Branch? | 5.4 | Bug fix? | no | New feature? | yes | Deprecations? | no | Tickets | | License | MIT | Doc PR | - Alternative to #44229 , see that PR for the full context. Commits ------- 20ba02c Add Suggestion class for more advanced completion suggestion
…n suggestion (wouterj) This PR was merged into the 5.4 branch. Discussion ---------- [Console] Add Suggestion class for more advanced completion suggestion | Q | A | ------------- | --- | Branch? | 5.4 | Bug fix? | no | New feature? | yes | Deprecations? | no | Tickets | | License | MIT | Doc PR | - Alternative to symfony/symfony#44229 , see that PR for the full context. Commits ------- 20ba02c1ee Add Suggestion class for more advanced completion suggestion
A very late call, but I suddenly realized we have to do something with the
CompletionSuggestions
class to not cut ourselves in the fingers for 6.1.The problem:
suggestValues()
currently only allowsstring
values. ZSH and FISH shells can have much more advanced completion support - also allowing descriptions for instance. Instead of making the completion integration shell specific, it is better to allow aDecoratedSuggestion
or something like that, like suggested by @GromNaN in the ZSH PRWe won't add zsh/fish support in Symfony <6.1, so we must allow ourselves to widen the argument type in Symfony 6.1.
Another option is to add the basic
DecoratedSuggestion
and widen this argument type in Symfony 5.4 already, without immediately using its power.