# yatra/3.0.13/app/Upgrades/FreeUpgradeRegistry.php

Yatra – Travel Booking &amp; Tour Operator Software, version 3.0.13. 57 lines.

- Page: https://pluginprobe.com/plugins/yatra/3.0.13/code/app/Upgrades/FreeUpgradeRegistry.php
- Raw: https://pluginprobe.com/plugins/yatra/3.0.13/raw/app/Upgrades/FreeUpgradeRegistry.php
- Modified: 2026-05-25T04:28:24+00:00

Line numbers below start at 1. Link to a line or a range by appending a fragment to the
page URL, for example `https://pluginprobe.com/plugins/yatra/3.0.13/code/app/Upgrades/FreeUpgradeRegistry.php#L10-L20`.

```php
<?php

declare(strict_types=1);

namespace Yatra\Upgrades;

use Yatra\Upgrades\Contracts\UpgradeStepInterface;
use Yatra\Upgrades\Versions\Upgrade_3_0_3;
use Yatra\Upgrades\Versions\Upgrade_3_0_5;

/**
 * Register Free upgrade steps (add a class per release when DB/data migration is required).
 *
 * Each step’s {@see UpgradeStepInterface::targetVersion()} is the release that introduced the
 * migration (e.g. 3.0.3), not necessarily the current plugin version constant; the runner still applies
 * all applicable steps when upgrading from an older stored `yatra_version` to the current code.
 *
 * @return list<class-string<UpgradeStepInterface>>
 */
final class FreeUpgradeRegistry
{
    /**
     * @return list<class-string<UpgradeStepInterface>>
     */
    public static function allSteps(): array
    {
        return [
            Upgrade_3_0_3::class,
            Upgrade_3_0_5::class,
        ];
    }

    /**
     * @return list<class-string<UpgradeStepInterface>>
     */
    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;
    }
}

```
