HEX
Server: Apache
System: Linux WWW 6.1.0-40-amd64 #1 SMP PREEMPT_DYNAMIC Debian 6.1.153-1 (2025-09-20) x86_64
User: web11 (1011)
PHP: 8.2.29
Disabled: NONE
Upload Files
File: /var/www/payments-gateway/vendor/doctrine/migrations/src/Tools/Console/Command/LatestCommand.php
<?php

declare(strict_types=1);

namespace Doctrine\Migrations\Tools\Console\Command;

use Doctrine\Migrations\Exception\NoMigrationsToExecute;
use Symfony\Component\Console\Attribute\AsCommand;
use Symfony\Component\Console\Input\InputInterface;
use Symfony\Component\Console\Output\OutputInterface;

use function sprintf;

/**
 * The LatestCommand class is responsible for outputting what your latest version is.
 */
#[AsCommand(name: 'migrations:latest', description: 'Outputs the latest version')]
final class LatestCommand extends DoctrineCommand
{
    /** @var string|null */
    protected static $defaultName = 'migrations:latest';

    protected function configure(): void
    {
        $this
            ->setAliases(['latest'])
            ->setDescription('Outputs the latest version');

        parent::configure();
    }

    protected function execute(InputInterface $input, OutputInterface $output): int
    {
        $aliasResolver = $this->getDependencyFactory()->getVersionAliasResolver();

        try {
            $version            = $aliasResolver->resolveVersionAlias('latest');
            $availableMigration = $this->getDependencyFactory()->getMigrationRepository()->getMigration($version);
            $description        = $availableMigration->getMigration()->getDescription();
        } catch (NoMigrationsToExecute) {
            $version     = '0';
            $description = '';
        }

        $this->io->text(sprintf(
            "<info>%s</info>%s\n",
            $version,
            $description !== '' ? ' - ' . $description : '',
        ));

        return 0;
    }
}