Hi!
RE your second patch, from http://ilia.ws/patch/type_hint_53_v2.txt
Some notes on this patch:
- I still think the matter of interfaces and inheritance should be dealt
with (and just comparing hints is not enough, it should be full
LSP-compliant check).
- It looks like you can't have class named "string" anymore, or at least
you can't use it in typehints (you can in 5.3). Same with all other type
names there.
- I see no reflection method that allows to get the type of the
parameter (as opposed to checking if the parameter belongs to a certain
type)
- The patch contains the check that the constant for an optional
parameter is not an object. AFAIK you can't have constant with object
type in PHP. Which also means initializer for any object type can only
be null.
- There seems to be no way to have default value with IS_NUMERIC
typecheck since the check
Z_TYPE(initialization->u.constant) != class_type->u.constant.type
will always fail for IS_NUMERIC - there's no zval carrying type
IS_NUMERIC. Same for IS_SCALAR.
- Also, I'm not sure what would happen there if I have:
function foo(numeric $param = CONSTANT)
and the value of CONSTANT may be not known in the compile-time. Looks
like right now it would just fail since CONSTANT has IS_CONSTANT type.
That would be confusing if you couldn't use constants for default values
with typehints.
- Shuouldn't this:
if (Z_TYPE_P(arg) == cur_arg_info->array_type_hint || Z_TYPE_P(arg) ==
(cur_arg_info->array_type_hint ^ (1<<7))) {
be this:
if (Z_TYPE_P(arg) == (cur_arg_info->array_type_hint & 0x7F)) {
this would be one check instead of two, and the type of argument zval
can't really be FORCE_*, can it?
- Are you sure with FORCE_* argument converting operation shouldn't be
convert_to_*_ex?
--
Stanislav Malyshev, Zend Software Architect
s...@zend.com http://www.zend.com/
(408)253-8829 MSN: s...@zend.com
--
PHP Internals - PHP Runtime Development Mailing List
To unsubscribe, visit: http://www.php.net/unsub.php