rfc:invokable

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Next revision
Previous revision
rfc:invokable [2008/08/02 16:11] – created colderrfc:invokable [2017/09/22 13:28] (current) – external edit 127.0.0.1
Line 13: Line 13:
 Currently, there is no sane way to detect whether an object can be invoked or not. What this RFC proposes is an interface that covers %%__invoke()%%: Currently, there is no sane way to detect whether an object can be invoked or not. What this RFC proposes is an interface that covers %%__invoke()%%:
  
 +<code php>
 interface Invokable { interface Invokable {
    public function __invoke($args);    public function __invoke($args);
Line 25: Line 25:
 /* ... */ /* ... */
 } }
 +</code>
 And make $obj(); possible only if the interface is implemented, and not only the method. And make $obj(); possible only if the interface is implemented, and not only the method.
 We have other examples of magic features that are covered by interfaces, like ArrayAccess or Iterator/Traversable. We have other examples of magic features that are covered by interfaces, like ArrayAccess or Iterator/Traversable.
  
rfc/invokable.1217693463.txt.gz · Last modified: 2017/09/22 13:28 (external edit)