A PHP internals mailing list discussion proposing typed closure signatures in PHP, e.g. `Closure(int, string): array`, enforced at type boundaries. The author revisits previously declined and draft RFCs (Callable Prototypes 2016, Structural Typing for Closures 2023, functional interfaces) and argues the feature would catch mismatched callbacks at the call site rather than deep inside operations or only via static analysis. One respondent suggests waiting for generics to make Closure a generic type instead; the author counters that typed closures are a smaller, independent feature that doesn't block or require generics.
63 Impressions