-
-
Notifications
You must be signed in to change notification settings - Fork 9.5k
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
[FrameworkBundle][DX] Add Levenshtein suggesters to AbstractConfigCommand #17484
Conversation
a031489
to
3c0b0ae
Compare
I'm not sure about this one. Extension names are derived from bundle names. |
@fabpot, well, technically they should be derived (they do match bundle names right after the bundle has been generated), but there's nothing that could stop someone from (mistakenly) overriding those. That's going against the rules, yes, but I think it's better to handle these cases transparently. levenshtein('SensioFrameworkExtraBundle', 'sensioframeworkextra') => int(9)
levenshtein('sensio_framework_extra', 'sensioframeworkextra')) => int(2) I mean, the reason here is just suggesting the best possible match for the given input, and I think this solution might be satisfying. |
Fair enough, can you add some tests? |
@fabpot, sure, will do. |
@kix any news? |
@fabpot, sorry, not yet :( |
Thank you @kix. |
…stractConfigCommand (kix) This PR was merged into the 3.1-dev branch. Discussion ---------- [FrameworkBundle][DX] Add Levenshtein suggesters to AbstractConfigCommand | Q | A | ------------- | --- | Bug fix? | no | New feature? | no | BC breaks? | no | Deprecations? | no | Tests pass? | yes | Fixed tickets | none | License | MIT | Doc PR | none It could be helpful to output the best guesses for bundle names and container extension aliases when one could not be found by the exact query. Perhaps, I could regroup the logic so that it only looks through bundle names if the `Bundle` suffix is present, but I guess this might narrow the use case scope here. Commits ------- 3c0b0ae Add Levenshtein suggesters to AbstractConfigCommand
Writing tests is really cumbersome as we would have to mock half of Symfony :) So, I've merged as is. |
@fabpot, thanks for taking a look, I didn't really have any idea on how do I test this :) |
It could be helpful to output the best guesses for bundle names and container extension aliases when one could not be found by the exact query.
Perhaps, I could regroup the logic so that it only looks through bundle names if the
Bundle
suffix is present, but I guess this might narrow the use case scope here.