Skip to content

Commit

Permalink
chore: style
Browse files Browse the repository at this point in the history
  • Loading branch information
nunomaduro committed Jul 11, 2024
1 parent e8f122b commit 4783334
Show file tree
Hide file tree
Showing 44 changed files with 59 additions and 171 deletions.
3 changes: 1 addition & 2 deletions src/Bootstrappers/BootSubscribers.php
Original file line number Diff line number Diff line change
Expand Up @@ -32,8 +32,7 @@ final class BootSubscribers implements Bootstrapper
*/
public function __construct(
private readonly Container $container,
) {
}
) {}

/**
* Boots the list of Subscribers.
Expand Down
4 changes: 1 addition & 3 deletions src/Expectations/EachExpectation.php
Original file line number Diff line number Diff line change
Expand Up @@ -24,9 +24,7 @@ final class EachExpectation
*
* @param Expectation<TValue> $original
*/
public function __construct(private readonly Expectation $original)
{
}
public function __construct(private readonly Expectation $original) {}

/**
* Creates a new expectation.
Expand Down
4 changes: 1 addition & 3 deletions src/Expectations/OppositeExpectation.php
Original file line number Diff line number Diff line change
Expand Up @@ -36,9 +36,7 @@ final class OppositeExpectation
*
* @param Expectation<TValue> $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.
Expand Down
4 changes: 1 addition & 3 deletions src/Factories/Covers/CoversClass.php
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,5 @@
*/
final class CoversClass
{
public function __construct(public string $class)
{
}
public function __construct(public string $class) {}
}
4 changes: 1 addition & 3 deletions src/Factories/Covers/CoversFunction.php
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,5 @@
*/
final class CoversFunction
{
public function __construct(public string $function)
{
}
public function __construct(public string $function) {}
}
4 changes: 1 addition & 3 deletions src/Factories/Covers/CoversNothing.php
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,4 @@
/**
* @internal
*/
final class CoversNothing
{
}
final class CoversNothing {}
3 changes: 1 addition & 2 deletions src/Logging/TeamCity/ServiceMessage.php
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,7 @@ final class ServiceMessage
public function __construct(
private readonly string $type,
private readonly array $parameters,
) {
}
) {}

public function toString(): string
{
Expand Down
4 changes: 1 addition & 3 deletions src/Logging/TeamCity/Subscriber/Subscriber.php
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down
4 changes: 1 addition & 3 deletions src/Matchers/Any.php
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,4 @@
/**
* @internal
*/
final class Any
{
}
final class Any {}
7 changes: 2 additions & 5 deletions src/Plugins/Parallel/Paratest/ResultPrinter.php
Original file line number Diff line number Diff line change
Expand Up @@ -63,8 +63,7 @@ public function __construct(
{
public function __construct(
private readonly OutputInterface $output,
) {
}
) {}

public function print(string $buffer): void
{
Expand All @@ -79,9 +78,7 @@ public function print(string $buffer): void
$this->output->write(OutputFormatter::escape($buffer));
}

public function flush(): void
{
}
public function flush(): void {}
};

$this->compactPrinter = CompactPrinter::default();
Expand Down
3 changes: 1 addition & 2 deletions src/Repositories/SnapshotRepository.php
Original file line number Diff line number Diff line change
Expand Up @@ -21,8 +21,7 @@ final class SnapshotRepository
public function __construct(
readonly private string $testsPath,
readonly private string $snapshotsPath,
) {
}
) {}

/**
* Checks if the snapshot exists.
Expand Down
3 changes: 1 addition & 2 deletions src/Subscribers/EnsureTeamCityEnabled.php
Original file line number Diff line number Diff line change
Expand Up @@ -24,8 +24,7 @@ public function __construct(
private readonly InputInterface $input,
private readonly OutputInterface $output,
private readonly TestSuite $testSuite,
) {
}
) {}

/**
* Runs the subscriber.
Expand Down
3 changes: 1 addition & 2 deletions src/Support/ExpectationPipeline.php
Original file line number Diff line number Diff line change
Expand Up @@ -30,8 +30,7 @@ final class ExpectationPipeline
*/
public function __construct(
private readonly Closure $closure
) {
}
) {}

