Skip to content

Conversation

@devnexen
Copy link
Member

No description provided.

}

/* Check status by error code, if error return directly */
#define INTL_CHECK_STATUS_RETURN(err, msg) \
Copy link
Member

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.


/** @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 {}
Copy link
Member

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?

Copy link
Member

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.

Copy link
Member

Choose a reason for hiding this comment

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

Same opinion here.

@devnexen devnexen force-pushed the intl_enumcharnames_changes branch from 655631f to fa7ce56 Compare March 28, 2023 12:26
Copy link
Member

@iluuu1994 iluuu1994 left a comment

Choose a reason for hiding this comment

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

LGTM!

@devnexen devnexen closed this in 2da2997 Mar 28, 2023
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.

4 participants