Hi Osama, > The syntax collides at the lexer. `Closure(int): array` can't be tokenized > cleanly, because `(int)` is a cast token (same for `(string)`, `(array)`, and > so on). > It's been that way for years, and the one attempt to fix it (PR > https://github.com/php/php-src/pull/1667) was rejected as a token-stream BC > break. > So the natural spelling is, unfortunately, the engine-hostile one.
This is fixable, it's not a real limitation. > There's a single `Closure` class (Ilija's point here: > https://externals.io/message/120083#120099), so `Closure(int, string): array` > isn't a subtype you can instanceof... > it has to be checked another way at the boundary, which is where the usual > per-boundary runtime-cost concern comes in. I agree on this, I think the `fn` keyword should be used here.