/**
* Creates a new instance of Expectation Pipeline with given closure.
Expand Down
3 changes: 1 addition & 2 deletions src/Support/NullClosure.php
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,6 @@ final class NullClosure
*/
public static function create(): Closure
{
return Closure::fromCallable(function (): void {
});
return Closure::fromCallable(function (): void {});
}
}
4 changes: 1 addition & 3 deletions tests/Features/Covers.php
Original file line number Diff line number Diff line change
Expand Up @@ -10,9 +10,7 @@

$runCounter = 0;

function testCoversFunction()
{
}
function testCoversFunction() {}

it('uses the correct PHPUnit attribute for class', function () {
$attributes = (new ReflectionClass($this))->getAttributes();
Expand Down
3 changes: 1 addition & 2 deletions tests/Features/Expect/toBeCallable.php
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,7 @@
use PHPUnit\Framework\ExpectationFailedException;

test('pass', function () {
expect(function () {
})->toBeCallable();
expect(function () {})->toBeCallable();
expect(null)->not->toBeCallable();
});

Expand Down
8 changes: 2 additions & 6 deletions tests/Features/Expect/toHaveMethods.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,13 +4,9 @@

$object = new class
{
public function foo(): void
{
}
public function foo(): void {}

public function bar(): void
{
}
public function bar(): void {}
};

test('pass', function () use ($object) {
Expand Down
16 changes: 4 additions & 12 deletions tests/Features/Expect/toMatchSnapshot.php
Original file line number Diff line number Diff line change
Expand Up @@ -43,9 +43,7 @@

$object = new class($this->snapshotable)
{
public function __construct(protected string $snapshotable)
{
}
public function __construct(protected string $snapshotable) {}

public function __toString()
{
Expand All @@ -61,9 +59,7 @@ public function __toString()

$object = new class($this->snapshotable)
{
public function __construct(protected string $snapshotable)
{
}
public function __construct(protected string $snapshotable) {}

public function toString()
{
Expand Down Expand Up @@ -97,9 +93,7 @@ public function toString()

$object = new class($this->snapshotable)
{
public function __construct(protected string $snapshotable)
{
}
public function __construct(protected string $snapshotable) {}

public function toArray()
{
Expand All @@ -125,9 +119,7 @@ public function toArray()

$object = new class($this->snapshotable)
{
public function __construct(protected string $snapshotable)
{
}
public function __construct(protected string $snapshotable) {}

public function toSnapshot()
{
Expand Down
31 changes: 9 additions & 22 deletions tests/Features/Expect/toThrow.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,7 @@

use PHPUnit\Framework\ExpectationFailedException;

class CustomException extends Exception
{
}
class CustomException extends Exception {}

test('passes', function () {
expect(function () {
Expand All @@ -15,15 +13,13 @@ class CustomException extends Exception
})->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');
Expand All @@ -35,22 +31,18 @@ class CustomException extends Exception
})->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 () {
Expand All @@ -77,8 +69,7 @@ class CustomException extends Exception
})->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 () {
Expand Down Expand Up @@ -106,15 +97,11 @@ class CustomException extends Exception
})->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 () {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,5 @@

class InvokableClass
{
public function __invoke(): void
{

}
public function __invoke(): void {}
}
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,5 @@

class ParentInvokableClass
{
public function __invoke(): void
{

}
public function __invoke(): void {}
}
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,5 @@

class IsNotInvokableClass
{
public function handle(): void
{

}
public function handle(): void {}
}
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,4 @@
use Attribute;

#[Attribute()]
class AsAttribute
{
}
class AsAttribute {}
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,4 @@
use Tests\Fixtures\Arch\ToHaveAttribute\Attributes\AsAttribute;

#[AsAttribute]
class HaveAttributeClass
{
}
class HaveAttributeClass {}
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,4 @@

namespace Tests\Fixtures\Arch\ToHaveAttribute\NotHaveAttribute;

class NotHaveAttributeClass
{
}
class NotHaveAttributeClass {}
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,5 @@

class HasConstructor
{
public function __construct()
{

}
public function __construct() {}
}
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,4 @@

namespace Tests\Fixtures\Arch\ToHaveConstructor\HasNoConstructor;

class HasNoConstructor
{
}
class HasNoConstructor {}
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,5 @@

class HasDestructor
{
public function __destruct()
{

}
public function __destruct() {}
}
Loading

0 comments on commit 4783334

Please sign in to comment.