#!/usr/bin/env php
<?php

declare(strict_types=1);

if (file_exists(__DIR__.'/../../../autoload.php')) {
    require_once __DIR__.'/../../../autoload.php';
} elseif (file_exists(__DIR__.'/../vendor/autoload.php')) {
    require_once __DIR__.'/../vendor/autoload.php';
} else {
    echo 'You must set up the project dependencies, run the following commands:'.\PHP_EOL
        .'curl -s http://getcomposer.org/installer | php'.\PHP_EOL
        .'php composer.phar install'.\PHP_EOL;
    exit(1);
}

use TwigCsFixer\Console\Application;
use TwigCsFixer\Console\Command\TwigCsFixerCommand;

$command = new TwigCsFixerCommand();

$application = new Application();
// Compatibility layer for symfony/console <7.4
if (method_exists($application, 'addCommand')) {
    $application->addCommand($command);
} else {
    $application->add($command);
}
$application->setDefaultCommand($command->getName());
$application->run();
