Skip to content

Commit

Permalink
Cs Fix
Browse files Browse the repository at this point in the history
  • Loading branch information
huangdijia committed Aug 8, 2024
1 parent 9730bd7 commit e8ae5ac
Show file tree
Hide file tree
Showing 11 changed files with 38 additions and 38 deletions.
4 changes: 2 additions & 2 deletions tests/Encryption/EncrypterTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -237,9 +237,9 @@ public static function provideTamperedData()

return [
[['iv' => ['value_in_array'], 'value' => '', 'mac' => '']],
[['iv' => new class() {}, 'value' => '', 'mac' => '']],
[['iv' => new class {}, 'value' => '', 'mac' => '']],
[['iv' => $validIv, 'value' => ['value_in_array'], 'mac' => '']],
[['iv' => $validIv, 'value' => new class() {}, 'mac' => '']],
[['iv' => $validIv, 'value' => new class {}, 'mac' => '']],
[['iv' => $validIv, 'value' => '', 'mac' => ['value_in_array']]],
[['iv' => $validIv, 'value' => '', 'mac' => null]],
[['iv' => $validIv, 'value' => '', 'mac' => '', 'tag' => ['value_in_array']]],
Expand Down
6 changes: 3 additions & 3 deletions tests/HttpClient/HttpClientTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -454,7 +454,7 @@ public function testCanSendJsonSerializableData()
{
$this->factory->fake();

$this->factory->asJson()->post('http://foo.com/form', new class() implements JsonSerializable {
$this->factory->asJson()->post('http://foo.com/form', new class implements JsonSerializable {
public function jsonSerialize(): mixed
{
return [
Expand All @@ -475,7 +475,7 @@ public function testPrefersJsonSerializableOverArrayableData()
{
$this->factory->fake();

$this->factory->asJson()->post('http://foo.com/form', new class() implements JsonSerializable, Arrayable {
$this->factory->asJson()->post('http://foo.com/form', new class implements JsonSerializable, Arrayable {
public function jsonSerialize(): mixed
{
return [
Expand Down Expand Up @@ -3053,7 +3053,7 @@ class CustomFactory extends Factory
{
protected function newPendingRequest()
{
return new class() extends PendingRequest {
return new class extends PendingRequest {
protected function newResponse($response)
{
return new TestResponse($response);
Expand Down
10 changes: 5 additions & 5 deletions tests/Mail/AttachableTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ public function testItCanHaveMacroConstructors(): void
});
$mailable = new Mailable();

$mailable->attach(new class() implements Attachable {
$mailable->attach(new class implements Attachable {
public function toMailAttachment(): Attachment
{
return Attachment::fromInvoice('foo')
Expand All @@ -54,15 +54,15 @@ public function testItCanUtiliseExistingApisOnNonMailBasedResourcesWithPath(): v
Attachment::macro('size', function () {
return 99;
});
$notification = new class() {
$notification = new class {
public $pathArgs;

public function withPathAttachment()
{
$this->pathArgs = func_get_args();
}
};
$attachable = new class() implements Attachable {
$attachable = new class implements Attachable {
public function toMailAttachment(): Attachment
{
return Attachment::fromPath('foo.jpg')
Expand All @@ -89,7 +89,7 @@ public function testItCanUtiliseExistingApisOnNonMailBasedResourcesWithArgs(): v
Attachment::macro('size', function () {
return 99;
});
$notification = new class() {
$notification = new class {
public $pathArgs;

public $dataArgs;
Expand All @@ -99,7 +99,7 @@ public function withDataAttachment(): void
$this->dataArgs = func_get_args();
}
};
$attachable = new class() implements Attachable {
$attachable = new class implements Attachable {
public function toMailAttachment(): Attachment
{
return Attachment::fromData(fn () => 'expected attachment body', 'bar')
Expand Down
2 changes: 1 addition & 1 deletion tests/Mail/MailLogTransportTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -145,7 +145,7 @@ public function testGetLogTransportWithPsrLogger()

private function getLoggedEmailMessage(Message $message): string
{
$logger = new class() extends NullLogger {
$logger = new class extends NullLogger {
public string $loggedValue = '';

public function log($level, string|Stringable $message, array $context = []): void
Expand Down
8 changes: 4 additions & 4 deletions tests/Mail/MailManagerTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -133,7 +133,7 @@ public function testItAttachesFilesViaAttachableContractFromPath()
{
file_put_contents($path = __DIR__ . '/foo_3.jpg', 'expected attachment body');

$this->message->attach(new class() implements Attachable {
$this->message->attach(new class implements Attachable {
public function toMailAttachment(): Attachment
{
return Attachment::fromPath(__DIR__ . '/foo_3.jpg')
Expand All @@ -154,7 +154,7 @@ public function toMailAttachment(): Attachment

public function testItAttachesFilesViaAttachableContractFromData()
{
$this->message->attach(new class() implements Attachable {
$this->message->attach(new class implements Attachable {
public function toMailAttachment(): Attachment
{
return Attachment::fromData(fn () => 'expected attachment body', 'foo.jpg')
Expand Down Expand Up @@ -205,7 +205,7 @@ public function testItEmbedsFilesViaAttachableContractFromPath()
{
file_put_contents($path = __DIR__ . '/foo_1.jpg', 'bar');

$cid = $this->message->embed(new class() implements Attachable {
$cid = $this->message->embed(new class implements Attachable {
public function toMailAttachment(): Attachment
{
return Attachment::fromPath(__DIR__ . '/foo_1.jpg')->as('baz')->withMime('image/png');
Expand All @@ -227,7 +227,7 @@ public function testItGeneratesARandomNameWhenAttachableHasNone()
{
file_put_contents($path = __DIR__ . '/foo_2.jpg', 'bar');

$cid = $this->message->embed(new class() implements Attachable {
$cid = $this->message->embed(new class implements Attachable {
public function toMailAttachment(): Attachment
{
return Attachment::fromPath(__DIR__ . '/foo_2.jpg');
Expand Down
8 changes: 4 additions & 4 deletions tests/Mail/MailMessageTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -133,7 +133,7 @@ public function testItAttachesFilesViaAttachableContractFromPath()
{
file_put_contents($path = __DIR__ . '/foo.jpg', 'expected attachment body');

$this->message->attach(new class() implements Attachable {
$this->message->attach(new class implements Attachable {
public function toMailAttachment(): Attachment
{
return Attachment::fromPath(__DIR__ . '/foo.jpg')
Expand All @@ -154,7 +154,7 @@ public function toMailAttachment(): Attachment

public function testItAttachesFilesViaAttachableContractFromData()
{
$this->message->attach(new class() implements Attachable {
$this->message->attach(new class implements Attachable {
public function toMailAttachment(): Attachment
{
return Attachment::fromData(fn () => 'expected attachment body', 'foo.jpg')
Expand Down Expand Up @@ -205,7 +205,7 @@ public function testItEmbedsFilesViaAttachableContractFromPath()
{
file_put_contents($path = __DIR__ . '/foo.jpg', 'bar');

$cid = $this->message->embed(new class() implements Attachable {
$cid = $this->message->embed(new class implements Attachable {
public function toMailAttachment(): Attachment
{
return Attachment::fromPath(__DIR__ . '/foo.jpg')->as('baz')->withMime('image/png');
Expand All @@ -227,7 +227,7 @@ public function testItGeneratesARandomNameWhenAttachableHasNone()
{
file_put_contents($path = __DIR__ . '/foo.jpg', 'bar');

$cid = $this->message->embed(new class() implements Attachable {
$cid = $this->message->embed(new class implements Attachable {
public function toMailAttachment(): Attachment
{
return Attachment::fromPath(__DIR__ . '/foo.jpg');
Expand Down
6 changes: 3 additions & 3 deletions tests/Notification/Mail/NotificationMailMessageTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -289,7 +289,7 @@ public function testItAttachesFilesViaAttachableContractFromPath()
{
$message = new MailMessage();

$message->attach(new class() implements Attachable {
$message->attach(new class implements Attachable {
public function toMailAttachment(): Attachment
{
return Attachment::fromPath('/foo.jpg')->as('bar')->withMime('image/png');
Expand All @@ -309,7 +309,7 @@ public function testItAttachesFilesViaAttachableContractFromData()
{
$mailMessage = new MailMessage();

$mailMessage->attach(new class() implements Attachable {
$mailMessage->attach(new class implements Attachable {
public function toMailAttachment(): Attachment
{
return Attachment::fromData(fn () => 'bar', 'foo.jpg')->withMime('image/png');
Expand All @@ -328,7 +328,7 @@ public function toMailAttachment(): Attachment
public function testItAttachesManyFiles()
{
$mailMessage = new MailMessage();
$attachable = new class() implements Attachable {
$attachable = new class implements Attachable {
public function toMailAttachment(): Attachment
{
return Attachment::fromData(fn () => 'bar', 'foo.jpg')->withMime('image/png');
Expand Down
2 changes: 1 addition & 1 deletion tests/Notification/NotificationRoutesNotificationsTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ public function testNotificationCanBeDispatched()
$factory = m::mock(ChannelManager::class);
$container->set(Dispatcher::class, $factory);
$notifiable = new RoutesNotificationsTestInstance();
$instance = new class() extends Notification {};
$instance = new class extends Notification {};
$factory->shouldReceive('send')->andReturnUsing(function ($originNotifiable, $instance) use ($notifiable) {
$this->assertEquals($notifiable, $originNotifiable);
$this->assertInstanceOf(Notification::class, $instance);
Expand Down
22 changes: 11 additions & 11 deletions tests/Support/OnceTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
});

it('will run the a callback without arguments only once', function () {
$testClass = new class() {
$testClass = new class {
public function getNumber()
{
return once(function () {
Expand All @@ -40,7 +40,7 @@ public function getNumber()
});

it('will run the given callback only once per variation arguments in use', function () {
$testClass = new class() {
$testClass = new class {
public function getNumberForLetter($letter)
{
return once(function () use ($letter) {
Expand All @@ -60,7 +60,7 @@ public function getNumberForLetter($letter)
});

it('will run the given callback only once for falsy result', function () {
$testClass = new class() {
$testClass = new class {
public $counter = 0;

public function getNull()
Expand Down Expand Up @@ -109,7 +109,7 @@ public function getNull()
});

it('will run callback once on static method', function () {
$object = new class() {
$object = new class {
public static function getNumber()
{
return once(function () {
Expand All @@ -130,7 +130,7 @@ public static function getNumber()
});

it('will run callback once on static method per variation arguments in use', function () {
$object = new class() {
$object = new class {
public static function getNumberForLetter($letter)
{
return once(function () use ($letter) {
Expand All @@ -151,7 +151,7 @@ public static function getNumberForLetter($letter)
});

it('can flush the entire cache', function () {
$testClass = new class() {
$testClass = new class {
public function getNumber()
{
return once(function () {
Expand All @@ -168,7 +168,7 @@ public function getNumber()
});

it('can enable and disable the cache', function () {
$testClass = new class() {
$testClass = new class {
public function getNumber()
{
return once(function () {
Expand Down Expand Up @@ -196,7 +196,7 @@ public function getNumber()
});

it('will differentiate between closures', function () {
$testClass = new class() {
$testClass = new class {
public function getNumber()
{
$closure = function () {
Expand Down Expand Up @@ -224,7 +224,7 @@ public function secondNumber()
});

it('will run callback once for closure called on differemt lines', function () {
$testClass = new class() {
$testClass = new class {
public function getNumbers()
{
$closure = function () {
Expand Down Expand Up @@ -256,7 +256,7 @@ function globalFunction()
});

it('will work with two static functions with the same name', function () {
$a = new class() {
$a = new class {
public static function getName()
{
return once(function () {
Expand All @@ -265,7 +265,7 @@ public static function getName()
}
};

$b = new class() {
$b = new class {
public static function getName()
{
return once(function () {
Expand Down
4 changes: 2 additions & 2 deletions tests/ValidatedDTO/Unit/SimpleDTOTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -95,7 +95,7 @@
});

it('validates that a SimpleDTO can be instantiated from an Database Model', function () {
$model = new class() extends Model {
$model = new class extends Model {
protected array $fillable = ['name'];
};

Expand Down Expand Up @@ -181,7 +181,7 @@ public function __construct(protected string $subject_name)
it('validates that the SimpleDTO can be converted into an Database Model', function () {
$simpleDTO = new SimpleDTOInstance(['name' => $this->subject_name]);

$model = new class() extends Model {
$model = new class extends Model {
protected array $fillable = ['name'];
};

Expand Down
4 changes: 2 additions & 2 deletions tests/ValidatedDTO/Unit/ValidatedDTOTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -129,7 +129,7 @@
});

it('validates that a ValidatedDTO can be instantiated from an Eloquent Model', function () {
$model = new class() extends Model {
$model = new class extends Model {
protected array $fillable = ['name'];
};

Expand Down Expand Up @@ -351,7 +351,7 @@ public function __construct(protected string $subject_name)
it('validates that the ValidatedDTO can be converted into an Eloquent Model', function () {
$validatedDTO = new ValidatedDTOInstance(['name' => $this->subject_name]);

$model = new class() extends Model {
$model = new class extends Model {
protected array $fillable = ['name'];
};

Expand Down

0 comments on commit e8ae5ac

Please sign in to comment.