> */ final class FreeUpgradeRegistry { /** * @return list> */ public static function allSteps(): array { return [ Upgrade_3_0_3::class, Upgrade_3_0_5::class, ]; } /** * @return list> */ public static function stepsForHook(string $hook): array { $out = []; foreach (self::allSteps() as $class) { if (in_array($hook, $class::runOnHooks(), true)) { $out[] = $class; } } // version_compare() with two args returns -1 / 0 / 1 — exactly // what usort wants. Passing '<=>' as the operator (legacy mistake) // throws a ValueError under PHP 8+ since '<=>' isn't in the // operator allowlist; pre-PHP 8 it silently returned null and // usort would have produced an unstable ordering anyway. usort($out, static function (string $a, string $b): int { return version_compare($a::targetVersion(), $b::targetVersion()); }); return $out; } }