Re: __invoke concerns
| From: | Stanislav Malyshev | Date: | Mon, 04 Aug 2008 16:38:15 +0000 |
| Subject: | Re: __invoke concerns | ||
| References: | 1 2 3 | Groups: | php.internals |
| Request: | Send a blank email to internals+get-39633@lists.php.net to get a copy of this message | ||
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 stas@zend.com http://www.zend.com/ (408)253-8829 MSN: stas@zend.com