Skip to content

ext/int: IntlTimeZone converting few intl error to exceptions. #13477

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

Open
wants to merge 2 commits into
base: master
Choose a base branch
from

Conversation

devnexen
Copy link
Member

No description provided.

Comment on lines +146 to 147
if (ZEND_NUM_ARGS() == 0) {
se = TimeZone::createEnumeration();
Copy link
Member

Choose a reason for hiding this comment

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

Oh maybe the first arg should then be string|int|null, sorry didn't realize this at first.

Copy link
Member

Choose a reason for hiding this comment

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

@kocsismate do you think the param should be nullable or not? Or is that not really an issue in regards to the RFC about overloaded methods?

Copy link
Member

Choose a reason for hiding this comment

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

Uh, thanks for spotting this. The argument should be definitely nullable, otherwise it will be overloaded. @devnexen In most of the cases, using ZEND_NUM_ARGS() is a clear sign of an overloaded signature.

Copy link
Member

Choose a reason for hiding this comment

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

However, I'm wondering how this parameter can be declared with the string|int type? Currently, its phpdoc says IntlTimeZone|string|int|float|null. 🤔

Comment on lines 153 to 156
argl = zend_dval_to_lval(dval);
if (!zend_is_long_compatible(argl, dval)) {
zend_incompatible_double_to_long_error(dval);
RETURN_FALSE;
}
Copy link
Member

Choose a reason for hiding this comment

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

Add a test for this, and I don't think you should return false here, as the behaviour should be the same, just emitting a deprecation notice :)

@devnexen devnexen force-pushed the ext_intl_to_typeerror branch from 09819d5 to d9ffb18 Compare February 24, 2024 19:28
@devnexen devnexen marked this pull request as ready for review February 24, 2024 19:45
@devnexen
Copy link
Member Author

ping :)

Copy link
Member

@Girgias Girgias left a comment

Choose a reason for hiding this comment

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

Got the final question, but otherwise this LGTM

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.

3 participants