refactor: comments

This commit is contained in:
Nuno Maduro
2021-10-24 19:37:29 +01:00
parent 2b687a7269
commit 648c6c5a27
32 changed files with 151 additions and 133 deletions

View File

@ -11,7 +11,11 @@ use Symfony\Component\Console\Output\OutputInterface;
*/
final class Help
{
/** @var array<int, string> */
/**
* The Command messages.
*
* @var array<int, string>
*/
private const HELP_MESSAGES = [
'<comment>Pest Options:</comment>',
' <info>--init</info> Initialise a standard Pest configuration',
@ -20,11 +24,17 @@ final class Help
' <info>--group=<fg=cyan><name></></info> Only runs tests from the specified group(s)',
];
/**
* Creates a new Console Command instance.
*/
public function __construct(private OutputInterface $output)
{
// ..
}
/**
* Executes the Console Command.
*/
public function __invoke(): void
{
foreach (self::HELP_MESSAGES as $message) {

View File

@ -1,72 +0,0 @@
<?php
declare(strict_types=1);
namespace Pest\Console;
use Pest\Actions\InteractsWithPlugins;
use Pest\Bootstrappers;
use PHPUnit\TextUI\Application;
/**
* @internal
*/
final class Kernel
{
/**
* The Kernel bootstrappers.
*
* @var array<int, class-string>
*/
private static array $bootstrappers = [
Bootstrappers\BootExceptionHandler::class,
Bootstrappers\BootEmitter::class,
Bootstrappers\BootSubscribers::class,
Bootstrappers\BootFiles::class,
];
/**
* Creates a new Kernel instance.
*/
public function __construct(
private Application $application
) {
// ..
}
/**
* Boots the Kernel.
*/
public static function boot(): self
{
foreach (self::$bootstrappers as $bootstrapper) {
(new $bootstrapper())->__invoke();
}
return new self(new Application());
}
/**
* Handles the given argv.
*
* @param array<int, string> $argv
*/
public function handle(array $argv): int
{
$argv = InteractsWithPlugins::handleArguments($argv);
$result = $this->application->run(
$argv, false,
);
return InteractsWithPlugins::addOutput($result);
}
/**
* Shutdown the Kernel.
*/
public function shutdown(): void
{
// TODO
}
}

View File

@ -14,7 +14,11 @@ use Symfony\Component\Console\Question\ConfirmationQuestion;
*/
final class Thanks
{
/** @var array<int, string> */
/**
* The Command messages.
*
* @var array<int, string>
*/
private const FUNDING_MESSAGES = [
'',
' - Star or contribute to Pest:',
@ -25,13 +29,16 @@ final class Thanks
' <options=bold>https://github.com/sponsors/nunomaduro</>',
];
/**
* Creates a new Console Command instance.
*/
public function __construct(private OutputInterface $output)
{
// ..
}
/**
* Asks the user to support Pest.
* Executes the Console Command.
*/
public function __invoke(): void
{