Skip to content

Refactor levenshtein()#5816

Closed
Girgias wants to merge 2 commits into
php:masterfrom
Girgias:refactor-levenstein
Closed

Refactor levenshtein()#5816
Girgias wants to merge 2 commits into
php:masterfrom
Girgias:refactor-levenstein

Conversation

@Girgias

@Girgias Girgias commented Jul 6, 2020

Copy link
Copy Markdown
Member

The unimplemented overloaded variant about using a callable for the 3rd argument (which only takes a string callable as this code is OLD) is removed and should if implemented be implemented as a separate function (see: https://bugs.php.net/bug.php?id=34835)

This should also fix: https://bugs.php.net/bug.php?id=79050

I'm not sure if the length limitation makes much sense in 2020.

Also I wonder if I should classify as a ValueError negative costs (<= 0)

@Girgias Girgias force-pushed the refactor-levenstein branch from 89451da to f359601 Compare July 6, 2020 17:22

@cmb69 cmb69 left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Thanks! Very welcome clean-up. :)

Comment thread ext/standard/levenshtein.c Outdated

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Suggested change
zend_argument_value_error(1, "must be less than %d characters", LEVENSHTEIN_MAX_LENGTH);
zend_argument_value_error(1, "must be less than %d characters", LEVENSHTEIN_MAX_LENGTH + 1);

or

Suggested change
zend_argument_value_error(1, "must be less than %d characters", LEVENSHTEIN_MAX_LENGTH);
zend_argument_value_error(1, "must be less than or equal to %d characters", LEVENSHTEIN_MAX_LENGTH);

(same below)

@Girgias Girgias force-pushed the refactor-levenstein branch from f359601 to c00e0fa Compare July 6, 2020 17:50
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants