This commit is contained in:
Nuno Maduro
2024-07-24 21:54:52 +01:00
parent 101e26749a
commit 45cce6ce93
57 changed files with 131 additions and 131 deletions

View File

@ -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;
}
}

View File

@ -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(

View File

@ -424,7 +424,7 @@ final class Expectation
*/
public function any(): Any
{
return new Any();
return new Any;
}
/**

View File

@ -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;
}
}

View File

@ -67,7 +67,7 @@ final class Kernel
->add(Container::class, $container);
$kernel = new self(
new Application(),
new Application,
$output,
);

View File

@ -42,7 +42,7 @@ final class Converter
public function __construct(
private readonly string $rootPath,
) {
$this->stateGenerator = new StateGenerator();
$this->stateGenerator = new StateGenerator;
}
/**

View File

@ -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();

View File

@ -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);

View File

@ -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();
}

View File

@ -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();
}

View File

@ -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;
}

View File

@ -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();

View File

@ -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);

View File

@ -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)) {

View File

@ -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);

View File

@ -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(),
);

View File

@ -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;

View File

@ -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();
}
/**

View File

@ -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);

View File

@ -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) {

View File

@ -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;

View File

@ -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;