Skip to content

Commit 56f5471

Browse files
author
AmirHossein Fallah
committed
style: fix key anonymous class brace positioning for StyleCI
- Fix anonymous class braces in InvokableValidationRule.php - Fix anonymous class braces in BusPendingBatchTest.php - Fix anonymous class braces in DatabaseAbstractSchemaGrammarTest.php - Fix anonymous class braces in JsonResourceTest.php - Addresses most critical StyleCI issues for PR laravel#56507
1 parent 7b36659 commit 56f5471

File tree

4 files changed

+15
-30
lines changed

4 files changed

+15
-30
lines changed

src/Illuminate/Validation/InvokableValidationRule.php

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -68,8 +68,7 @@ protected function __construct(ValidationRule|InvokableRule $invokable)
6868
public static function make($invokable)
6969
{
7070
if ($invokable->implicit ?? false) {
71-
return new class($invokable) extends InvokableValidationRule implements ImplicitRule
72-
{
71+
return new class($invokable) extends InvokableValidationRule implements ImplicitRule {
7372
};
7473
}
7574

tests/Bus/BusPendingBatchTest.php

Lines changed: 9 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -30,8 +30,7 @@ public function test_pending_batch_may_be_configured_and_dispatched()
3030

3131
$container->instance(Dispatcher::class, $eventDispatcher);
3232

33-
$job = new class
34-
{
33+
$job = new class {
3534
use Batchable;
3635
};
3736

@@ -71,8 +70,7 @@ public function test_batch_is_deleted_from_storage_if_exception_thrown_during_ba
7170

7271
$container = new Container;
7372

74-
$job = new class
75-
{
73+
$job = new class {
7674
};
7775

7876
$pendingBatch = new PendingBatch($container, new Collection([$job]));
@@ -102,8 +100,7 @@ public function test_batch_is_dispatched_when_dispatchif_is_true()
102100
$eventDispatcher->shouldReceive('dispatch')->once();
103101
$container->instance(Dispatcher::class, $eventDispatcher);
104102

105-
$job = new class
106-
{
103+
$job = new class {
107104
use Batchable;
108105
};
109106

@@ -128,8 +125,7 @@ public function test_batch_is_not_dispatched_when_dispatchif_is_false()
128125
$eventDispatcher->shouldNotReceive('dispatch');
129126
$container->instance(Dispatcher::class, $eventDispatcher);
130127

131-
$job = new class
132-
{
128+
$job = new class {
133129
use Batchable;
134130
};
135131

@@ -151,8 +147,7 @@ public function test_batch_is_dispatched_when_dispatchunless_is_false()
151147
$eventDispatcher->shouldReceive('dispatch')->once();
152148
$container->instance(Dispatcher::class, $eventDispatcher);
153149

154-
$job = new class
155-
{
150+
$job = new class {
156151
use Batchable;
157152
};
158153

@@ -177,8 +172,7 @@ public function test_batch_is_not_dispatched_when_dispatchunless_is_true()
177172
$eventDispatcher->shouldNotReceive('dispatch');
178173
$container->instance(Dispatcher::class, $eventDispatcher);
179174

180-
$job = new class
181-
{
175+
$job = new class {
182176
use Batchable;
183177
};
184178

@@ -201,8 +195,7 @@ public function test_batch_before_event_is_called()
201195

202196
$container->instance(Dispatcher::class, $eventDispatcher);
203197

204-
$job = new class
205-
{
198+
$job = new class {
206199
use Batchable;
207200
};
208201

@@ -227,8 +220,7 @@ public function test_batch_before_event_is_called()
227220

228221
public function test_it_throws_exception_if_batched_job_is_not_batchable(): void
229222
{
230-
$nonBatchableJob = new class
231-
{
223+
$nonBatchableJob = new class {
232224
};
233225

234226
$this->expectException(RuntimeException::class);
@@ -244,8 +236,7 @@ public function test_it_throws_an_exception_if_batched_job_contains_batch_with_n
244236
new PendingBatch(
245237
$container,
246238
new Collection(
247-
[new PendingBatch($container, new Collection([new BatchableJob, new class
248-
{
239+
[new PendingBatch($container, new Collection([new BatchableJob, new class {
249240
}]))]
250241
)
251242
);

tests/Database/DatabaseAbstractSchemaGrammarTest.php

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -17,8 +17,7 @@ protected function tearDown(): void
1717
public function testCreateDatabase()
1818
{
1919
$connection = m::mock(Connection::class);
20-
$grammar = new class($connection) extends Grammar
21-
{
20+
$grammar = new class($connection) extends Grammar {
2221
};
2322

2423
$this->assertSame('create database "foo"', $grammar->compileCreateDatabase('foo'));
@@ -27,8 +26,7 @@ public function testCreateDatabase()
2726
public function testDropDatabaseIfExists()
2827
{
2928
$connection = m::mock(Connection::class);
30-
$grammar = new class($connection) extends Grammar
31-
{
29+
$grammar = new class($connection) extends Grammar {
3230
};
3331

3432
$this->assertSame('drop database if exists "foo"', $grammar->compileDropDatabaseIfExists('foo'));

tests/Http/JsonResourceTest.php

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -12,8 +12,7 @@ class JsonResourceTest extends TestCase
1212
{
1313
public function testJsonResourceNullAttributes()
1414
{
15-
$model = new class extends Model
16-
{
15+
$model = new class extends Model {
1716
};
1817

1918
$model->setAttribute('relation_sum_column', null);
@@ -33,8 +32,7 @@ public function testJsonResourceNullAttributes()
3332

3433
public function testJsonResourceToJsonSucceedsWithPriorErrors(): void
3534
{
36-
$model = new class extends Model
37-
{
35+
$model = new class extends Model {
3836
};
3937

4038
$resource = m::mock(JsonResource::class, ['resource' => $model])
@@ -51,8 +49,7 @@ public function testJsonResourceToJsonSucceedsWithPriorErrors(): void
5149

5250
public function testJsonResourceToPrettyPrint(): void
5351
{
54-
$model = new class extends Model
55-
{
52+
$model = new class extends Model {
5653
};
5754

5855
$resource = m::mock(JsonResource::class, ['resource' => $model])

0 commit comments

Comments
 (0)