rector/compiler/bin/compile
2020-02-27 14:13:21 +01:00

30 lines
828 B
PHP
Executable File

#!/usr/bin/env php
<?php
declare(strict_types = 1);
use Psr\Container\ContainerInterface;
use Rector\Compiler\Console\RectorCompilerConsoleApplication;
use Rector\Compiler\HttpKernel\RectorCompilerKernel;
require_once __DIR__ . '/../vendor/autoload.php';
final class ContainerFactory
{
public function create(): ContainerInterface
{
$environment = 'prod' . random_int(1, 10000000);
$rectorCompilerKernel = new RectorCompilerKernel($environment, true);
$rectorCompilerKernel->boot();
return $rectorCompilerKernel->getContainer();
}
}
$containerFactory = new ContainerFactory();
$container = $containerFactory->create();
/** @var RectorCompilerConsoleApplication $application */
$application = $container->get(RectorCompilerConsoleApplication::class);
exit($application->run());