Skip to content

Commit

Permalink
chore: style changes
Browse files Browse the repository at this point in the history
  • Loading branch information
nunomaduro committed Aug 2, 2024
1 parent 6a8a4f3 commit 5e41e54
Show file tree
Hide file tree
Showing 57 changed files with 131 additions and 131 deletions.
4 changes: 2 additions & 2 deletions bin/worker.php
Original file line number Diff line number Diff line change
Expand Up @@ -12,15 +12,15 @@
use Symfony\Component\Console\Output\OutputInterface;

$bootPest = (static function (): void {
$workerArgv = new ArgvInput();
$workerArgv = new ArgvInput;

$rootPath = dirname(PHPUNIT_COMPOSER_INSTALL, 2);
$testSuite = TestSuite::getInstance($rootPath, $workerArgv->getParameterOption(
'--test-directory',
'tests'
));

$input = new ArgvInput();
$input = new ArgvInput;

$output = new ConsoleOutput(OutputInterface::VERBOSITY_NORMAL, true);

Expand Down
2 changes: 1 addition & 1 deletion src/Console/Thanks.php
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ public function __invoke(): void
$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(
Expand Down
2 changes: 1 addition & 1 deletion src/Expectation.php
Original file line number Diff line number Diff line change
Expand Up @@ -421,7 +421,7 @@ public static function hasMethod(string $name): bool
*/
public function any(): Any
{
return new Any();
return new Any;
}

/**
Expand Down
6 changes: 3 additions & 3 deletions src/Factories/Concerns/HigherOrderable.php
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}
}
2 changes: 1 addition & 1 deletion src/Factories/TestCaseFactory.php
Original file line number Diff line number Diff line change
Expand Up @@ -154,7 +154,7 @@ public function evaluate(string $filename, array $methods): void
foreach ($classAvailableAttributes as $attribute) {
$classAttributes = array_reduce(
$methods,
fn (array $carry, TestCaseMethodFactory $methodFactory): array => (new $attribute())->__invoke($methodFactory, $carry),
fn (array $carry, TestCaseMethodFactory $methodFactory): array => (new $attribute)->__invoke($methodFactory, $carry),
$classAttributes
);
}
Expand Down
4 changes: 2 additions & 2 deletions src/Factories/TestCaseMethodFactory.php
Original file line number Diff line number Diff line change
Expand Up @@ -138,11 +138,11 @@ public function buildForEvaluation(array $annotationsToUse, array $attributesToU
$attributes = [];

foreach ($annotationsToUse as $annotation) {
$annotations = (new $annotation())->__invoke($this, $annotations);
$annotations = (new $annotation)->__invoke($this, $annotations);
}

foreach ($attributesToUse as $attribute) {
$attributes = (new $attribute())->__invoke($this, $attributes);
$attributes = (new $attribute)->__invoke($this, $attributes);
}

if ($this->datasets !== [] || $this->repetitions > 1) {
Expand Down
2 changes: 1 addition & 1 deletion src/Kernel.php
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@ public static function boot(TestSuite $testSuite, InputInterface $input, OutputI
->add(Container::class, $container);

$kernel = new self(
new Application(),
new Application,
$output,
);

Expand Down
2 changes: 1 addition & 1 deletion src/Logging/Converter.php
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ final class Converter
public function __construct(
private readonly string $rootPath,
) {
$this->stateGenerator = new StateGenerator();
$this->stateGenerator = new StateGenerator;
}

/**
Expand Down
4 changes: 2 additions & 2 deletions src/Mixins/Expectation.php
Original file line number Diff line number Diff line change
Expand Up @@ -314,7 +314,7 @@ public function toHaveSameSize(Countable|iterable $expected, string $message = '
*
* @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();

Expand Down Expand Up @@ -654,7 +654,7 @@ public function toBeNull(string $message = ''): self
*
* @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();
Expand Down
2 changes: 1 addition & 1 deletion src/Panic.php
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ private function handle(): void
try {
$output = Container::getInstance()->get(OutputInterface::class);
} catch (Throwable) { // @phpstan-ignore-line
$output = new ConsoleOutput();
$output = new ConsoleOutput;
}

assert($output instanceof OutputInterface);
Expand Down
2 changes: 1 addition & 1 deletion src/PendingCalls/AfterEachCall.php
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ public function __construct(
) {
$this->closure = $closure instanceof Closure ? $closure : NullClosure::create();

$this->proxies = new HigherOrderMessageCollection();
$this->proxies = new HigherOrderMessageCollection;

$this->describing = DescribeCall::describing();
}
Expand Down
4 changes: 2 additions & 2 deletions src/PendingCalls/BeforeEachCall.php
Original file line number Diff line number Diff line change
Expand Up @@ -44,8 +44,8 @@ public function __construct(
) {
$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();
}
Expand Down
2 changes: 1 addition & 1 deletion src/PendingCalls/TestCall.php
Original file line number Diff line number Diff line change
Expand Up @@ -369,7 +369,7 @@ public function coversFunction(string ...$functions): self
*/
public function coversNothing(): self
{
$this->testCaseMethod->covers = [new CoversNothing()];
$this->testCaseMethod->covers = [new CoversNothing];

return $this;
}
Expand Down
2 changes: 1 addition & 1 deletion src/Plugins/Help.php
Original file line number Diff line number Diff line change
Expand Up @@ -97,7 +97,7 @@ private function colorizeOptions(string $argument): string
*/
private function getContent(): array
{
$helpReflection = new PHPUnitHelp();
$helpReflection = new PHPUnitHelp;

$content = (fn (): array => $this->elements())->call($helpReflection);

Expand Down
6 changes: 3 additions & 3 deletions src/Plugins/Parallel.php
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}
Expand Down Expand Up @@ -126,7 +126,7 @@ private function runTestSuiteInParallel(array $arguments): int
$arguments
);

$exitCode = $this->paratestCommand()->run(new ArgvInput($filteredArguments), new CleanConsoleOutput());
$exitCode = $this->paratestCommand()->run(new ArgvInput($filteredArguments), new CleanConsoleOutput);

return CallsAddsOutput::execute($exitCode);
}
Expand Down Expand Up @@ -173,7 +173,7 @@ private function paratestCommand(): Application
*/
private function hasArgumentsThatWouldBeFasterWithoutParallel(): bool
{
$arguments = new ArgvInput();
$arguments = new ArgvInput;

foreach (self::UNSUPPORTED_ARGUMENTS as $unsupportedArgument) {
if ($arguments->hasParameterOption($unsupportedArgument)) {
Expand Down
2 changes: 1 addition & 1 deletion src/Plugins/Parallel/Paratest/ResultPrinter.php
Original file line number Diff line number Diff line change
Expand Up @@ -169,7 +169,7 @@ public function printResults(TestResult $testResult, array $teamcityFiles, array
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);
Expand Down
12 changes: 6 additions & 6 deletions src/Plugins/Parallel/Paratest/WrapperRunner.php
Original file line number Diff line number Diff line change
Expand Up @@ -91,13 +91,13 @@ public function __construct(
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];
Expand All @@ -110,7 +110,7 @@ public function __construct(
$parameters[] = $wrapper;

$this->parameters = $parameters;
$this->codeCoverageFilterRegistry = new CodeCoverageFilterRegistry();
$this->codeCoverageFilterRegistry = new CodeCoverageFilterRegistry;
}

public function run(): int
Expand Down Expand Up @@ -357,7 +357,7 @@ private function generateCodeCoverageReports(): void
return;
}

$coverageManager = new CodeCoverage();
$coverageManager = new CodeCoverage;
$coverageManager->init(
$this->options->configuration,
$this->codeCoverageFilterRegistry,
Expand Down Expand Up @@ -389,8 +389,8 @@ private function generateLogs(): void
return;
}

$testSuite = (new LogMerger())->merge($this->junitFiles);
(new Writer())->write(
$testSuite = (new LogMerger)->merge($this->junitFiles);
(new Writer)->write(
$testSuite,
$this->options->configuration->logfileJunit(),
);
Expand Down
2 changes: 1 addition & 1 deletion src/Support/Container.php
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,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;
Expand Down
4 changes: 2 additions & 2 deletions src/Support/Coverage.php
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ public static function getPath(): string
*/
public static function isAvailable(): bool
{
$runtime = new Runtime();
$runtime = new Runtime;

if (! $runtime->canCollectCodeCoverage()) {
return false;
Expand Down Expand Up @@ -67,7 +67,7 @@ public static function isAvailable(): bool
*/
public static function usingXdebug(): bool
{
return (new Runtime())->hasXdebug();
return (new Runtime)->hasXdebug();
}

/**
Expand Down
4 changes: 2 additions & 2 deletions src/Support/Exporter.php
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ public function __construct(
public static function default(): self
{
return new self(
new BaseExporter()
new BaseExporter
);
}

Expand All @@ -47,7 +47,7 @@ public function shortenedRecursiveExport(array &$data, ?Context $context = null)
$array = $data;
$itemsCount = 0;
$exporter = self::default();
$context ??= new Context();
$context ??= new Context;

$context->add($data);

Expand Down
2 changes: 1 addition & 1 deletion src/Support/StateGenerator.php
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand Down
2 changes: 1 addition & 1 deletion src/TestCaseFilters/GitDirtyTestCaseFilter.php
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,7 @@ private function loadChangedFiles(): void
$dirtyFiles = array_values($dirtyFiles);

if ($dirtyFiles === []) {
Panic::with(new NoDirtyTestsFound());
Panic::with(new NoDirtyTestsFound);
}

$this->changedFiles = $dirtyFiles;
Expand Down
12 changes: 6 additions & 6 deletions src/TestSuite.php
Original file line number Diff line number Diff line change
Expand Up @@ -71,11 +71,11 @@ public function __construct(
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]),
Expand All @@ -101,7 +101,7 @@ public static function getInstance(
}

if (! self::$instance instanceof self) {
Panic::with(new InvalidPestCommand());
Panic::with(new InvalidPestCommand);
}

return self::$instance;
Expand Down
2 changes: 1 addition & 1 deletion tests/Features/AfterEach.php
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<?php

$state = new stdClass();
$state = new stdClass;

beforeEach(function () use ($state) {
$this->state = $state;
Expand Down
2 changes: 1 addition & 1 deletion tests/Features/BeforeAll.php
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<?php

$foo = new \stdClass();
$foo = new \stdClass;
$foo->bar = 0;

beforeAll(function () use ($foo) {
Expand Down
6 changes: 3 additions & 3 deletions tests/Features/Coverage.php
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
it('has plugin')->assertTrue(class_exists(CoveragePlugin::class));

it('adds coverage if --coverage exist', function () {
$plugin = new CoveragePlugin(new ConsoleOutput());
$plugin = new CoveragePlugin(new ConsoleOutput);

expect($plugin->coverage)->toBeFalse();
$arguments = $plugin->handleArguments([]);
Expand All @@ -20,7 +20,7 @@
})->skip(! \Pest\Support\Coverage::isAvailable() || ! function_exists('xdebug_info') || ! in_array('coverage', xdebug_info('mode'), true), 'Coverage is not available');

it('adds coverage if --min exist', function () {
$plugin = new CoveragePlugin(new ConsoleOutput());
$plugin = new CoveragePlugin(new ConsoleOutput);
expect($plugin->coverageMin)->toEqual(0.0)
->and($plugin->coverage)->toBeFalse();

Expand All @@ -35,7 +35,7 @@
});

it('generates coverage based on file input', function () {
expect(Coverage::getMissingCoverage(new class()
expect(Coverage::getMissingCoverage(new class
{
public function lineCoverageData(): array
{
Expand Down
Loading

0 comments on commit 5e41e54

Please sign in to comment.