mirror of
https://github.com/pestphp/pest.git
synced 2026-03-06 07:47:22 +01:00
Fixes --version and --help
This commit is contained in:
@ -4,6 +4,10 @@ declare(strict_types=1);
|
||||
|
||||
namespace Pest;
|
||||
|
||||
use Pest\Plugins\Actions\CallsAddsOutput;
|
||||
use Pest\Plugins\Actions\CallsBoot;
|
||||
use Pest\Plugins\Actions\CallsShutdown;
|
||||
use Pest\Support\Container;
|
||||
use PHPUnit\TextUI\Application;
|
||||
use PHPUnit\TextUI\Exception;
|
||||
|
||||
@ -21,6 +25,7 @@ final class Kernel
|
||||
Bootstrappers\BootExceptionHandler::class,
|
||||
Bootstrappers\BootSubscribers::class,
|
||||
Bootstrappers\BootFiles::class,
|
||||
Bootstrappers\BootView::class,
|
||||
];
|
||||
|
||||
/**
|
||||
@ -29,7 +34,13 @@ final class Kernel
|
||||
public function __construct(
|
||||
private readonly Application $application
|
||||
) {
|
||||
// ..
|
||||
register_shutdown_function(function (): void {
|
||||
if (error_get_last() !== null) {
|
||||
return;
|
||||
}
|
||||
|
||||
$this->shutdown();
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
@ -38,9 +49,11 @@ final class Kernel
|
||||
public static function boot(): self
|
||||
{
|
||||
foreach (self::BOOTSTRAPPERS as $bootstrapper) {
|
||||
(new $bootstrapper())->__invoke();
|
||||
Container::getInstance()->get($bootstrapper)->__invoke();
|
||||
}
|
||||
|
||||
(new CallsBoot())->__invoke();
|
||||
|
||||
return new self(new Application());
|
||||
}
|
||||
|
||||
@ -53,13 +66,13 @@ final class Kernel
|
||||
*/
|
||||
public function handle(array $argv): int
|
||||
{
|
||||
$argv = (new Plugins\Actions\HandleArguments())->__invoke($argv);
|
||||
$argv = (new Plugins\Actions\CallsHandleArguments())->__invoke($argv);
|
||||
|
||||
$this->application->run(
|
||||
$argv, false,
|
||||
);
|
||||
|
||||
return (new Plugins\Actions\AddsOutput())->__invoke(
|
||||
return (new CallsAddsOutput())->__invoke(
|
||||
Result::exitCode(),
|
||||
);
|
||||
}
|
||||
@ -69,6 +82,6 @@ final class Kernel
|
||||
*/
|
||||
public function shutdown(): void
|
||||
{
|
||||
// ..
|
||||
(new CallsShutdown())->__invoke();
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user