diff --git a/bin/worker.php b/bin/worker.php index bc29fa44..9ee168d4 100644 --- a/bin/worker.php +++ b/bin/worker.php @@ -12,7 +12,7 @@ use Symfony\Component\Console\Output\ConsoleOutput; 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( @@ -20,7 +20,7 @@ $bootPest = (static function (): void { 'tests' )); - $input = new ArgvInput(); + $input = new ArgvInput; $output = new ConsoleOutput(OutputInterface::VERBOSITY_NORMAL, true); diff --git a/src/Console/Thanks.php b/src/Console/Thanks.php index f033bc6f..c791a830 100644 --- a/src/Console/Thanks.php +++ b/src/Console/Thanks.php @@ -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( diff --git a/src/Expectation.php b/src/Expectation.php index 2b2fde8a..42baf54e 100644 --- a/src/Expectation.php +++ b/src/Expectation.php @@ -421,7 +421,7 @@ final class Expectation */ public function any(): Any { - return new Any(); + return new Any; } /** diff --git a/src/Factories/Concerns/HigherOrderable.php b/src/Factories/Concerns/HigherOrderable.php index 94d425b4..1ef07b4e 100644 --- a/src/Factories/Concerns/HigherOrderable.php +++ b/src/Factories/Concerns/HigherOrderable.php @@ -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; } } diff --git a/src/Factories/TestCaseFactory.php b/src/Factories/TestCaseFactory.php index c7fd35f5..4bdb2f07 100644 --- a/src/Factories/TestCaseFactory.php +++ b/src/Factories/TestCaseFactory.php @@ -154,7 +154,7 @@ final class TestCaseFactory 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 ); } diff --git a/src/Factories/TestCaseMethodFactory.php b/src/Factories/TestCaseMethodFactory.php index 341ec902..90d15a15 100644 --- a/src/Factories/TestCaseMethodFactory.php +++ b/src/Factories/TestCaseMethodFactory.php @@ -138,11 +138,11 @@ final class TestCaseMethodFactory $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) { diff --git a/src/Kernel.php b/src/Kernel.php index b8683a20..d1eb7546 100644 --- a/src/Kernel.php +++ b/src/Kernel.php @@ -67,7 +67,7 @@ final class Kernel ->add(Container::class, $container); $kernel = new self( - new Application(), + new Application, $output, ); diff --git a/src/Logging/Converter.php b/src/Logging/Converter.php index 7cbf8f12..b4bc9e70 100644 --- a/src/Logging/Converter.php +++ b/src/Logging/Converter.php @@ -36,7 +36,7 @@ final class Converter public function __construct( private readonly string $rootPath, ) { - $this->stateGenerator = new StateGenerator(); + $this->stateGenerator = new StateGenerator; } /** diff --git a/src/Mixins/Expectation.php b/src/Mixins/Expectation.php index ffaeea30..e61751cc 100644 --- a/src/Mixins/Expectation.php +++ b/src/Mixins/Expectation.php @@ -314,7 +314,7 @@ final class Expectation * * @return self */ - 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 */ - 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(); diff --git a/src/Panic.php b/src/Panic.php index 6d6ae1f8..592634c0 100644 --- a/src/Panic.php +++ b/src/Panic.php @@ -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); diff --git a/src/PendingCalls/AfterEachCall.php b/src/PendingCalls/AfterEachCall.php index a20157e9..b9b9662b 100644 --- a/src/PendingCalls/AfterEachCall.php +++ b/src/PendingCalls/AfterEachCall.php @@ -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(); } diff --git a/src/PendingCalls/BeforeEachCall.php b/src/PendingCalls/BeforeEachCall.php index 2be5510d..f89deb3c 100644 --- a/src/PendingCalls/BeforeEachCall.php +++ b/src/PendingCalls/BeforeEachCall.php @@ -44,8 +44,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(); } diff --git a/src/PendingCalls/TestCall.php b/src/PendingCalls/TestCall.php index d9a76d55..661a1dc7 100644 --- a/src/PendingCalls/TestCall.php +++ b/src/PendingCalls/TestCall.php @@ -369,7 +369,7 @@ final class TestCall */ public function coversNothing(): self { - $this->testCaseMethod->covers = [new CoversNothing()]; + $this->testCaseMethod->covers = [new CoversNothing]; return $this; } diff --git a/src/Plugins/Help.php b/src/Plugins/Help.php index 205610f0..90702da9 100644 --- a/src/Plugins/Help.php +++ b/src/Plugins/Help.php @@ -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); diff --git a/src/Plugins/Parallel.php b/src/Plugins/Parallel.php index 3c906522..027570d6 100644 --- a/src/Plugins/Parallel.php +++ b/src/Plugins/Parallel.php @@ -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; } @@ -126,7 +126,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); } @@ -173,7 +173,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)) { diff --git a/src/Plugins/Parallel/Paratest/ResultPrinter.php b/src/Plugins/Parallel/Paratest/ResultPrinter.php index 16a211f2..bd416e1e 100644 --- a/src/Plugins/Parallel/Paratest/ResultPrinter.php +++ b/src/Plugins/Parallel/Paratest/ResultPrinter.php @@ -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); diff --git a/src/Plugins/Parallel/Paratest/WrapperRunner.php b/src/Plugins/Parallel/Paratest/WrapperRunner.php index b0dc5232..61755bac 100644 --- a/src/Plugins/Parallel/Paratest/WrapperRunner.php +++ b/src/Plugins/Parallel/Paratest/WrapperRunner.php @@ -91,13 +91,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]; @@ -110,7 +110,7 @@ final class WrapperRunner implements RunnerInterface $parameters[] = $wrapper; $this->parameters = $parameters; - $this->codeCoverageFilterRegistry = new CodeCoverageFilterRegistry(); + $this->codeCoverageFilterRegistry = new CodeCoverageFilterRegistry; } public function run(): int @@ -357,7 +357,7 @@ final class WrapperRunner implements RunnerInterface return; } - $coverageManager = new CodeCoverage(); + $coverageManager = new CodeCoverage; $coverageManager->init( $this->options->configuration, $this->codeCoverageFilterRegistry, @@ -389,8 +389,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(), ); diff --git a/src/Support/Container.php b/src/Support/Container.php index b780fd72..da59905b 100644 --- a/src/Support/Container.php +++ b/src/Support/Container.php @@ -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; diff --git a/src/Support/Coverage.php b/src/Support/Coverage.php index e0794522..b3bb4ee3 100644 --- a/src/Support/Coverage.php +++ b/src/Support/Coverage.php @@ -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(); } /** diff --git a/src/Support/Exporter.php b/src/Support/Exporter.php index d653fc02..58206e7f 100644 --- a/src/Support/Exporter.php +++ b/src/Support/Exporter.php @@ -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); diff --git a/src/Support/StateGenerator.php b/src/Support/StateGenerator.php index cfaea382..90636d9d 100644 --- a/src/Support/StateGenerator.php +++ b/src/Support/StateGenerator.php @@ -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) { diff --git a/src/TestCaseFilters/GitDirtyTestCaseFilter.php b/src/TestCaseFilters/GitDirtyTestCaseFilter.php index a4620a91..371f0670 100644 --- a/src/TestCaseFilters/GitDirtyTestCaseFilter.php +++ b/src/TestCaseFilters/GitDirtyTestCaseFilter.php @@ -76,7 +76,7 @@ final class GitDirtyTestCaseFilter implements TestCaseFilter $dirtyFiles = array_values($dirtyFiles); if ($dirtyFiles === []) { - Panic::with(new NoDirtyTestsFound()); + Panic::with(new NoDirtyTestsFound); } $this->changedFiles = $dirtyFiles; diff --git a/src/TestSuite.php b/src/TestSuite.php index 496eb0ce..ca35a040 100644 --- a/src/TestSuite.php +++ b/src/TestSuite.php @@ -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; diff --git a/tests/Features/AfterEach.php b/tests/Features/AfterEach.php index 47d1fb60..217eaf8d 100644 --- a/tests/Features/AfterEach.php +++ b/tests/Features/AfterEach.php @@ -1,6 +1,6 @@ state = $state; diff --git a/tests/Features/BeforeAll.php b/tests/Features/BeforeAll.php index 860d704e..81f0f272 100644 --- a/tests/Features/BeforeAll.php +++ b/tests/Features/BeforeAll.php @@ -1,6 +1,6 @@ bar = 0; beforeAll(function () use ($foo) { diff --git a/tests/Features/Coverage.php b/tests/Features/Coverage.php index 77912e63..974568e6 100644 --- a/tests/Features/Coverage.php +++ b/tests/Features/Coverage.php @@ -7,7 +7,7 @@ use Symfony\Component\Console\Output\ConsoleOutput; 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([]); @@ -20,7 +20,7 @@ it('adds coverage if --coverage exist', function () { })->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(); @@ -35,7 +35,7 @@ it('adds coverage if --min exist', function () { }); it('generates coverage based on file input', function () { - expect(Coverage::getMissingCoverage(new class() + expect(Coverage::getMissingCoverage(new class { public function lineCoverageData(): array { diff --git a/tests/Features/DatasetsTests.php b/tests/Features/DatasetsTests.php index 7d209c40..31bb26c0 100644 --- a/tests/Features/DatasetsTests.php +++ b/tests/Features/DatasetsTests.php @@ -46,7 +46,7 @@ test('it truncates the description', function () { // it gets tested by the integration test })->with([str_repeat('Fooo', 10)]); -$state = new stdClass(); +$state = new stdClass; $state->text = ''; $datasets = [[1], [2]]; @@ -119,7 +119,7 @@ class Bar } $namedDatasets = [ - new Bar(), + new Bar, ]; test('lazy named datasets', function ($text) { @@ -132,12 +132,12 @@ it('creates unique test case names', function (string $name, Plugin $plugin, boo expect(true)->toBeTrue(); $counter++; })->with([ - ['Name 1', new Plugin(), true], - ['Name 1', new Plugin(), true], - ['Name 1', new Plugin(), false], - ['Name 2', new Plugin(), false], - ['Name 2', new Plugin(), true], - ['Name 1', new Plugin(), true], + ['Name 1', new Plugin, true], + ['Name 1', new Plugin, true], + ['Name 1', new Plugin, false], + ['Name 2', new Plugin, false], + ['Name 2', new Plugin, true], + ['Name 1', new Plugin, true], ]); it('creates unique test case names - count', function () use (&$counter) { @@ -230,7 +230,7 @@ test('more than two datasets did the job right', function () use ($state) { expect($state->text)->toBe('121212121212131423241314232411122122111221221112212213142324135136145146235236245246'); }); -$wrapped_generator_state = new stdClass(); +$wrapped_generator_state = new stdClass; $wrapped_generator_state->text = ''; $wrapped_generator_function_datasets = [1, 2, 3, 4]; diff --git a/tests/Features/Exceptions.php b/tests/Features/Exceptions.php index a2f942f3..97a2d664 100644 --- a/tests/Features/Exceptions.php +++ b/tests/Features/Exceptions.php @@ -3,7 +3,7 @@ it('gives access the the underlying expectException', function () { $this->expectException(InvalidArgumentException::class); - throw new InvalidArgumentException(); + throw new InvalidArgumentException; }); it('catch exceptions', function () { diff --git a/tests/Features/Expect/HigherOrder/methods.php b/tests/Features/Expect/HigherOrder/methods.php index ee3157b7..5e693ea9 100644 --- a/tests/Features/Expect/HigherOrder/methods.php +++ b/tests/Features/Expect/HigherOrder/methods.php @@ -1,29 +1,29 @@ name()->toBeString()->toEqual('Has Methods'); }); it('can access multiple methods', function () { - expect(new HasMethods()) + expect(new HasMethods) ->name()->toBeString()->toEqual('Has Methods') ->quantity()->toBeInt()->toEqual(20); }); it('works with not', function () { - expect(new HasMethods()) + expect(new HasMethods) ->name()->not->toEqual('world')->toEqual('Has Methods') ->quantity()->toEqual(20)->not()->toEqual('bar')->not->toBeNull; }); it('can accept arguments', function () { - expect(new HasMethods()) + expect(new HasMethods) ->multiply(5, 4)->toBeInt->toEqual(20); }); it('works with each', function () { - expect(new HasMethods()) + expect(new HasMethods) ->attributes()->toBeArray->each->not()->toBeNull ->attributes()->each(function ($attribute) { $attribute->not->toBeNull(); @@ -31,14 +31,14 @@ it('works with each', function () { }); it('works inside of each', function () { - expect(new HasMethods()) + expect(new HasMethods) ->books()->each(function ($book) { $book->title->not->toBeNull->cost->toBeGreaterThan(19); }); }); it('works with sequence', function () { - expect(new HasMethods()) + expect(new HasMethods) ->books()->sequence( function ($book) { $book->title->toEqual('Foo')->cost->toEqual(20); @@ -50,7 +50,7 @@ it('works with sequence', function () { }); it('can compose complex expectations', function () { - expect(new HasMethods()) + expect(new HasMethods) ->toBeObject() ->name()->toEqual('Has Methods')->not()->toEqual('bar') ->quantity()->not->toEqual('world')->toEqual(20)->toBeInt @@ -68,7 +68,7 @@ it('can compose complex expectations', function () { }); it('can handle nested method calls', function () { - expect(new HasMethods()) + expect(new HasMethods) ->newInstance()->newInstance()->name()->toEqual('Has Methods')->toBeString() ->newInstance()->name()->toEqual('Has Methods')->not->toBeInt ->name()->toEqual('Has Methods') @@ -76,14 +76,14 @@ it('can handle nested method calls', function () { }); it('works with higher order tests') - ->expect(new HasMethods()) + ->expect(new HasMethods) ->newInstance()->newInstance()->name()->toEqual('Has Methods')->toBeString() ->newInstance()->name()->toEqual('Has Methods')->not->toBeArray ->name()->toEqual('Has Methods') ->books()->each->toBeArray; it('can use the scoped method to lock into the given level for expectations', function () { - expect(new HasMethods()) + expect(new HasMethods) ->attributes()->scoped(fn ($attributes) => $attributes ->name->toBe('Has Methods') ->quantity->toBe(20) @@ -100,7 +100,7 @@ it('can use the scoped method to lock into the given level for expectations', fu }); it('works consistently with the json expectation method', function () { - expect(new HasMethods()) + expect(new HasMethods) ->jsonString()->json()->id->toBe(1) ->jsonString()->json()->name->toBe('Has Methods')->toBeString() ->jsonString()->json()->quantity->toBe(20)->toBeInt(); @@ -152,6 +152,6 @@ class HasMethods public function newInstance() { - return new static(); + return new static; } } diff --git a/tests/Features/Expect/HigherOrder/methodsAndProperties.php b/tests/Features/Expect/HigherOrder/methodsAndProperties.php index 61ab58e4..0babb360 100644 --- a/tests/Features/Expect/HigherOrder/methodsAndProperties.php +++ b/tests/Features/Expect/HigherOrder/methodsAndProperties.php @@ -1,7 +1,7 @@ name->toEqual('Has Methods and Properties')->not()->toEqual('bar') ->multiply(3, 4)->not->toBeString->toEqual(12) ->posts->each(function ($post) { @@ -19,7 +19,7 @@ it('can access methods and properties', function () { }); it('can handle nested methods and properties', function () { - expect(new HasMethodsAndProperties()) + expect(new HasMethodsAndProperties) ->meta->foo->bar->toBeString()->toEqual('baz')->not->toBeInt ->newInstance()->meta->foo->toBeArray() ->newInstance()->multiply(2, 2)->toEqual(4)->not->toEqual(5) @@ -27,14 +27,14 @@ it('can handle nested methods and properties', function () { }); it('works with higher order tests') - ->expect(new HasMethodsAndProperties()) + ->expect(new HasMethodsAndProperties) ->meta->foo->bar->toBeString()->toEqual('baz')->not->toBeInt ->newInstance()->meta->foo->toBeArray ->newInstance()->multiply(2, 2)->toEqual(4)->not->toEqual(5) ->newInstance()->books()->toBeArray(); it('can start a new higher order expectation using the and syntax', function () { - expect(new HasMethodsAndProperties()) + expect(new HasMethodsAndProperties) ->toBeInstanceOf(HasMethodsAndProperties::class) ->meta->toBeArray ->and(['foo' => 'bar']) @@ -45,7 +45,7 @@ it('can start a new higher order expectation using the and syntax', function () }); it('can start a new higher order expectation using the and syntax in higher order tests') - ->expect(new HasMethodsAndProperties()) + ->expect(new HasMethodsAndProperties) ->toBeInstanceOf(HasMethodsAndProperties::class) ->meta->toBeArray ->and(['foo' => 'bar']) @@ -53,7 +53,7 @@ it('can start a new higher order expectation using the and syntax in higher orde ->foo->toEqual('bar'); it('can start a new higher order expectation using the and syntax without nesting expectations', function () { - expect(new HasMethodsAndProperties()) + expect(new HasMethodsAndProperties) ->toBeInstanceOf(HasMethodsAndProperties::class) ->meta ->sequence( @@ -101,6 +101,6 @@ class HasMethodsAndProperties public function newInstance() { - return new static(); + return new static; } } diff --git a/tests/Features/Expect/HigherOrder/properties.php b/tests/Features/Expect/HigherOrder/properties.php index 016b1c4f..a8b6674e 100644 --- a/tests/Features/Expect/HigherOrder/properties.php +++ b/tests/Features/Expect/HigherOrder/properties.php @@ -53,7 +53,7 @@ it('can compose complex expectations', function () { }); it('works with objects', function () { - expect(new HasProperties()) + expect(new HasProperties) ->name->toEqual('foo')->not->toEqual('world') ->posts->toHaveCount(2)->each(function ($post) { $post->is_published->toBeTrue(); @@ -69,13 +69,13 @@ it('works with objects', function () { }); it('works with nested properties', function () { - expect(new HasProperties()) + expect(new HasProperties) ->nested->foo->bar->toBeString()->toEqual('baz') ->posts->toBeArray()->toHaveCount(2); }); it('works with higher order tests') - ->expect(new HasProperties()) + ->expect(new HasProperties) ->nested->foo->bar->toBeString()->toEqual('baz') ->posts->toBeArray()->toHaveCount(2); diff --git a/tests/Features/Expect/pipes.php b/tests/Features/Expect/pipes.php index 5a99b5f6..13640304 100644 --- a/tests/Features/Expect/pipes.php +++ b/tests/Features/Expect/pipes.php @@ -56,7 +56,7 @@ class State } } -$state = new State(); +$state = new State; /* * Overrides toBe to assert two Characters are the same diff --git a/tests/Features/Expect/toBe.php b/tests/Features/Expect/toBe.php index 87adef9f..ebb0f42b 100644 --- a/tests/Features/Expect/toBe.php +++ b/tests/Features/Expect/toBe.php @@ -5,8 +5,8 @@ use PHPUnit\Framework\ExpectationFailedException; expect(true)->toBeTrue()->and(false)->toBeFalse(); test('strict comparisons', function () { - $nuno = new stdClass(); - $dries = new stdClass(); + $nuno = new stdClass; + $dries = new stdClass; expect($nuno)->toBe($nuno)->not->toBe($dries); }); diff --git a/tests/Features/Expect/toBeGreaterThan.php b/tests/Features/Expect/toBeGreaterThan.php index f59c6628..6c3e8cb4 100644 --- a/tests/Features/Expect/toBeGreaterThan.php +++ b/tests/Features/Expect/toBeGreaterThan.php @@ -8,8 +8,8 @@ test('passes', function () { }); test('passes with DateTime and DateTimeImmutable', function () { - $now = new DateTime(); - $past = (new DateTimeImmutable())->modify('-1 day'); + $now = new DateTime; + $past = (new DateTimeImmutable)->modify('-1 day'); expect($now)->toBeGreaterThan($past); diff --git a/tests/Features/Expect/toBeGreaterThanOrEqual.php b/tests/Features/Expect/toBeGreaterThanOrEqual.php index 52aa3b18..9db7e351 100644 --- a/tests/Features/Expect/toBeGreaterThanOrEqual.php +++ b/tests/Features/Expect/toBeGreaterThanOrEqual.php @@ -8,8 +8,8 @@ test('passes', function () { }); test('passes with DateTime and DateTimeImmutable', function () { - $now = new DateTime(); - $past = (new DateTimeImmutable())->modify('-1 day'); + $now = new DateTime; + $past = (new DateTimeImmutable)->modify('-1 day'); expect($now)->toBeGreaterThanOrEqual($now); diff --git a/tests/Features/Expect/toBeInstanceOf.php b/tests/Features/Expect/toBeInstanceOf.php index 5c4e3e11..186129f1 100644 --- a/tests/Features/Expect/toBeInstanceOf.php +++ b/tests/Features/Expect/toBeInstanceOf.php @@ -3,18 +3,18 @@ use PHPUnit\Framework\ExpectationFailedException; test('pass', function () { - expect(new Exception())->toBeInstanceOf(Exception::class); - expect(new Exception())->not->toBeInstanceOf(RuntimeException::class); + expect(new Exception)->toBeInstanceOf(Exception::class); + expect(new Exception)->not->toBeInstanceOf(RuntimeException::class); }); test('failures', function () { - expect(new Exception())->toBeInstanceOf(RuntimeException::class); + expect(new Exception)->toBeInstanceOf(RuntimeException::class); })->throws(ExpectationFailedException::class); test('failures with custom message', function () { - expect(new Exception())->toBeInstanceOf(RuntimeException::class, 'oh no!'); + expect(new Exception)->toBeInstanceOf(RuntimeException::class, 'oh no!'); })->throws(ExpectationFailedException::class, 'oh no!'); test('not failures', function () { - expect(new Exception())->not->toBeInstanceOf(Exception::class); + expect(new Exception)->not->toBeInstanceOf(Exception::class); })->throws(ExpectationFailedException::class); diff --git a/tests/Features/Expect/toBeLessThan.php b/tests/Features/Expect/toBeLessThan.php index f7de96fa..ca798c37 100644 --- a/tests/Features/Expect/toBeLessThan.php +++ b/tests/Features/Expect/toBeLessThan.php @@ -8,8 +8,8 @@ test('passes', function () { }); test('passes with DateTime and DateTimeImmutable', function () { - $now = new DateTime(); - $past = (new DateTimeImmutable())->modify('-1 day'); + $now = new DateTime; + $past = (new DateTimeImmutable)->modify('-1 day'); expect($past)->toBeLessThan($now); diff --git a/tests/Features/Expect/toBeLessThanOrEqual.php b/tests/Features/Expect/toBeLessThanOrEqual.php index f25f0774..3fe90189 100644 --- a/tests/Features/Expect/toBeLessThanOrEqual.php +++ b/tests/Features/Expect/toBeLessThanOrEqual.php @@ -8,8 +8,8 @@ test('passes', function () { }); test('passes with DateTime and DateTimeImmutable', function () { - $now = new DateTime(); - $past = (new DateTimeImmutable())->modify('-1 day'); + $now = new DateTime; + $past = (new DateTimeImmutable)->modify('-1 day'); expect($now)->toBeLessThanOrEqual($now); diff --git a/tests/Features/Expect/toContainOnlyInstancesOf.php b/tests/Features/Expect/toContainOnlyInstancesOf.php index 78a729ef..4adaaa20 100644 --- a/tests/Features/Expect/toContainOnlyInstancesOf.php +++ b/tests/Features/Expect/toContainOnlyInstancesOf.php @@ -3,7 +3,7 @@ use PHPUnit\Framework\ExpectationFailedException; beforeEach(function () { - $this->times = [new DateTimeImmutable(), new DateTimeImmutable()]; + $this->times = [new DateTimeImmutable, new DateTimeImmutable]; }); test('pass', function () { diff --git a/tests/Features/Expect/toHaveProperties.php b/tests/Features/Expect/toHaveProperties.php index cca0a38e..1d521f04 100644 --- a/tests/Features/Expect/toHaveProperties.php +++ b/tests/Features/Expect/toHaveProperties.php @@ -3,7 +3,7 @@ use PHPUnit\Framework\ExpectationFailedException; test('pass', function () { - $object = new stdClass(); + $object = new stdClass; $object->name = 'John'; $object->age = 21; @@ -16,7 +16,7 @@ test('pass', function () { }); test('failures', function () { - $object = new stdClass(); + $object = new stdClass; $object->name = 'John'; expect($object) @@ -28,7 +28,7 @@ test('failures', function () { })->throws(ExpectationFailedException::class); test('failures with custom message', function () { - $object = new stdClass(); + $object = new stdClass; $object->name = 'John'; expect($object) @@ -40,7 +40,7 @@ test('failures with custom message', function () { })->throws(ExpectationFailedException::class, 'oh no!'); test('not failures', function () { - $object = new stdClass(); + $object = new stdClass; $object->name = 'John'; $object->age = 21; diff --git a/tests/Features/Expect/toHaveProperty.php b/tests/Features/Expect/toHaveProperty.php index 9f5e10ee..0f4cf672 100644 --- a/tests/Features/Expect/toHaveProperty.php +++ b/tests/Features/Expect/toHaveProperty.php @@ -2,7 +2,7 @@ use PHPUnit\Framework\ExpectationFailedException; -$obj = new stdClass(); +$obj = new stdClass; $obj->foo = 'bar'; $obj->fooNull = null; diff --git a/tests/Features/Expect/toMatchConstraint.php b/tests/Features/Expect/toMatchConstraint.php index 645d9031..9a76e86b 100644 --- a/tests/Features/Expect/toMatchConstraint.php +++ b/tests/Features/Expect/toMatchConstraint.php @@ -4,17 +4,17 @@ use PHPUnit\Framework\Constraint\IsTrue; use PHPUnit\Framework\ExpectationFailedException; test('pass', function () { - expect(true)->toMatchConstraint(new IsTrue()); + expect(true)->toMatchConstraint(new IsTrue); }); test('failures', function () { - expect(false)->toMatchConstraint(new IsTrue()); + expect(false)->toMatchConstraint(new IsTrue); })->throws(ExpectationFailedException::class); test('failures with custom message', function () { - expect(false)->toMatchConstraint(new IsTrue(), 'oh no!'); + expect(false)->toMatchConstraint(new IsTrue, 'oh no!'); })->throws(ExpectationFailedException::class, 'oh no!'); test('not failures', function () { - expect(true)->not->toMatchConstraint(new IsTrue()); + expect(true)->not->toMatchConstraint(new IsTrue); })->throws(ExpectationFailedException::class); diff --git a/tests/Features/Expect/toMatchObject.php b/tests/Features/Expect/toMatchObject.php index e880d2cb..4402ff24 100644 --- a/tests/Features/Expect/toMatchObject.php +++ b/tests/Features/Expect/toMatchObject.php @@ -18,7 +18,7 @@ test('pass', function () { }); test('pass with class', function () { - expect(new class() + expect(new class { public $name = 'Nuno'; diff --git a/tests/Features/Expect/toThrow.php b/tests/Features/Expect/toThrow.php index 72389026..1a0cb322 100644 --- a/tests/Features/Expect/toThrow.php +++ b/tests/Features/Expect/toThrow.php @@ -6,13 +6,13 @@ class CustomException extends Exception {} test('passes', function () { expect(function () { - throw new RuntimeException(); + throw new RuntimeException; })->toThrow(RuntimeException::class); expect(function () { - throw new RuntimeException(); + throw new RuntimeException; })->toThrow(Exception::class); expect(function () { - throw new RuntimeException(); + throw new RuntimeException; })->toThrow(function (RuntimeException $e) {}); expect(function () { throw new RuntimeException('actual message'); @@ -24,7 +24,7 @@ test('passes', function () { throw new RuntimeException('actual message'); })->toThrow('actual message'); expect(function () { - throw new Exception(); + throw new Exception; })->not->toThrow(RuntimeException::class); expect(function () { throw new RuntimeException('actual message'); @@ -47,7 +47,7 @@ test('failures 2', function () { test('failures 3', function () { expect(function () { - throw new Exception(); + throw new Exception; })->toThrow(function (RuntimeException $e) { // }); @@ -92,7 +92,7 @@ test('failures with custom message', function () { test('not failures', function () { expect(function () { - throw new RuntimeException(); + throw new RuntimeException; })->not->toThrow(RuntimeException::class); })->throws(ExpectationFailedException::class); @@ -106,16 +106,16 @@ test('closure missing type-hint', function () { it('can handle a non-defined exception', function () { expect(function () { - throw new NonExistingException(); + throw new NonExistingException; })->toThrow(NonExistingException::class); })->throws(Error::class, 'Class "NonExistingException" not found'); it('can handle a class not found Error', function () { expect(function () { - throw new NonExistingException(); + throw new NonExistingException; })->toThrow('Class "NonExistingException" not found'); expect(function () { - throw new NonExistingException(); + throw new NonExistingException; })->toThrow(Error::class, 'Class "NonExistingException" not found'); }); diff --git a/tests/Features/Expect/unless.php b/tests/Features/Expect/unless.php index 5f78c0cd..be28e225 100644 --- a/tests/Features/Expect/unless.php +++ b/tests/Features/Expect/unless.php @@ -3,7 +3,7 @@ use PHPUnit\Framework\ExpectationFailedException; beforeEach(function () { - $this->unlessObject = new stdClass(); + $this->unlessObject = new stdClass; $this->unlessObject->trueValue = true; $this->unlessObject->foo = 'foo'; }); diff --git a/tests/Features/Expect/when.php b/tests/Features/Expect/when.php index 1a40bf12..cee894ec 100644 --- a/tests/Features/Expect/when.php +++ b/tests/Features/Expect/when.php @@ -3,7 +3,7 @@ use PHPUnit\Framework\ExpectationFailedException; beforeEach(function () { - $this->whenObject = new stdClass(); + $this->whenObject = new stdClass; $this->whenObject->trueValue = true; $this->whenObject->foo = 'foo'; }); diff --git a/tests/Features/ScopedDatasets/Directory/NestedDirectory1/TestFileInNestedDirectoryWithDatasetsFile.php b/tests/Features/ScopedDatasets/Directory/NestedDirectory1/TestFileInNestedDirectoryWithDatasetsFile.php index e14ca863..49a3ac71 100644 --- a/tests/Features/ScopedDatasets/Directory/NestedDirectory1/TestFileInNestedDirectoryWithDatasetsFile.php +++ b/tests/Features/ScopedDatasets/Directory/NestedDirectory1/TestFileInNestedDirectoryWithDatasetsFile.php @@ -1,6 +1,6 @@ text = ''; test('uses dataset', function ($value) use ($state) { $state->text .= $value; diff --git a/tests/Features/ScopedDatasets/Directory/NestedDirectory2/TestFileInNestedDirectory.php b/tests/Features/ScopedDatasets/Directory/NestedDirectory2/TestFileInNestedDirectory.php index a86b9d23..a0224119 100644 --- a/tests/Features/ScopedDatasets/Directory/NestedDirectory2/TestFileInNestedDirectory.php +++ b/tests/Features/ScopedDatasets/Directory/NestedDirectory2/TestFileInNestedDirectory.php @@ -1,6 +1,6 @@ text = ''; test('uses dataset', function ($value) use ($state) { $state->text .= $value; diff --git a/tests/Features/ScopedDatasets/Directory/TestFileWithLocallyDefinedDataset.php b/tests/Features/ScopedDatasets/Directory/TestFileWithLocallyDefinedDataset.php index 0bf23b8c..557eb983 100644 --- a/tests/Features/ScopedDatasets/Directory/TestFileWithLocallyDefinedDataset.php +++ b/tests/Features/ScopedDatasets/Directory/TestFileWithLocallyDefinedDataset.php @@ -4,7 +4,7 @@ dataset('numbers.array', [ 1, 2, 3, 4, 5, 'ScopedDatasets/ScopedDatasets.php', ]); -$state = new stdClass(); +$state = new stdClass; $state->text = ''; test('uses dataset', function ($value) use ($state) { $state->text .= $value; diff --git a/tests/Features/ScopedDatasets/Directory/TestFileWithScopedDataset.php b/tests/Features/ScopedDatasets/Directory/TestFileWithScopedDataset.php index a86b9d23..a0224119 100644 --- a/tests/Features/ScopedDatasets/Directory/TestFileWithScopedDataset.php +++ b/tests/Features/ScopedDatasets/Directory/TestFileWithScopedDataset.php @@ -1,6 +1,6 @@ text = ''; test('uses dataset', function ($value) use ($state) { $state->text .= $value; diff --git a/tests/Features/ScopedDatasets/TestFileOutOfScope.php b/tests/Features/ScopedDatasets/TestFileOutOfScope.php index 730a46de..559c09a7 100644 --- a/tests/Features/ScopedDatasets/TestFileOutOfScope.php +++ b/tests/Features/ScopedDatasets/TestFileOutOfScope.php @@ -1,6 +1,6 @@ text = ''; test('uses dataset', function ($value) use ($state) { $state->text .= $value; diff --git a/tests/Features/TestCycle.php b/tests/Features/TestCycle.php index 739d3a39..799afe91 100644 --- a/tests/Features/TestCycle.php +++ b/tests/Features/TestCycle.php @@ -2,7 +2,7 @@ use function PHPUnit\Framework\assertFalse; -$foo = new stdClass(); +$foo = new stdClass; $foo->beforeAll = false; $foo->beforeEach = false; $foo->afterEach = false; diff --git a/tests/Unit/Console/Help.php b/tests/Unit/Console/Help.php index 56b54487..120a6f8e 100644 --- a/tests/Unit/Console/Help.php +++ b/tests/Unit/Console/Help.php @@ -4,7 +4,7 @@ use Pest\Console\Help; use Symfony\Component\Console\Output\BufferedOutput; it('outputs the help information when --help is used', function () { - $output = new BufferedOutput(); + $output = new BufferedOutput; $plugin = new Help($output); $plugin(); diff --git a/tests/Unit/Plugins/Environment.php b/tests/Unit/Plugins/Environment.php index 4a969ad6..0107ed4b 100644 --- a/tests/Unit/Plugins/Environment.php +++ b/tests/Unit/Plugins/Environment.php @@ -5,7 +5,7 @@ use Pest\Plugins\Environment; test('environment is set to CI when --ci option is used', function () { $previousName = Environment::name(); - $plugin = new Environment(); + $plugin = new Environment; $plugin->handleArguments(['foo', '--ci', 'bar']); @@ -15,7 +15,7 @@ test('environment is set to CI when --ci option is used', function () { }); test('environment is set to Local when --ci option is not used', function () { - $plugin = new Environment(); + $plugin = new Environment; $plugin->handleArguments(['foo', 'bar', 'baz']); diff --git a/tests/Unit/Plugins/Retry.php b/tests/Unit/Plugins/Retry.php index b7877769..5649aeb0 100644 --- a/tests/Unit/Plugins/Retry.php +++ b/tests/Unit/Plugins/Retry.php @@ -3,7 +3,7 @@ use Pest\Plugins\Retry; it('orders by defects and stop on defects if when --retry is used ', function () { - $retry = new Retry(); + $retry = new Retry; $arguments = $retry->handleArguments(['--retry']); diff --git a/tests/Unit/Support/Container.php b/tests/Unit/Support/Container.php index 4206bdcc..3bb2656d 100644 --- a/tests/Unit/Support/Container.php +++ b/tests/Unit/Support/Container.php @@ -7,7 +7,7 @@ use Pest\TestSuite; uses()->group('container'); beforeEach(function () { - $this->container = new Container(); + $this->container = new Container; }); it('exists') diff --git a/tests/Unit/Support/Reflection.php b/tests/Unit/Support/Reflection.php index c9d87806..45c25063 100644 --- a/tests/Unit/Support/Reflection.php +++ b/tests/Unit/Support/Reflection.php @@ -9,7 +9,7 @@ it('gets file name from closure', function () { }); it('gets property values', function () { - $class = new class() + $class = new class { private $foo = 'bar'; };