Skip to content

Promote Intl warnings to standard ValueError - #5669

Closed
Girgias wants to merge 8 commits into
php:masterfrom
Girgias:intl-error-promotion
Closed

Promote Intl warnings to standard ValueError#5669
Girgias wants to merge 8 commits into
php:masterfrom
Girgias:intl-error-promotion

Conversation

@Girgias

Copy link
Copy Markdown
Member

As Intl is rather large I think I will split this up into multiple PRs

@Girgias
Girgiasforce-pushed the intl-error-promotion branch 2 times, most recently from c8ff4b1 to e1a1aebCompareJune 22, 2020 13:31
@Girgias
Girgiasforce-pushed the intl-error-promotion branch from e1a1aeb to df9a403CompareJuly 13, 2020 11:46
@Girgias
Girgiasforce-pushed the intl-error-promotion branch from df9a403 to 8c05241CompareJuly 20, 2020 16:53
@Girgias

Copy link
Copy Markdown
MemberAuthor

If there are no objections I'll merge this at the end of the week

@nikicnikic 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.

This looks pretty good, but I think is missing some stub updates for IntlCalendar. E.g. fieldDifference can no longer return false, right?

Comment threadext/intl/calendar/calendar_methods.cpp Outdated
Comment threadext/intl/calendar/calendar_methods.cpp 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.

Should be possible, e.g. via newInstanceWithoutConstructor.

Copy link
Copy Markdown
MemberAuthor

Choose a reason for hiding this comment

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

Ah yeah, does are usually Errors right?

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.

Yeah, we use Error for uninitialized objects.

Comment threadext/intl/calendar/calendar_methods.cpp Outdated
Comment threadext/intl/calendar/calendar_methods.cpp Outdated
@Girgias
Girgiasforce-pushed the intl-error-promotion branch from 8c05241 to 3d2d808CompareJuly 24, 2020 07:49
@Girgias

Copy link
Copy Markdown
MemberAuthor

I promoted a couple more to ValueError, however in regards to the stubs I'm very confused as to why there are two different ones for the calendar proceduaral functions? I thought those were taken care by the aliasing of the Class methods?

@nikic

Copy link
Copy Markdown
Member

Can you please avoid rebasing and amending commits at the same time? This means the whole PR has to be reviewed from scratch every time, because it's not possible to see what changed.

I promoted a couple more to ValueError, however in regards to the stubs I'm very confused as to why there are two different ones for the calendar proceduaral functions? I thought those were taken care by the aliasing of the Class methods?

The @alias only means that the implementation is aliased (FALIAS), the signature is specified separately.

@Girgias

Copy link
Copy Markdown
MemberAuthor

Can you please avoid rebasing and amending commits at the same time? This means the whole PR has to be reviewed from scratch every time, because it's not possible to see what changed.

Okay will do that next time

I promoted a couple more to ValueError, however in regards to the stubs I'm very confused as to why there are two different ones for the calendar proceduaral functions? I thought those were taken care by the aliasing of the Class methods?

The @alias only means that the implementation is aliased (FALIAS), the signature is specified separately.

Ah, understood

@nikicnikic 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.

LGTM

Comment threadext/intl/calendar/gregoriancalendar_methods.cpp Outdated
Comment threadext/intl/calendar/gregoriancalendar_methods.cpp Outdated
@Girgias
Girgiasforce-pushed the intl-error-promotion branch from 3d2d808 to 76ddff9CompareJuly 24, 2020 18:27

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.

I'm not sure the error message this generates will make sense.

Copy link
Copy Markdown
MemberAuthor

Choose a reason for hiding this comment

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

Is this better?

Suggested change
zend_argument_error(NULL, 2, "object is not fully initialized");
zend_argument_error(NULL, 2, "must be constructed");

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.

Or maybe?

Suggested change
zend_argument_error(NULL, 2, "object is not fully initialized");
zend_argument_error(NULL, 2, "is uninitialized");

Copy link
Copy Markdown
MemberAuthor

Choose a reason for hiding this comment

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

That's better :D
Will go with that and merge it directly then. :)

Copy link
Copy Markdown
MemberAuthor

Choose a reason for hiding this comment

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

Actually before I merge it, @nikic should I do that in this PR or just leave the TODO 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.

Looks ok to change.

@Girgias
Girgiasforce-pushed the intl-error-promotion branch from 76ddff9 to ed93fb8CompareJuly 29, 2020 17:09
@Girgias
Girgias deleted the intl-error-promotion branch July 31, 2020 12:30
Sign up for freeto 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

@Girgias@nikic@carusogabriel