>> But even here I would rather just take a function instead of requiring >> it to be the instance of some interface: >> >> function sort($input, callable $comparator($a, $b): int) { >> /* … */ >> } > > Fair, but the sorting case isn't the only one that matters, > particularly with <=> now as part of the language.
For completeness: I advocate accepting a comparator in every case where custom comparison logic is needed, not just for sorting. -- PHP Internals - PHP Runtime Development Mailing List To unsubscribe, visit: http://www.php.net/unsub.php