I've been waiting so long for this day. Finally arrow functions in PHP! Until now it was extremely cumbersome to use higher-order functions such as array_map() or usort() . This is especially true if you're a full stack developer who frequently switches between PHP and JavaScript which has had support for arrow functions for a long time. The hitherto existing anonymous functions are so verbose and it's a real pain to bind all closure variables manually.
AFAIK, they're just laravel collections - it's (I believe) a separate package you can install which doesn't necessarily have anything to do with laravel eloquent directly. The collections package I'm thinking of might be an unofficial port/extraction of laravel collection stuff. my brother has, I think, started using these in non-laravel projects because he likes the syntax.
Fair, but seems inconsistent to have `fn` instead of `function` like we use for anonymous functions - unless `fn` acts like an alias to `function` now (which doesn't sound like is the case) which wouldn't be as ambiguous for the compiler to figure out
I don't think there's an ambiguity, since the key-value application of that operator only happens inside the array definition or when you do foreach ($x as $k => $v) {}.