Skip to content

Improve type error messages when an object is given#5625

Closed
kocsismate wants to merge 3 commits into
php:masterfrom
kocsismate:type-error-object
Closed

Improve type error messages when an object is given#5625
kocsismate wants to merge 3 commits into
php:masterfrom
kocsismate:type-error-object

Conversation

@kocsismate

@kocsismate kocsismate commented May 25, 2020

Copy link
Copy Markdown
Member

From now on, we always display the given object's type instead of just reporting object. As suggested by Nikita in #5620 (comment)

Additionally, I made the format of return type errors match the format of argument errors. I can revert this change easily if it's not desirable.

@kocsismate kocsismate marked this pull request as draft May 25, 2020 17:34
@kocsismate kocsismate marked this pull request as ready for review May 25, 2020 18:32
Comment thread Zend/zend_API.c Outdated

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

I wasn't exactly sure that I can use zend_zval_type_name() for this purpose (although it seems likely for me) so I introduced this one.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

It seems that phpdbg_info.c remained the only client of zend_zval_type_name() about which I'm not sure if I could use the new semantics.

@nikic nikic May 26, 2020

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 okay with reusing zend_zval_type_name for this and switching that phpdbg use to zend_get_type_by_const.

@kocsismate kocsismate force-pushed the type-error-object branch 3 times, most recently from 597899b to 97ff6ca Compare May 26, 2020 09:45
Additionally, make the format of return type errors match the format of argument errors.
@kocsismate kocsismate force-pushed the type-error-object branch from 97ff6ca to 6425fd0 Compare May 26, 2020 15:16
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.

2 participants