ext/date arguments handling
| From: | Florian Margaine | Date: | Sun, 21 Sep 2014 09:58:54 +0000 |
| Subject: | ext/date arguments handling | ||
| Groups: | php.internals | ||
| Request: | Send a blank email to internals+get-77412@lists.php.net to get a copy of this message | ||
Hi list,
I specifically mean to ask @derick about this issue I'm having, since he is
the maintainer of ext/date.
I wrote this pull request for the DateTimeZone::getOffset method to accept
a DateTimeInterface instead of a DateTime object:
https://github.com/php/php-src/pull/831
Instead of using ZEND_ARG_INFO, I use ZEND_ARG_OBJ_INFO rather than relying
on zpp only. It makes the code consistent with the type hinting errors that
should arise, and also gives a correct reflection.
However, the rest of the code in this extension uses ZEND_ARG_INFO, only
throwing warnings when the arguments are not of the right kind.
Should I use ZEND_ARG_INFO and rely on zpp's warning, or should I use
ZEND_ARG_OBJ_INFO, and eventually translate the other methods to use it
too? This'd be out of this PR of course, but it makes sense to streamline
the methods of ext/date.
In my opinion, using ZEND_ARG_OBJ_INFO means that we're going to the right
direction: fixing the type hints and the reflection of the classes.
The PR could be backported to 5.* by using ZEND_ARG_INFO to avoid BC breaks.
Regards,
*Florian Margaine*