mirror of
https://github.com/pestphp/pest.git
synced 2026-03-06 15:57:21 +01:00
Style
This commit is contained in:
@ -65,7 +65,7 @@ final class Configuration
|
||||
*/
|
||||
public function theme(): Configuration\Theme
|
||||
{
|
||||
return new Configuration\Theme();
|
||||
return new Configuration\Theme;
|
||||
}
|
||||
|
||||
/**
|
||||
@ -73,6 +73,6 @@ final class Configuration
|
||||
*/
|
||||
public function context(): Configuration\Context
|
||||
{
|
||||
return new Configuration\Context();
|
||||
return new Configuration\Context;
|
||||
}
|
||||
}
|
||||
|
||||
@ -50,7 +50,7 @@ final class Thanks
|
||||
$wantsToSupport = false;
|
||||
|
||||
if (getenv('PEST_NO_SUPPORT') !== 'true' && $this->input->isInteractive()) {
|
||||
$wantsToSupport = (new SymfonyQuestionHelper())->ask(
|
||||
$wantsToSupport = (new SymfonyQuestionHelper)->ask(
|
||||
new ArrayInput([]),
|
||||
$this->output,
|
||||
new ConfirmationQuestion(
|
||||
|
||||
@ -424,7 +424,7 @@ final class Expectation
|
||||
*/
|
||||
public function any(): Any
|
||||
{
|
||||
return new Any();
|
||||
return new Any;
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@ -28,8 +28,8 @@ trait HigherOrderable
|
||||
*/
|
||||
private function bootHigherOrderable(): void
|
||||
{
|
||||
$this->chains = new HigherOrderMessageCollection();
|
||||
$this->factoryProxies = new HigherOrderMessageCollection();
|
||||
$this->proxies = new HigherOrderMessageCollection();
|
||||
$this->chains = new HigherOrderMessageCollection;
|
||||
$this->factoryProxies = new HigherOrderMessageCollection;
|
||||
$this->proxies = new HigherOrderMessageCollection;
|
||||
}
|
||||
}
|
||||
|
||||
@ -67,7 +67,7 @@ final class Kernel
|
||||
->add(Container::class, $container);
|
||||
|
||||
$kernel = new self(
|
||||
new Application(),
|
||||
new Application,
|
||||
$output,
|
||||
);
|
||||
|
||||
|
||||
@ -42,7 +42,7 @@ final class Converter
|
||||
public function __construct(
|
||||
private readonly string $rootPath,
|
||||
) {
|
||||
$this->stateGenerator = new StateGenerator();
|
||||
$this->stateGenerator = new StateGenerator;
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@ -314,7 +314,7 @@ final class Expectation
|
||||
*
|
||||
* @return self<TValue>
|
||||
*/
|
||||
public function toHaveProperty(string $name, mixed $value = new Any(), string $message = ''): self
|
||||
public function toHaveProperty(string $name, mixed $value = new Any, string $message = ''): self
|
||||
{
|
||||
$this->toBeObject();
|
||||
|
||||
@ -654,7 +654,7 @@ final class Expectation
|
||||
*
|
||||
* @return self<TValue>
|
||||
*/
|
||||
public function toHaveKey(string|int $key, mixed $value = new Any(), string $message = ''): self
|
||||
public function toHaveKey(string|int $key, mixed $value = new Any, string $message = ''): self
|
||||
{
|
||||
if (is_object($this->value) && method_exists($this->value, 'toArray')) {
|
||||
$array = $this->value->toArray();
|
||||
|
||||
@ -42,7 +42,7 @@ final class Panic
|
||||
try {
|
||||
$output = Container::getInstance()->get(OutputInterface::class);
|
||||
} catch (Throwable) { // @phpstan-ignore-line
|
||||
$output = new ConsoleOutput();
|
||||
$output = new ConsoleOutput;
|
||||
}
|
||||
|
||||
assert($output instanceof OutputInterface);
|
||||
|
||||
@ -39,7 +39,7 @@ final class AfterEachCall
|
||||
) {
|
||||
$this->closure = $closure instanceof Closure ? $closure : NullClosure::create();
|
||||
|
||||
$this->proxies = new HigherOrderMessageCollection();
|
||||
$this->proxies = new HigherOrderMessageCollection;
|
||||
|
||||
$this->describing = DescribeCall::describing();
|
||||
}
|
||||
|
||||
@ -47,8 +47,8 @@ final class BeforeEachCall
|
||||
) {
|
||||
$this->closure = $closure instanceof Closure ? $closure : NullClosure::create();
|
||||
|
||||
$this->testCallProxies = new HigherOrderMessageCollection();
|
||||
$this->testCaseProxies = new HigherOrderMessageCollection();
|
||||
$this->testCallProxies = new HigherOrderMessageCollection;
|
||||
$this->testCaseProxies = new HigherOrderMessageCollection;
|
||||
|
||||
$this->describing = DescribeCall::describing();
|
||||
}
|
||||
|
||||
@ -97,7 +97,7 @@ final class TestCall
|
||||
$closure->call($this);
|
||||
};
|
||||
|
||||
new AfterEachCall($this->testSuite, $this->filename, $when->bindTo(new \stdClass()));
|
||||
new AfterEachCall($this->testSuite, $this->filename, $when->bindTo(new \stdClass));
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
@ -53,7 +53,7 @@ final class Configuration implements HandlesArguments, Terminable
|
||||
unlink($path);
|
||||
}
|
||||
|
||||
$doc = new DOMDocument();
|
||||
$doc = new DOMDocument;
|
||||
$doc->load(self::BASE_PHPUNIT_FILE);
|
||||
|
||||
$contents = $doc->saveXML();
|
||||
|
||||
@ -97,7 +97,7 @@ final class Help implements HandlesArguments
|
||||
*/
|
||||
private function getContent(): array
|
||||
{
|
||||
$helpReflection = new PHPUnitHelp();
|
||||
$helpReflection = new PHPUnitHelp;
|
||||
|
||||
$content = (fn (): array => $this->elements())->call($helpReflection);
|
||||
|
||||
|
||||
@ -41,7 +41,7 @@ final class Parallel implements HandlesArguments
|
||||
*/
|
||||
public static function isEnabled(): bool
|
||||
{
|
||||
$argv = new ArgvInput();
|
||||
$argv = new ArgvInput;
|
||||
|
||||
if ($argv->hasParameterOption('--parallel')) {
|
||||
return true;
|
||||
@ -127,7 +127,7 @@ final class Parallel implements HandlesArguments
|
||||
$arguments
|
||||
);
|
||||
|
||||
$exitCode = $this->paratestCommand()->run(new ArgvInput($filteredArguments), new CleanConsoleOutput());
|
||||
$exitCode = $this->paratestCommand()->run(new ArgvInput($filteredArguments), new CleanConsoleOutput);
|
||||
|
||||
return CallsAddsOutput::execute($exitCode);
|
||||
}
|
||||
@ -174,7 +174,7 @@ final class Parallel implements HandlesArguments
|
||||
*/
|
||||
private function hasArgumentsThatWouldBeFasterWithoutParallel(): bool
|
||||
{
|
||||
$arguments = new ArgvInput();
|
||||
$arguments = new ArgvInput;
|
||||
|
||||
foreach (self::UNSUPPORTED_ARGUMENTS as $unsupportedArgument) {
|
||||
if ($arguments->hasParameterOption($unsupportedArgument)) {
|
||||
|
||||
@ -169,7 +169,7 @@ final class ResultPrinter
|
||||
return;
|
||||
}
|
||||
|
||||
$state = (new StateGenerator())->fromPhpUnitTestResult($this->passedTests, $testResult);
|
||||
$state = (new StateGenerator)->fromPhpUnitTestResult($this->passedTests, $testResult);
|
||||
|
||||
$this->compactPrinter->errors($state);
|
||||
$this->compactPrinter->recap($state, $testResult, $duration, $this->options);
|
||||
|
||||
@ -106,13 +106,13 @@ final class WrapperRunner implements RunnerInterface
|
||||
private readonly OutputInterface $output
|
||||
) {
|
||||
$this->printer = new ResultPrinter($output, $options);
|
||||
$this->timer = new Timer();
|
||||
$this->timer = new Timer;
|
||||
|
||||
$wrapper = realpath(
|
||||
dirname(__DIR__, 4).DIRECTORY_SEPARATOR.'bin'.DIRECTORY_SEPARATOR.'worker.php',
|
||||
);
|
||||
assert($wrapper !== false);
|
||||
$phpFinder = new PhpExecutableFinder();
|
||||
$phpFinder = new PhpExecutableFinder;
|
||||
$phpBin = $phpFinder->find(false);
|
||||
assert($phpBin !== false);
|
||||
$parameters = [$phpBin];
|
||||
@ -125,7 +125,7 @@ final class WrapperRunner implements RunnerInterface
|
||||
$parameters[] = $wrapper;
|
||||
|
||||
$this->parameters = $parameters;
|
||||
$this->codeCoverageFilterRegistry = new CodeCoverageFilterRegistry();
|
||||
$this->codeCoverageFilterRegistry = new CodeCoverageFilterRegistry;
|
||||
}
|
||||
|
||||
public function run(): int
|
||||
@ -372,7 +372,7 @@ final class WrapperRunner implements RunnerInterface
|
||||
return;
|
||||
}
|
||||
|
||||
$coverageManager = new CodeCoverage();
|
||||
$coverageManager = new CodeCoverage;
|
||||
$coverageManager->init(
|
||||
$this->options->configuration,
|
||||
$this->codeCoverageFilterRegistry,
|
||||
@ -404,8 +404,8 @@ final class WrapperRunner implements RunnerInterface
|
||||
return;
|
||||
}
|
||||
|
||||
$testSuite = (new LogMerger())->merge($this->junitFiles);
|
||||
(new Writer())->write(
|
||||
$testSuite = (new LogMerger)->merge($this->junitFiles);
|
||||
(new Writer)->write(
|
||||
$testSuite,
|
||||
$this->options->configuration->logfileJunit(),
|
||||
);
|
||||
|
||||
@ -29,7 +29,7 @@ final class Container
|
||||
public static function getInstance(): self
|
||||
{
|
||||
if (! self::$instance instanceof \Pest\Support\Container) {
|
||||
self::$instance = new self();
|
||||
self::$instance = new self;
|
||||
}
|
||||
|
||||
return self::$instance;
|
||||
|
||||
@ -37,7 +37,7 @@ final class Coverage
|
||||
*/
|
||||
public static function isAvailable(): bool
|
||||
{
|
||||
$runtime = new Runtime();
|
||||
$runtime = new Runtime;
|
||||
|
||||
if (! $runtime->canCollectCodeCoverage()) {
|
||||
return false;
|
||||
@ -67,7 +67,7 @@ final class Coverage
|
||||
*/
|
||||
public static function usingXdebug(): bool
|
||||
{
|
||||
return (new Runtime())->hasXdebug();
|
||||
return (new Runtime)->hasXdebug();
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@ -32,7 +32,7 @@ final class Exporter
|
||||
public static function default(): self
|
||||
{
|
||||
return new self(
|
||||
new BaseExporter()
|
||||
new BaseExporter
|
||||
);
|
||||
}
|
||||
|
||||
@ -47,7 +47,7 @@ final class Exporter
|
||||
$array = $data;
|
||||
$itemsCount = 0;
|
||||
$exporter = self::default();
|
||||
$context ??= new Context();
|
||||
$context ??= new Context;
|
||||
|
||||
$context->add($data);
|
||||
|
||||
|
||||
@ -20,7 +20,7 @@ final class StateGenerator
|
||||
{
|
||||
public function fromPhpUnitTestResult(int $passedTests, PHPUnitTestResult $testResult): State
|
||||
{
|
||||
$state = new State();
|
||||
$state = new State;
|
||||
|
||||
foreach ($testResult->testErroredEvents() as $testResultEvent) {
|
||||
if ($testResultEvent instanceof Errored) {
|
||||
|
||||
@ -85,7 +85,7 @@ final class GitDirtyTestCaseFilter implements TestCaseFilter
|
||||
$dirtyFiles = array_values($dirtyFiles);
|
||||
|
||||
if ($dirtyFiles === []) {
|
||||
Panic::with(new NoDirtyTestsFound());
|
||||
Panic::with(new NoDirtyTestsFound);
|
||||
}
|
||||
|
||||
$this->changedFiles = $dirtyFiles;
|
||||
|
||||
@ -71,11 +71,11 @@ final class TestSuite
|
||||
string $rootPath,
|
||||
public string $testPath,
|
||||
) {
|
||||
$this->beforeAll = new BeforeAllRepository();
|
||||
$this->beforeEach = new BeforeEachRepository();
|
||||
$this->tests = new TestRepository();
|
||||
$this->afterEach = new AfterEachRepository();
|
||||
$this->afterAll = new AfterAllRepository();
|
||||
$this->beforeAll = new BeforeAllRepository;
|
||||
$this->beforeEach = new BeforeEachRepository;
|
||||
$this->tests = new TestRepository;
|
||||
$this->afterEach = new AfterEachRepository;
|
||||
$this->afterAll = new AfterAllRepository;
|
||||
$this->rootPath = (string) realpath($rootPath);
|
||||
$this->snapshots = new SnapshotRepository(
|
||||
implode(DIRECTORY_SEPARATOR, [$this->rootPath, $this->testPath]),
|
||||
@ -101,7 +101,7 @@ final class TestSuite
|
||||
}
|
||||
|
||||
if (! self::$instance instanceof self) {
|
||||
Panic::with(new InvalidPestCommand());
|
||||
Panic::with(new InvalidPestCommand);
|
||||
}
|
||||
|
||||
return self::$instance;
|
||||
|
||||
Reference in New Issue
Block a user