Hi!

https://wiki.php.net/rfc/callable

It is good there's an RFC. However it seems to lack code examples. I understand it may be obvious to the proposers how it looks like, but it'd be nice to have the actual example there as it is done nearly everywhere else.

The patch introduces new zval type IS_CALLABLE but zval functions weren't updated for it - IIRC at least dtor may end up being called on IS_CALLABLE value produced in the parser.

Note also that this pseudo-type is called "callback" in all of our documentation, which means we have now documentation that says:

bool array_walk ( array &$array , callback $funcname [, mixed $userdata ] )

and type check that says "callable".

Also, it is not clear what would happen if this type check is made against method which is not accessible (e.g. private out of scope). Would it say that the argument is invalid (which would be really confusing since it'd say something like "callable expected, array given" which it technically correct but doesn't explain why this array is not callable) or would allow it? If not, then zend_is_callable error information should be used and displayed. And the tests need to cover these cases, along with __call and __callStatic.


For me personally it makes zero sense that having just removed strict typing we are introducing it back through back door, but if everybody likes it so be it.
--
Stanislav Malyshev, Software Architect
SugarCRM: http://www.sugarcrm.com/
(408)454-6900 ext. 227

--
PHP Internals - PHP Runtime Development Mailing List
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to