usort($descriptors, function (AbstractDescriptor $a, AbstractDescriptor $b): int {
$order = ['semantic' => 0, 'safe' => 1, 'unsafe' => 2, 'idempotent' => 3];
return $order[$a->type] <=> $order[$b->type]; // sort by type
});
Last active
November 4, 2020 10:51
-
-
Save koriym/5a02cd11ff43adf839a8c92cd66f50c2 to your computer and use it in GitHub Desktop.
PHP spaceship operator example
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment