class Person {
public function __construct(private string $name) { }
public function name(): string { return $this->name; }
}
$group= [new Person('Timm'), new Person('Alex')];
// Instead of the following:
$names= array_map(fn($person) => $person->name(), $group);
// ...we can now write this:
$names= array_map(Person->name(...), $group);
// ["Timm", "Alex"]
Inspired by https://externals.io/message/120011