rfc:callable-interfaces

Differences

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

Link to this comparison view

Both sides previous revisionPrevious revision
Next revision
Previous revision
Next revisionBoth sides next revision
rfc:callable-interfaces [2016/04/06 11:44] – Adding case when an interface may not be callable ocramiusrfc:callable-interfaces [2016/04/06 12:00] ocramius
Line 108: Line 108:
     passParameter($callable);     passParameter($callable);
 } }
 +</code>
 +
 +===== Still Open for Discussion =====
 +
 +How will **instanceof** behave, when asked for a type-check against **callable**?
 +
 +<code php>
 +interface RegisterUser {
 +    public function __invoke(Username $username) : UserRegistration;
 +}
 +
 +interface DeleteUserRegistration {
 +    public function __invoke(Username $username) : UserRegistration;
 +}
 +
 +$register = function (Username $username) : UserRegistration {
 +    return new UserRegistration(...);
 +};
 +
 +var_dump($register instanceof DeleteUserRegistration); // true? false? possibly want to keep current semantics here.
 </code> </code>
  
rfc/callable-interfaces.txt · Last modified: 2017/09/22 13:28 by 127.0.0.1