From 4783334f15b02f27897bf1a58f14c6db4f8d7844 Mon Sep 17 00:00:00 2001 From: Nuno Maduro Date: Thu, 11 Jul 2024 09:35:38 +0100 Subject: [PATCH 1/6] chore: style --- src/Bootstrappers/BootSubscribers.php | 3 +- src/Expectations/EachExpectation.php | 4 +-- src/Expectations/OppositeExpectation.php | 4 +-- src/Factories/Covers/CoversClass.php | 4 +-- src/Factories/Covers/CoversFunction.php | 4 +-- src/Factories/Covers/CoversNothing.php | 4 +-- src/Logging/TeamCity/ServiceMessage.php | 3 +- .../TeamCity/Subscriber/Subscriber.php | 4 +-- src/Matchers/Any.php | 4 +-- .../Parallel/Paratest/ResultPrinter.php | 7 ++--- src/Repositories/SnapshotRepository.php | 3 +- src/Subscribers/EnsureTeamCityEnabled.php | 3 +- src/Support/ExpectationPipeline.php | 3 +- src/Support/NullClosure.php | 3 +- tests/Features/Covers.php | 4 +-- tests/Features/Expect/toBeCallable.php | 3 +- tests/Features/Expect/toHaveMethods.php | 8 ++--- tests/Features/Expect/toMatchSnapshot.php | 16 +++------- tests/Features/Expect/toThrow.php | 31 ++++++------------- .../IsInvokable/InvokableClass.php | 5 +-- .../IsInvokable/ParentInvokableClass.php | 5 +-- .../IsNotInvokable/IsNotInvokableClass.php | 5 +-- .../Attributes/AsAttribute.php | 4 +-- .../HaveAttribute/HaveAttributeClass.php | 4 +-- .../NotHaveAttributeClass.php | 4 +-- .../HasConstructor/HasConstructor.php | 5 +-- .../HasNoConstructor/HasNoConstructor.php | 4 +-- .../HasDestructor/HasDestructor.php | 5 +-- .../HasNoDestructor/HasNoDestructor.php | 4 +-- .../Arch/ToHaveMethod/HasMethod/HasMethod.php | 5 +-- .../ToHaveMethod/HasMethod/HasMethodTrait.php | 5 +-- .../HasMethod/ParentHasMethodClass.php | 5 +-- .../HasNoMethod/HasNoMethodClass.php | 5 +-- .../ToHavePrefix/HasNoPrefix/ClassWithout.php | 4 +-- .../HasPrefix/PrefixClassWith.php | 4 +-- .../ToHaveSuffix/HasNoSuffix/ClassWithout.php | 4 +-- .../HasSuffix/ClassWithSuffix.php | 4 +-- tests/Fixtures/Covers/CoversClass1.php | 4 +-- tests/Fixtures/Covers/CoversClass2.php | 4 +-- tests/Fixtures/Covers/CoversClass3.php | 4 +-- tests/Fixtures/Covers/CoversTrait.php | 4 +-- tests/Unit/Support/Container.php | 12 ++----- tests/Unit/Support/Reflection.php | 3 +- tests/Unit/TestSuite.php | 3 +- 44 files changed, 59 insertions(+), 171 deletions(-) diff --git a/src/Bootstrappers/BootSubscribers.php b/src/Bootstrappers/BootSubscribers.php index 248b9dde..0be2a488 100644 --- a/src/Bootstrappers/BootSubscribers.php +++ b/src/Bootstrappers/BootSubscribers.php @@ -32,8 +32,7 @@ final class BootSubscribers implements Bootstrapper */ public function __construct( private readonly Container $container, - ) { - } + ) {} /** * Boots the list of Subscribers. diff --git a/src/Expectations/EachExpectation.php b/src/Expectations/EachExpectation.php index e5df6e9c..bbca0592 100644 --- a/src/Expectations/EachExpectation.php +++ b/src/Expectations/EachExpectation.php @@ -24,9 +24,7 @@ final class EachExpectation * * @param Expectation $original */ - public function __construct(private readonly Expectation $original) - { - } + public function __construct(private readonly Expectation $original) {} /** * Creates a new expectation. diff --git a/src/Expectations/OppositeExpectation.php b/src/Expectations/OppositeExpectation.php index 57796f83..902419b2 100644 --- a/src/Expectations/OppositeExpectation.php +++ b/src/Expectations/OppositeExpectation.php @@ -36,9 +36,7 @@ final class OppositeExpectation * * @param Expectation $original */ - public function __construct(private readonly Expectation $original) - { - } + public function __construct(private readonly Expectation $original) {} /** * Asserts that the value array not has the provided $keys. diff --git a/src/Factories/Covers/CoversClass.php b/src/Factories/Covers/CoversClass.php index 44f58487..756139d4 100644 --- a/src/Factories/Covers/CoversClass.php +++ b/src/Factories/Covers/CoversClass.php @@ -9,7 +9,5 @@ namespace Pest\Factories\Covers; */ final class CoversClass { - public function __construct(public string $class) - { - } + public function __construct(public string $class) {} } diff --git a/src/Factories/Covers/CoversFunction.php b/src/Factories/Covers/CoversFunction.php index 5759bbc7..aa018d41 100644 --- a/src/Factories/Covers/CoversFunction.php +++ b/src/Factories/Covers/CoversFunction.php @@ -9,7 +9,5 @@ namespace Pest\Factories\Covers; */ final class CoversFunction { - public function __construct(public string $function) - { - } + public function __construct(public string $function) {} } diff --git a/src/Factories/Covers/CoversNothing.php b/src/Factories/Covers/CoversNothing.php index 31b3d310..4215edbc 100644 --- a/src/Factories/Covers/CoversNothing.php +++ b/src/Factories/Covers/CoversNothing.php @@ -7,6 +7,4 @@ namespace Pest\Factories\Covers; /** * @internal */ -final class CoversNothing -{ -} +final class CoversNothing {} diff --git a/src/Logging/TeamCity/ServiceMessage.php b/src/Logging/TeamCity/ServiceMessage.php index ca16dd80..0fbbaccb 100644 --- a/src/Logging/TeamCity/ServiceMessage.php +++ b/src/Logging/TeamCity/ServiceMessage.php @@ -17,8 +17,7 @@ final class ServiceMessage public function __construct( private readonly string $type, private readonly array $parameters, - ) { - } + ) {} public function toString(): string { diff --git a/src/Logging/TeamCity/Subscriber/Subscriber.php b/src/Logging/TeamCity/Subscriber/Subscriber.php index cc14cfa0..031e3714 100644 --- a/src/Logging/TeamCity/Subscriber/Subscriber.php +++ b/src/Logging/TeamCity/Subscriber/Subscriber.php @@ -14,9 +14,7 @@ abstract class Subscriber /** * Creates a new Subscriber instance. */ - public function __construct(private readonly TeamCityLogger $logger) - { - } + public function __construct(private readonly TeamCityLogger $logger) {} /** * Creates a new TeamCityLogger instance. diff --git a/src/Matchers/Any.php b/src/Matchers/Any.php index 484cf795..576039e0 100644 --- a/src/Matchers/Any.php +++ b/src/Matchers/Any.php @@ -7,6 +7,4 @@ namespace Pest\Matchers; /** * @internal */ -final class Any -{ -} +final class Any {} diff --git a/src/Plugins/Parallel/Paratest/ResultPrinter.php b/src/Plugins/Parallel/Paratest/ResultPrinter.php index 1e9cc245..16a211f2 100644 --- a/src/Plugins/Parallel/Paratest/ResultPrinter.php +++ b/src/Plugins/Parallel/Paratest/ResultPrinter.php @@ -63,8 +63,7 @@ final class ResultPrinter { public function __construct( private readonly OutputInterface $output, - ) { - } + ) {} public function print(string $buffer): void { @@ -79,9 +78,7 @@ final class ResultPrinter $this->output->write(OutputFormatter::escape($buffer)); } - public function flush(): void - { - } + public function flush(): void {} }; $this->compactPrinter = CompactPrinter::default(); diff --git a/src/Repositories/SnapshotRepository.php b/src/Repositories/SnapshotRepository.php index 1cd3e666..171fd88f 100644 --- a/src/Repositories/SnapshotRepository.php +++ b/src/Repositories/SnapshotRepository.php @@ -21,8 +21,7 @@ final class SnapshotRepository public function __construct( readonly private string $testsPath, readonly private string $snapshotsPath, - ) { - } + ) {} /** * Checks if the snapshot exists. diff --git a/src/Subscribers/EnsureTeamCityEnabled.php b/src/Subscribers/EnsureTeamCityEnabled.php index 264800c0..89d4be97 100644 --- a/src/Subscribers/EnsureTeamCityEnabled.php +++ b/src/Subscribers/EnsureTeamCityEnabled.php @@ -24,8 +24,7 @@ final class EnsureTeamCityEnabled implements ConfiguredSubscriber private readonly InputInterface $input, private readonly OutputInterface $output, private readonly TestSuite $testSuite, - ) { - } + ) {} /** * Runs the subscriber. diff --git a/src/Support/ExpectationPipeline.php b/src/Support/ExpectationPipeline.php index c9d3f6ed..5e0d88db 100644 --- a/src/Support/ExpectationPipeline.php +++ b/src/Support/ExpectationPipeline.php @@ -30,8 +30,7 @@ final class ExpectationPipeline */ public function __construct( private readonly Closure $closure - ) { - } + ) {} /** * Creates a new instance of Expectation Pipeline with given closure. diff --git a/src/Support/NullClosure.php b/src/Support/NullClosure.php index 10d9c335..0f56a008 100644 --- a/src/Support/NullClosure.php +++ b/src/Support/NullClosure.php @@ -16,7 +16,6 @@ final class NullClosure */ public static function create(): Closure { - return Closure::fromCallable(function (): void { - }); + return Closure::fromCallable(function (): void {}); } } diff --git a/tests/Features/Covers.php b/tests/Features/Covers.php index 31074e09..07b6f1ba 100644 --- a/tests/Features/Covers.php +++ b/tests/Features/Covers.php @@ -10,9 +10,7 @@ use Tests\Fixtures\Covers\CoversTrait; $runCounter = 0; -function testCoversFunction() -{ -} +function testCoversFunction() {} it('uses the correct PHPUnit attribute for class', function () { $attributes = (new ReflectionClass($this))->getAttributes(); diff --git a/tests/Features/Expect/toBeCallable.php b/tests/Features/Expect/toBeCallable.php index 77af5689..384a0c75 100644 --- a/tests/Features/Expect/toBeCallable.php +++ b/tests/Features/Expect/toBeCallable.php @@ -3,8 +3,7 @@ use PHPUnit\Framework\ExpectationFailedException; test('pass', function () { - expect(function () { - })->toBeCallable(); + expect(function () {})->toBeCallable(); expect(null)->not->toBeCallable(); }); diff --git a/tests/Features/Expect/toHaveMethods.php b/tests/Features/Expect/toHaveMethods.php index a02a3275..06c11006 100644 --- a/tests/Features/Expect/toHaveMethods.php +++ b/tests/Features/Expect/toHaveMethods.php @@ -4,13 +4,9 @@ use PHPUnit\Framework\ExpectationFailedException; $object = new class { - public function foo(): void - { - } + public function foo(): void {} - public function bar(): void - { - } + public function bar(): void {} }; test('pass', function () use ($object) { diff --git a/tests/Features/Expect/toMatchSnapshot.php b/tests/Features/Expect/toMatchSnapshot.php index 6dc3e83e..c3df8bac 100644 --- a/tests/Features/Expect/toMatchSnapshot.php +++ b/tests/Features/Expect/toMatchSnapshot.php @@ -43,9 +43,7 @@ test('pass with `__toString`', function () { $object = new class($this->snapshotable) { - public function __construct(protected string $snapshotable) - { - } + public function __construct(protected string $snapshotable) {} public function __toString() { @@ -61,9 +59,7 @@ test('pass with `toString`', function () { $object = new class($this->snapshotable) { - public function __construct(protected string $snapshotable) - { - } + public function __construct(protected string $snapshotable) {} public function toString() { @@ -97,9 +93,7 @@ test('pass with `toArray`', function () { $object = new class($this->snapshotable) { - public function __construct(protected string $snapshotable) - { - } + public function __construct(protected string $snapshotable) {} public function toArray() { @@ -125,9 +119,7 @@ test('pass with `toSnapshot`', function () { $object = new class($this->snapshotable) { - public function __construct(protected string $snapshotable) - { - } + public function __construct(protected string $snapshotable) {} public function toSnapshot() { diff --git a/tests/Features/Expect/toThrow.php b/tests/Features/Expect/toThrow.php index 1444ccca..72389026 100644 --- a/tests/Features/Expect/toThrow.php +++ b/tests/Features/Expect/toThrow.php @@ -2,9 +2,7 @@ use PHPUnit\Framework\ExpectationFailedException; -class CustomException extends Exception -{ -} +class CustomException extends Exception {} test('passes', function () { expect(function () { @@ -15,15 +13,13 @@ test('passes', function () { })->toThrow(Exception::class); expect(function () { throw new RuntimeException(); - })->toThrow(function (RuntimeException $e) { - }); + })->toThrow(function (RuntimeException $e) {}); expect(function () { throw new RuntimeException('actual message'); })->toThrow(function (Exception $e) { expect($e->getMessage())->toBe('actual message'); }); - expect(function () { - })->not->toThrow(Exception::class); + expect(function () {})->not->toThrow(Exception::class); expect(function () { throw new RuntimeException('actual message'); })->toThrow('actual message'); @@ -35,22 +31,18 @@ test('passes', function () { })->toThrow(RuntimeException::class, 'actual message'); expect(function () { throw new RuntimeException('actual message'); - })->toThrow(function (RuntimeException $e) { - }, 'actual message'); + })->toThrow(function (RuntimeException $e) {}, 'actual message'); expect(function () { throw new CustomException('foo'); })->toThrow(new CustomException('foo')); }); test('failures 1', function () { - expect(function () { - })->toThrow(RuntimeException::class); + expect(function () {})->toThrow(RuntimeException::class); })->throws(ExpectationFailedException::class, 'Exception "'.RuntimeException::class.'" not thrown.'); test('failures 2', function () { - expect(function () { - })->toThrow(function (RuntimeException $e) { - }); + expect(function () {})->toThrow(function (RuntimeException $e) {}); })->throws(ExpectationFailedException::class, 'Exception "'.RuntimeException::class.'" not thrown.'); test('failures 3', function () { @@ -77,8 +69,7 @@ test('failures 5', function () { })->throws(ExpectationFailedException::class, 'Failed asserting that \'actual message\' [ASCII](length: 14) contains "expected message" [ASCII](length: 16).'); test('failures 6', function () { - expect(function () { - })->toThrow('actual message'); + expect(function () {})->toThrow('actual message'); })->throws(ExpectationFailedException::class, 'Exception with message "actual message" not thrown'); test('failures 7', function () { @@ -106,15 +97,11 @@ test('not failures', function () { })->throws(ExpectationFailedException::class); test('closure missing parameter', function () { - expect(function () { - })->toThrow(function () { - }); + expect(function () {})->toThrow(function () {}); })->throws(InvalidArgumentException::class, 'The given closure must have a single parameter type-hinted as the class string.'); test('closure missing type-hint', function () { - expect(function () { - })->toThrow(function ($e) { - }); + expect(function () {})->toThrow(function ($e) {}); })->throws(InvalidArgumentException::class, 'The given closure\'s parameter must be type-hinted as the class string.'); it('can handle a non-defined exception', function () { diff --git a/tests/Fixtures/Arch/ToBeInvokable/IsInvokable/InvokableClass.php b/tests/Fixtures/Arch/ToBeInvokable/IsInvokable/InvokableClass.php index 24cbb979..5aa6e0e5 100644 --- a/tests/Fixtures/Arch/ToBeInvokable/IsInvokable/InvokableClass.php +++ b/tests/Fixtures/Arch/ToBeInvokable/IsInvokable/InvokableClass.php @@ -6,8 +6,5 @@ namespace Tests\Fixtures\Arch\ToBeInvokable\IsInvokable; class InvokableClass { - public function __invoke(): void - { - - } + public function __invoke(): void {} } diff --git a/tests/Fixtures/Arch/ToBeInvokable/IsInvokable/ParentInvokableClass.php b/tests/Fixtures/Arch/ToBeInvokable/IsInvokable/ParentInvokableClass.php index 89bc5904..b941b37e 100644 --- a/tests/Fixtures/Arch/ToBeInvokable/IsInvokable/ParentInvokableClass.php +++ b/tests/Fixtures/Arch/ToBeInvokable/IsInvokable/ParentInvokableClass.php @@ -6,8 +6,5 @@ namespace Tests\Fixtures\Arch\ToBeInvokable\IsInvokable; class ParentInvokableClass { - public function __invoke(): void - { - - } + public function __invoke(): void {} } diff --git a/tests/Fixtures/Arch/ToBeInvokable/IsNotInvokable/IsNotInvokableClass.php b/tests/Fixtures/Arch/ToBeInvokable/IsNotInvokable/IsNotInvokableClass.php index c645a0c3..d5485741 100644 --- a/tests/Fixtures/Arch/ToBeInvokable/IsNotInvokable/IsNotInvokableClass.php +++ b/tests/Fixtures/Arch/ToBeInvokable/IsNotInvokable/IsNotInvokableClass.php @@ -6,8 +6,5 @@ namespace Tests\Fixtures\Arch\ToBeInvokable\IsNotInvokable; class IsNotInvokableClass { - public function handle(): void - { - - } + public function handle(): void {} } diff --git a/tests/Fixtures/Arch/ToHaveAttribute/Attributes/AsAttribute.php b/tests/Fixtures/Arch/ToHaveAttribute/Attributes/AsAttribute.php index 00b913bd..cd8949e6 100644 --- a/tests/Fixtures/Arch/ToHaveAttribute/Attributes/AsAttribute.php +++ b/tests/Fixtures/Arch/ToHaveAttribute/Attributes/AsAttribute.php @@ -7,6 +7,4 @@ namespace Tests\Fixtures\Arch\ToHaveAttribute\Attributes; use Attribute; #[Attribute()] -class AsAttribute -{ -} +class AsAttribute {} diff --git a/tests/Fixtures/Arch/ToHaveAttribute/HaveAttribute/HaveAttributeClass.php b/tests/Fixtures/Arch/ToHaveAttribute/HaveAttribute/HaveAttributeClass.php index 49a0eb20..134c51b5 100644 --- a/tests/Fixtures/Arch/ToHaveAttribute/HaveAttribute/HaveAttributeClass.php +++ b/tests/Fixtures/Arch/ToHaveAttribute/HaveAttribute/HaveAttributeClass.php @@ -7,6 +7,4 @@ namespace Tests\Fixtures\Arch\ToHaveAttribute\HaveAttribute; use Tests\Fixtures\Arch\ToHaveAttribute\Attributes\AsAttribute; #[AsAttribute] -class HaveAttributeClass -{ -} +class HaveAttributeClass {} diff --git a/tests/Fixtures/Arch/ToHaveAttribute/NotHaveAttribute/NotHaveAttributeClass.php b/tests/Fixtures/Arch/ToHaveAttribute/NotHaveAttribute/NotHaveAttributeClass.php index 0628960c..f646cf85 100644 --- a/tests/Fixtures/Arch/ToHaveAttribute/NotHaveAttribute/NotHaveAttributeClass.php +++ b/tests/Fixtures/Arch/ToHaveAttribute/NotHaveAttribute/NotHaveAttributeClass.php @@ -4,6 +4,4 @@ declare(strict_types=1); namespace Tests\Fixtures\Arch\ToHaveAttribute\NotHaveAttribute; -class NotHaveAttributeClass -{ -} +class NotHaveAttributeClass {} diff --git a/tests/Fixtures/Arch/ToHaveConstructor/HasConstructor/HasConstructor.php b/tests/Fixtures/Arch/ToHaveConstructor/HasConstructor/HasConstructor.php index 924e250d..f230cc5d 100644 --- a/tests/Fixtures/Arch/ToHaveConstructor/HasConstructor/HasConstructor.php +++ b/tests/Fixtures/Arch/ToHaveConstructor/HasConstructor/HasConstructor.php @@ -6,8 +6,5 @@ namespace Tests\Fixtures\Arch\ToHaveConstructor\HasConstructor; class HasConstructor { - public function __construct() - { - - } + public function __construct() {} } diff --git a/tests/Fixtures/Arch/ToHaveConstructor/HasNoConstructor/HasNoConstructor.php b/tests/Fixtures/Arch/ToHaveConstructor/HasNoConstructor/HasNoConstructor.php index c798078e..9c6a4587 100644 --- a/tests/Fixtures/Arch/ToHaveConstructor/HasNoConstructor/HasNoConstructor.php +++ b/tests/Fixtures/Arch/ToHaveConstructor/HasNoConstructor/HasNoConstructor.php @@ -4,6 +4,4 @@ declare(strict_types=1); namespace Tests\Fixtures\Arch\ToHaveConstructor\HasNoConstructor; -class HasNoConstructor -{ -} +class HasNoConstructor {} diff --git a/tests/Fixtures/Arch/ToHaveDestructor/HasDestructor/HasDestructor.php b/tests/Fixtures/Arch/ToHaveDestructor/HasDestructor/HasDestructor.php index 4d367485..00de1ae9 100644 --- a/tests/Fixtures/Arch/ToHaveDestructor/HasDestructor/HasDestructor.php +++ b/tests/Fixtures/Arch/ToHaveDestructor/HasDestructor/HasDestructor.php @@ -6,8 +6,5 @@ namespace Tests\Fixtures\Arch\ToHaveDestructor\HasDestructor; class HasDestructor { - public function __destruct() - { - - } + public function __destruct() {} } diff --git a/tests/Fixtures/Arch/ToHaveDestructor/HasNoDestructor/HasNoDestructor.php b/tests/Fixtures/Arch/ToHaveDestructor/HasNoDestructor/HasNoDestructor.php index eea037ed..01798952 100644 --- a/tests/Fixtures/Arch/ToHaveDestructor/HasNoDestructor/HasNoDestructor.php +++ b/tests/Fixtures/Arch/ToHaveDestructor/HasNoDestructor/HasNoDestructor.php @@ -4,6 +4,4 @@ declare(strict_types=1); namespace Tests\Fixtures\Arch\ToHaveDestructor\HasNoDestructor; -class HasNoDestructor -{ -} +class HasNoDestructor {} diff --git a/tests/Fixtures/Arch/ToHaveMethod/HasMethod/HasMethod.php b/tests/Fixtures/Arch/ToHaveMethod/HasMethod/HasMethod.php index 63c79b00..8bd2252f 100644 --- a/tests/Fixtures/Arch/ToHaveMethod/HasMethod/HasMethod.php +++ b/tests/Fixtures/Arch/ToHaveMethod/HasMethod/HasMethod.php @@ -6,8 +6,5 @@ namespace Tests\Fixtures\Arch\ToHaveMethod\HasMethod; class HasMethod { - public function foo(): void - { - - } + public function foo(): void {} } diff --git a/tests/Fixtures/Arch/ToHaveMethod/HasMethod/HasMethodTrait.php b/tests/Fixtures/Arch/ToHaveMethod/HasMethod/HasMethodTrait.php index 1d4651c5..feb3e9dc 100644 --- a/tests/Fixtures/Arch/ToHaveMethod/HasMethod/HasMethodTrait.php +++ b/tests/Fixtures/Arch/ToHaveMethod/HasMethod/HasMethodTrait.php @@ -6,8 +6,5 @@ namespace Tests\Fixtures\Arch\ToHaveMethod\HasMethod; trait HasMethodTrait { - public function foo(): void - { - - } + public function foo(): void {} } diff --git a/tests/Fixtures/Arch/ToHaveMethod/HasMethod/ParentHasMethodClass.php b/tests/Fixtures/Arch/ToHaveMethod/HasMethod/ParentHasMethodClass.php index 3d0de894..4bde5340 100644 --- a/tests/Fixtures/Arch/ToHaveMethod/HasMethod/ParentHasMethodClass.php +++ b/tests/Fixtures/Arch/ToHaveMethod/HasMethod/ParentHasMethodClass.php @@ -6,8 +6,5 @@ namespace Tests\Fixtures\Arch\ToHaveMethod\HasMethod; class ParentHasMethodClass { - public function foo(): void - { - - } + public function foo(): void {} } diff --git a/tests/Fixtures/Arch/ToHaveMethod/HasNoMethod/HasNoMethodClass.php b/tests/Fixtures/Arch/ToHaveMethod/HasNoMethod/HasNoMethodClass.php index 7d33a9f0..27556739 100644 --- a/tests/Fixtures/Arch/ToHaveMethod/HasNoMethod/HasNoMethodClass.php +++ b/tests/Fixtures/Arch/ToHaveMethod/HasNoMethod/HasNoMethodClass.php @@ -6,8 +6,5 @@ namespace Tests\Fixtures\Arch\ToHaveMethod\HasNoMethod; class HasNoMethodClass { - public function bar(): void - { - - } + public function bar(): void {} } diff --git a/tests/Fixtures/Arch/ToHavePrefix/HasNoPrefix/ClassWithout.php b/tests/Fixtures/Arch/ToHavePrefix/HasNoPrefix/ClassWithout.php index 19281e44..3f493f5d 100644 --- a/tests/Fixtures/Arch/ToHavePrefix/HasNoPrefix/ClassWithout.php +++ b/tests/Fixtures/Arch/ToHavePrefix/HasNoPrefix/ClassWithout.php @@ -4,6 +4,4 @@ declare(strict_types=1); namespace Tests\Fixtures\Arch\ToHavePrefix\HasNoPrefix; -class ClassWithout -{ -} +class ClassWithout {} diff --git a/tests/Fixtures/Arch/ToHavePrefix/HasPrefix/PrefixClassWith.php b/tests/Fixtures/Arch/ToHavePrefix/HasPrefix/PrefixClassWith.php index 7ff074b1..e347a4de 100644 --- a/tests/Fixtures/Arch/ToHavePrefix/HasPrefix/PrefixClassWith.php +++ b/tests/Fixtures/Arch/ToHavePrefix/HasPrefix/PrefixClassWith.php @@ -4,6 +4,4 @@ declare(strict_types=1); namespace Tests\Fixtures\Arch\ToHavePrefix\HasPrefix; -class PrefixClassWith -{ -} +class PrefixClassWith {} diff --git a/tests/Fixtures/Arch/ToHaveSuffix/HasNoSuffix/ClassWithout.php b/tests/Fixtures/Arch/ToHaveSuffix/HasNoSuffix/ClassWithout.php index c08d8e8e..e1cf6f95 100644 --- a/tests/Fixtures/Arch/ToHaveSuffix/HasNoSuffix/ClassWithout.php +++ b/tests/Fixtures/Arch/ToHaveSuffix/HasNoSuffix/ClassWithout.php @@ -4,6 +4,4 @@ declare(strict_types=1); namespace Tests\Fixtures\Arch\ToHaveSuffix\HasNoSuffix; -class ClassWithout -{ -} +class ClassWithout {} diff --git a/tests/Fixtures/Arch/ToHaveSuffix/HasSuffix/ClassWithSuffix.php b/tests/Fixtures/Arch/ToHaveSuffix/HasSuffix/ClassWithSuffix.php index 2cc5a15d..a5bcb6d4 100644 --- a/tests/Fixtures/Arch/ToHaveSuffix/HasSuffix/ClassWithSuffix.php +++ b/tests/Fixtures/Arch/ToHaveSuffix/HasSuffix/ClassWithSuffix.php @@ -4,6 +4,4 @@ declare(strict_types=1); namespace Tests\Fixtures\Arch\ToHaveSuffix\HasSuffix; -class ClassWithSuffix -{ -} +class ClassWithSuffix {} diff --git a/tests/Fixtures/Covers/CoversClass1.php b/tests/Fixtures/Covers/CoversClass1.php index 0fde28f6..ee0a4d40 100644 --- a/tests/Fixtures/Covers/CoversClass1.php +++ b/tests/Fixtures/Covers/CoversClass1.php @@ -4,7 +4,5 @@ namespace Tests\Fixtures\Covers; class CoversClass1 { - public function foo() - { - } + public function foo() {} } diff --git a/tests/Fixtures/Covers/CoversClass2.php b/tests/Fixtures/Covers/CoversClass2.php index 7828b898..66c2f965 100644 --- a/tests/Fixtures/Covers/CoversClass2.php +++ b/tests/Fixtures/Covers/CoversClass2.php @@ -2,6 +2,4 @@ namespace Tests\Fixtures\Covers; -class CoversClass2 -{ -} +class CoversClass2 {} diff --git a/tests/Fixtures/Covers/CoversClass3.php b/tests/Fixtures/Covers/CoversClass3.php index 82b68413..19c31645 100644 --- a/tests/Fixtures/Covers/CoversClass3.php +++ b/tests/Fixtures/Covers/CoversClass3.php @@ -2,6 +2,4 @@ namespace Tests\Fixtures\Covers; -class CoversClass3 -{ -} +class CoversClass3 {} diff --git a/tests/Fixtures/Covers/CoversTrait.php b/tests/Fixtures/Covers/CoversTrait.php index 6de082b9..b7df199e 100644 --- a/tests/Fixtures/Covers/CoversTrait.php +++ b/tests/Fixtures/Covers/CoversTrait.php @@ -2,6 +2,4 @@ namespace Tests\Fixtures\Covers; -trait CoversTrait -{ -} +trait CoversTrait {} diff --git a/tests/Unit/Support/Container.php b/tests/Unit/Support/Container.php index 3517c65d..4206bdcc 100644 --- a/tests/Unit/Support/Container.php +++ b/tests/Unit/Support/Container.php @@ -50,21 +50,15 @@ it('cannot resolve a parameter without type', function () { class ClassWithDependency { - public function __construct(Container $container) - { - } + public function __construct(Container $container) {} } class ClassWithSubDependency { - public function __construct(ClassWithDependency $param) - { - } + public function __construct(ClassWithDependency $param) {} } class ClassWithoutTypeParameter { - public function __construct($param) - { - } + public function __construct($param) {} } diff --git a/tests/Unit/Support/Reflection.php b/tests/Unit/Support/Reflection.php index 759473c4..c9d87806 100644 --- a/tests/Unit/Support/Reflection.php +++ b/tests/Unit/Support/Reflection.php @@ -3,8 +3,7 @@ use Pest\Support\Reflection; it('gets file name from closure', function () { - $fileName = Reflection::getFileNameFromClosure(function () { - }); + $fileName = Reflection::getFileNameFromClosure(function () {}); expect($fileName)->toBe(__FILE__); }); diff --git a/tests/Unit/TestSuite.php b/tests/Unit/TestSuite.php index eb033d0c..f9d02d9c 100644 --- a/tests/Unit/TestSuite.php +++ b/tests/Unit/TestSuite.php @@ -19,8 +19,7 @@ it('does not allow to add the same test description twice', function () { it('alerts users about tests with arguments but no input', function () { $testSuite = new TestSuite(getcwd(), 'tests'); - $method = new TestCaseMethodFactory('foo', 'bar', function (int $arg) { - }); + $method = new TestCaseMethodFactory('foo', 'bar', function (int $arg) {}); $testSuite->tests->set($method); })->throws( From 8a9a416133b1ae458ceabae5aafccfb10ca53b31 Mon Sep 17 00:00:00 2001 From: Nuno Maduro Date: Thu, 11 Jul 2024 09:35:43 +0100 Subject: [PATCH 2/6] chore: bumps dependencies --- composer.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/composer.json b/composer.json index a08ae7ce..3cde794f 100644 --- a/composer.json +++ b/composer.json @@ -52,7 +52,7 @@ }, "require-dev": { "pestphp/pest-dev-tools": "^2.16.0", - "pestphp/pest-plugin-type-coverage": "^2.8.3", + "pestphp/pest-plugin-type-coverage": "^2.8.4", "symfony/process": "^6.4.0|^7.1.1" }, "minimum-stability": "dev", From ef120125e036bf84c9e46a9e62219702f5b92e16 Mon Sep 17 00:00:00 2001 From: Nuno Maduro Date: Thu, 11 Jul 2024 09:36:26 +0100 Subject: [PATCH 3/6] release: 2.34.9 --- src/Pest.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Pest.php b/src/Pest.php index 6d85c02c..68f634d4 100644 --- a/src/Pest.php +++ b/src/Pest.php @@ -6,7 +6,7 @@ namespace Pest; function version(): string { - return '2.34.8'; + return '2.34.9'; } function testDirectory(string $file = ''): string From ef29b4f0911df9ae433f160fe4a4d20d26f604dc Mon Sep 17 00:00:00 2001 From: Dan Mason Date: Fri, 19 Jul 2024 15:30:43 +0100 Subject: [PATCH 4/6] Include method name in toHaveMethod error message --- src/Expectation.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Expectation.php b/src/Expectation.php index a410cf1d..2b2fde8a 100644 --- a/src/Expectation.php +++ b/src/Expectation.php @@ -515,7 +515,7 @@ final class Expectation return Targeted::make( $this, fn (ObjectDescription $object): bool => $object->reflectionClass->hasMethod($method), - 'to have method', + sprintf("to have method '%s'", $method), FileLineFinder::where(fn (string $line): bool => str_contains($line, 'class')), ); } From 5e41e546a09da1482e1d6317ad41bedd0648c86d Mon Sep 17 00:00:00 2001 From: Nuno Maduro Date: Fri, 2 Aug 2024 11:53:24 +0100 Subject: [PATCH 5/6] chore: style changes --- bin/worker.php | 4 +-- src/Console/Thanks.php | 2 +- src/Expectation.php | 2 +- src/Factories/Concerns/HigherOrderable.php | 6 ++--- src/Factories/TestCaseFactory.php | 2 +- src/Factories/TestCaseMethodFactory.php | 4 +-- src/Kernel.php | 2 +- src/Logging/Converter.php | 2 +- src/Mixins/Expectation.php | 4 +-- src/Panic.php | 2 +- src/PendingCalls/AfterEachCall.php | 2 +- src/PendingCalls/BeforeEachCall.php | 4 +-- src/PendingCalls/TestCall.php | 2 +- src/Plugins/Help.php | 2 +- src/Plugins/Parallel.php | 6 ++--- .../Parallel/Paratest/ResultPrinter.php | 2 +- .../Parallel/Paratest/WrapperRunner.php | 12 ++++----- src/Support/Container.php | 2 +- src/Support/Coverage.php | 4 +-- src/Support/Exporter.php | 4 +-- src/Support/StateGenerator.php | 2 +- .../GitDirtyTestCaseFilter.php | 2 +- src/TestSuite.php | 12 ++++----- tests/Features/AfterEach.php | 2 +- tests/Features/BeforeAll.php | 2 +- tests/Features/Coverage.php | 6 ++--- tests/Features/DatasetsTests.php | 18 ++++++------- tests/Features/Exceptions.php | 2 +- tests/Features/Expect/HigherOrder/methods.php | 26 +++++++++---------- .../HigherOrder/methodsAndProperties.php | 14 +++++----- .../Expect/HigherOrder/properties.php | 6 ++--- tests/Features/Expect/pipes.php | 2 +- tests/Features/Expect/toBe.php | 4 +-- tests/Features/Expect/toBeGreaterThan.php | 4 +-- .../Expect/toBeGreaterThanOrEqual.php | 4 +-- tests/Features/Expect/toBeInstanceOf.php | 10 +++---- tests/Features/Expect/toBeLessThan.php | 4 +-- tests/Features/Expect/toBeLessThanOrEqual.php | 4 +-- .../Expect/toContainOnlyInstancesOf.php | 2 +- tests/Features/Expect/toHaveProperties.php | 8 +++--- tests/Features/Expect/toHaveProperty.php | 2 +- tests/Features/Expect/toMatchConstraint.php | 8 +++--- tests/Features/Expect/toMatchObject.php | 2 +- tests/Features/Expect/toThrow.php | 18 ++++++------- tests/Features/Expect/unless.php | 2 +- tests/Features/Expect/when.php | 2 +- ...tFileInNestedDirectoryWithDatasetsFile.php | 2 +- .../TestFileInNestedDirectory.php | 2 +- .../TestFileWithLocallyDefinedDataset.php | 2 +- .../Directory/TestFileWithScopedDataset.php | 2 +- .../ScopedDatasets/TestFileOutOfScope.php | 2 +- tests/Features/TestCycle.php | 2 +- tests/Unit/Console/Help.php | 2 +- tests/Unit/Plugins/Environment.php | 4 +-- tests/Unit/Plugins/Retry.php | 2 +- tests/Unit/Support/Container.php | 2 +- tests/Unit/Support/Reflection.php | 2 +- 57 files changed, 131 insertions(+), 131 deletions(-) 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'; }; From d0ff2c8ec294b7aa7fcb0f3ddc4fdec864234646 Mon Sep 17 00:00:00 2001 From: Nuno Maduro Date: Fri, 2 Aug 2024 11:57:29 +0100 Subject: [PATCH 6/6] release: 2.35.0 --- composer.json | 6 +++--- src/Pest.php | 2 +- .../Visual/Help/visual_snapshot_of_help_command_output.snap | 2 +- .../Version/visual_snapshot_of_help_command_output.snap | 2 +- 4 files changed, 6 insertions(+), 6 deletions(-) diff --git a/composer.json b/composer.json index 3cde794f..92f319e9 100644 --- a/composer.json +++ b/composer.json @@ -19,7 +19,7 @@ "require": { "php": "^8.1.0", "brianium/paratest": "^7.3.1", - "nunomaduro/collision": "^7.10.0|^8.1.1", + "nunomaduro/collision": "^7.10.0|^8.3.0", "nunomaduro/termwind": "^1.15.1|^2.0.1", "pestphp/pest-plugin": "^2.1.1", "pestphp/pest-plugin-arch": "^2.7.0", @@ -52,8 +52,8 @@ }, "require-dev": { "pestphp/pest-dev-tools": "^2.16.0", - "pestphp/pest-plugin-type-coverage": "^2.8.4", - "symfony/process": "^6.4.0|^7.1.1" + "pestphp/pest-plugin-type-coverage": "^2.8.5", + "symfony/process": "^6.4.0|^7.1.3" }, "minimum-stability": "dev", "prefer-stable": true, diff --git a/src/Pest.php b/src/Pest.php index 68f634d4..f6849533 100644 --- a/src/Pest.php +++ b/src/Pest.php @@ -6,7 +6,7 @@ namespace Pest; function version(): string { - return '2.34.9'; + return '2.35.0'; } function testDirectory(string $file = ''): string diff --git a/tests/.pest/snapshots/Visual/Help/visual_snapshot_of_help_command_output.snap b/tests/.pest/snapshots/Visual/Help/visual_snapshot_of_help_command_output.snap index 2fe3fafc..15db551b 100644 --- a/tests/.pest/snapshots/Visual/Help/visual_snapshot_of_help_command_output.snap +++ b/tests/.pest/snapshots/Visual/Help/visual_snapshot_of_help_command_output.snap @@ -1,5 +1,5 @@ - Pest Testing Framework 2.34.8. + Pest Testing Framework 2.35.0. USAGE: pest [options] diff --git a/tests/.pest/snapshots/Visual/Version/visual_snapshot_of_help_command_output.snap b/tests/.pest/snapshots/Visual/Version/visual_snapshot_of_help_command_output.snap index 576b6425..3fceca04 100644 --- a/tests/.pest/snapshots/Visual/Version/visual_snapshot_of_help_command_output.snap +++ b/tests/.pest/snapshots/Visual/Version/visual_snapshot_of_help_command_output.snap @@ -1,3 +1,3 @@ - Pest Testing Framework 2.34.8. + Pest Testing Framework 2.35.0.