Hi!

I'm not sure I understand what you mean? Either the interface covers
__invoke and "$obj instanceof Invokable" is a safe check to know if we
can $obj();, or it doesn't and we know nothing.

Well, if you put it this way, it's not going to work. However, I thought there's middle ground - i.e. you can mark class as being "invokable" and barring some extremely forgetful programmer not using good tools, that'd mean it's safe to call since it was intended to be called. It's not 100% proof, but it gives you some structure. Note that "safety" is very relative here, since PHP is dynamic - as I explained in topics about typehints, typehint would not exactly make your code "safe" anyway - it would just shift the place where the trouble happens.
--
Stanislav Malyshev, Zend Software Architect
[EMAIL PROTECTED]   http://www.zend.com/
(408)253-8829   MSN: [EMAIL PROTECTED]

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

Reply via email to