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

Align Utils::suggestionList() with the reference implementation #1075

Merged
merged 13 commits into from
Mar 14, 2022

Conversation

vhenzl
Copy link
Contributor

@vhenzl vhenzl commented Feb 19, 2022

Aligns Utils::suggestionList() with the current version of suggestionList() from the reference implementation.

Adds the LexicalDistance class to calculate the distance between strings. The built-in levenshtein function can't be used as it doesn't support transpositions.

Options with the same length are ordered lexicographically.

See #999 (comment) for context.

src/Utils/LexicalDistance.php Outdated Show resolved Hide resolved
src/Utils/LexicalDistance.php Outdated Show resolved Hide resolved
src/Utils/LexicalDistance.php Outdated Show resolved Hide resolved
src/Utils/LexicalDistance.php Show resolved Hide resolved
tests/Type/EnumTypeTest.php Show resolved Hide resolved
src/Utils/LexicalDistance.php Show resolved Hide resolved
tests/Utils/SuggestionListTest.php Outdated Show resolved Hide resolved
Copy link
Collaborator

@spawnia spawnia left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nicely done. Thanks for working with me to adapt this code to idiomatic PHP.

@spawnia spawnia merged commit b6ac0ff into webonyx:master Mar 14, 2022
@vhenzl vhenzl deleted the align-suggestion-list branch March 15, 2022 03:51
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants