Uh oh!
There was an error while loading.Please reload this page.
- Notifications
You must be signed in to change notification settings - Fork9.7k
[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 ourterms of service andprivacy statement. We’ll occasionally send you account related emails.
Already on GitHub?Sign in to your account
Uh oh!
There was an error while loading.Please reload this page.
Conversation
chalasr left a comment
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.
👍
stof commentedNov 23, 2021
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 |
stof commentedNov 23, 2021
Note that your current plan also requires widening the |
stof commentedNov 23, 2021
@wouterj if you want to go for the widening type version, you need to tag |
nicolas-grekas commentedNov 23, 2021 • edited
Loading Uh oh!
There was an error while loading.Please reload this page.
edited
Uh oh!
There was an error while loading.Please reload this page.
Widening a return type is not a BC break so we could do it later. |
wouterj commentedNov 23, 2021
Are you sure? This means that you can never safely rely on the return type if you're the calling side of the code. |
stof commentedNov 23, 2021
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). |
wouterj commentedNov 23, 2021
nicolas-grekas commentedNov 23, 2021 • edited
Loading Uh oh!
There was an error while loading.Please reload this page.
edited
Uh oh!
There was an error while loading.Please reload this page.
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. |
stof commentedNov 23, 2021
so you would want to have We cannot rely on |
wouterj commentedNov 23, 2021
Oh: "Changing a return type is only possible with a child type.". As the proposed new suggestion class would be |
nicolas-grekas commentedNov 23, 2021
The BC doc needs to tell about widening/narrowing :) |
stof commentedNov 23, 2021
@wouterj |
nicolas-grekas commentedNov 23, 2021
So let's widen now indeed to be on the safe side. |
wouterj commentedNov 23, 2021
I've proposed the alternative solution in a new PR:#44230 |
stof commentedNov 23, 2021
@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). |
wouterj commentedNov 23, 2021
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 tosymfony/symfony#44229 , see that PR for the full context.Commits-------20ba02c1ee Add Suggestion class for more advanced completion suggestion

Uh oh!
There was an error while loading.Please reload this page.
A very late call, but I suddenly realized we have to do something with the
CompletionSuggestionsclass to not cut ourselves in the fingers for 6.1.The problem:
suggestValues()currently only allowsstringvalues. 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 aDecoratedSuggestionor something like that, likesuggested 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
DecoratedSuggestionand widen this argument type in Symfony 5.4 already, without immediately using its power.