rfc:allow_casting_closures_into_single-method_interface_implementations
Differences
This shows you the differences between two versions of the page.
Both sides previous revisionPrevious revisionNext revision | Previous revision | ||
rfc:allow_casting_closures_into_single-method_interface_implementations [2023/04/25 19:32] – nicolasgrekas | rfc:allow_casting_closures_into_single-method_interface_implementations [2023/04/25 19:36] (current) – nicolasgrekas | ||
---|---|---|---|
Line 90: | Line 90: | ||
<code php> | <code php> | ||
- | function executeOperation(Closure $operation, int $a, int $b): int { | + | function executeOperation(Closure $operator, int $a, int $b): int { |
- | return $operation($a, $b); | + | return $operator($a, $b); |
} | } | ||
</ | </ | ||
Line 102: | Line 102: | ||
} | } | ||
- | function executeOperation(InvokableInterface | + | function executeOperation(OperatorInterface |
- | return $operation($a, $b); | + | return $operator($a, $b); |
} | } | ||
Line 168: | Line 168: | ||
In this example, an '' | In this example, an '' | ||
- | |||
3 different implementations of the interface are derived using the < | 3 different implementations of the interface are derived using the < | ||
- | |||
Finally, the < | Finally, the < | ||
< | < |
rfc/allow_casting_closures_into_single-method_interface_implementations.1682451154.txt.gz · Last modified: 2023/04/25 19:32 by nicolasgrekas