-
Notifications
You must be signed in to change notification settings - Fork 8k
ext/intl IntlChar::enumCharNames changes the signature to void. #10904
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
ext/intl/intl_data.h
Outdated
| } | ||
|
|
||
| /* Check status by error code, if error return directly */ | ||
| #define INTL_CHECK_STATUS_RETURN(err, msg) \ |
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 know that this is copy-pasted but these backslashes are aligned very bad. I think you should use spaces instead of tabs if you don't mind.
ext/intl/uchar/uchar.stub.php
Outdated
|
|
||
| /** @tentative-return-type */ | ||
| public static function enumCharNames(int|string $start, int|string $end, callable $callback, int $type = IntlChar::UNICODE_CHAR_NAME): ?bool {} // TODO return values just don't make sense | ||
| public static function enumCharNames(int|string $start, int|string $end, callable $callback, int $type = IntlChar::UNICODE_CHAR_NAME): void {} |
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.
the void return type suggests that there is no error condition, or the function emits exceptions in case of errors, however, this function has at least 4 error conditions and exceptions are not necessarily thrown. Previously, in case of an error, either null or false was returned. In case of success, it returned null (OMG). So I think the sensible solution would be to return false on failure, and true on success. What do you think about it?
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 agree. At least this wouldn't break an existing if (IntlChar::enumCharNames(...) === false) {} pattern.
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.
Same opinion here.
655631f to
fa7ce56
Compare
iluuu1994
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.
LGTM!
No description provided.