rfc:allow_casting_closures_into_single-method_interface_implementations

Differences

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

Link to this comparison view

Both sides previous revisionPrevious revision
rfc:allow_casting_closures_into_single-method_interface_implementations [2023/04/25 19:34] nicolasgrekasrfc:allow_casting_closures_into_single-method_interface_implementations [2023/04/25 19:36] (current) nicolasgrekas
Line 168: Line 168:
  
 In this example, an ''UriExpanderInterface'' is defined with an <php>expand()</php> method. In this example, an ''UriExpanderInterface'' is defined with an <php>expand()</php> method.
- 
 3 different implementations of the interface are derived using the <php>castTo()</php> method. 3 different implementations of the interface are derived using the <php>castTo()</php> method.
- 
 Finally, the <php>getExpandedUrl()</php> function is defined, which accepts an implementation of Finally, the <php>getExpandedUrl()</php> function is defined, which accepts an implementation of
 <php>UriExpanderInterface</php> and expands a URI template using the provided implementation. <php>UriExpanderInterface</php> and expands a URI template using the provided implementation.
rfc/allow_casting_closures_into_single-method_interface_implementations.1682451268.txt.gz · Last modified: 2023/04/25 19:34 by nicolasgrekas