Skip to content

Commit 71006e5

Browse files
committed
Fix phpstan error
1 parent 3565a83 commit 71006e5

File tree

6 files changed

+47
-47
lines changed

6 files changed

+47
-47
lines changed

src/Model/Behavior/InsertBehavior.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ class InsertBehavior extends Behavior
2222
* @var array
2323
*/
2424
protected $_defaultConfig = [
25-
'event' => ['beforeSave' => true]
25+
'event' => ['beforeSave' => true],
2626
];
2727

2828
/**
@@ -127,7 +127,7 @@ private function buildTmpTableSelectQuery($escapedData)
127127
}
128128

129129
$tmpTable = TableRegistry::getTableLocator()->get('tmp', [
130-
'schema' => $this->_table->getSchema()
130+
'schema' => $this->_table->getSchema(),
131131
]);
132132
$query = $tmpTable
133133
->find()

src/Model/Behavior/UpsertBehavior.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ class UpsertBehavior extends Behavior
2121
protected $_defaultConfig = [
2222
'updateColumns' => null,
2323
'uniqueColumns' => null,
24-
'event' => ['beforeSave' => true]
24+
'event' => ['beforeSave' => true],
2525
];
2626

2727
/**

tests/Fixture/ArticlesFixture.php

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -14,30 +14,30 @@ class ArticlesFixture extends TestFixture
1414
'created' => 'datetime',
1515
'modified' => 'datetime',
1616
'_constraints' => [
17-
'primary' => ['type' => 'primary', 'columns' => ['id']]
18-
]
17+
'primary' => ['type' => 'primary', 'columns' => ['id']],
18+
],
1919
];
2020
public $records = [
2121
[
2222
'title' => 'First Article',
2323
'body' => 'First Article Body',
2424
'published' => 1,
2525
'created' => '2017-09-01 00:00:00',
26-
'modified' => '2017-09-01 00:00:00'
26+
'modified' => '2017-09-01 00:00:00',
2727
],
2828
[
2929
'title' => 'Second Article',
3030
'body' => 'Second Article Body',
3131
'published' => 1,
3232
'created' => '2017-09-01 00:00:00',
33-
'modified' => '2017-09-01 00:00:00'
33+
'modified' => '2017-09-01 00:00:00',
3434
],
3535
[
3636
'title' => 'Third Article',
3737
'body' => 'Third Article Body',
3838
'published' => 1,
3939
'created' => '2017-09-01 00:00:00',
40-
'modified' => '2017-09-01 00:00:00'
40+
'modified' => '2017-09-01 00:00:00',
4141
]
4242
];
4343
}

tests/Fixture/TagsFixture.php

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -14,27 +14,27 @@ class TagsFixture extends TestFixture
1414
'modified' => 'datetime',
1515
'_constraints' => [
1616
'primary' => ['type' => 'primary', 'columns' => ['id']],
17-
'unique' => ['type' => 'unique', 'columns' => ['name']]
18-
]
17+
'unique' => ['type' => 'unique', 'columns' => ['name']],
18+
],
1919
];
2020
public $records = [
2121
[
2222
'name' => 'tag1',
2323
'description' => 'tag1 description',
2424
'created' => '2017-09-01 00:00:00',
25-
'modified' => '2017-09-01 00:00:00'
25+
'modified' => '2017-09-01 00:00:00',
2626
],
2727
[
2828
'name' => 'tag2',
2929
'description' => 'tag2 description',
3030
'created' => '2017-09-01 00:00:00',
31-
'modified' => '2017-09-01 00:00:00'
31+
'modified' => '2017-09-01 00:00:00',
3232
],
3333
[
3434
'name' => 'tag3',
3535
'description' => 'tag3 description',
3636
'created' => '2017-09-01 00:00:00',
37-
'modified' => '2017-09-01 00:00:00'
37+
'modified' => '2017-09-01 00:00:00',
3838
]
3939
];
4040
}

tests/TestCase/Model/Behavior/InsertBehaviorTest.php

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -110,7 +110,7 @@ public function testBulkInsertNoBeforeSave()
110110
{
111111
$this->Articles->removeBehavior('Insert');
112112
$this->Articles->addBehavior('Itosho/EasyQuery.Insert', [
113-
'event' => ['beforeSave' => false]
113+
'event' => ['beforeSave' => false],
114114
]);
115115

116116
$records = $this->getBaseInsertRecords();
@@ -159,7 +159,7 @@ public function testInsertOnce()
159159
$newData = [
160160
'title' => 'New Article',
161161
'body' => 'New Article Body',
162-
'published' => 1
162+
'published' => 1,
163163
];
164164
$entity = $this->Articles->newEntity($newData);
165165

@@ -185,7 +185,7 @@ public function testInsertOnceAddTimestampBehavior()
185185
$newData = [
186186
'title' => 'New Article',
187187
'body' => 'New Article Body',
188-
'published' => 1
188+
'published' => 1,
189189
];
190190
$entity = $this->Articles->newEntity($newData);
191191
$now = FrozenTime::now();
@@ -209,7 +209,7 @@ public function testInsertOnceWhenDuplicated()
209209
$duplicatedData = [
210210
'title' => 'First Article',
211211
'body' => 'First Article Body',
212-
'published' => 1
212+
'published' => 1,
213213
];
214214
$entity = $this->Articles->newEntity($duplicatedData);
215215

@@ -233,7 +233,7 @@ public function testInsertOnceWhenIsNull()
233233
$newData = [
234234
'title' => 'First Article',
235235
'body' => null,
236-
'published' => 1
236+
'published' => 1,
237237
];
238238
$entity = $this->Articles->newEntity($newData);
239239

@@ -244,7 +244,7 @@ public function testInsertOnceWhenIsNull()
244244
->where([
245245
'title' => 'First Article',
246246
'body IS' => null,
247-
'published' => 1
247+
'published' => 1,
248248
])
249249
->all();
250250

@@ -261,7 +261,7 @@ public function testInsertOnceWithConditions()
261261
$newData = [
262262
'title' => 'First Article',
263263
'body' => 'First Article Body',
264-
'published' => 0
264+
'published' => 0,
265265
];
266266
$entity = $this->Articles->newEntity($newData);
267267

@@ -276,7 +276,7 @@ public function testInsertOnceWithConditions()
276276
->find()
277277
->where([
278278
'title' => 'First Article',
279-
'body' => 'First Article Body'
279+
'body' => 'First Article Body',
280280
])
281281
->all();
282282

@@ -293,7 +293,7 @@ public function testInsertOnceWhenDuplicatedWithConditions()
293293
$newData = [
294294
'title' => 'First Article',
295295
'body' => 'First Article Body',
296-
'published' => 0
296+
'published' => 0,
297297
];
298298
$entity = $this->Articles->newEntity($newData);
299299

@@ -323,17 +323,17 @@ private function getBaseInsertRecords()
323323
[
324324
'title' => 'Fourth Article',
325325
'body' => 'Fourth Article Body',
326-
'published' => 1
326+
'published' => 1,
327327
],
328328
[
329329
'title' => 'Fifth Article',
330330
'body' => 'Fifth Article Body',
331-
'published' => 1
331+
'published' => 1,
332332
],
333333
[
334334
'title' => 'Sixth Article',
335335
'body' => 'Sixth Article Body',
336-
'published' => 1
336+
'published' => 1,
337337
]
338338
];
339339
}

tests/TestCase/Model/Behavior/UpsertBehaviorTest.php

Lines changed: 22 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ public function setUp()
3434
$this->Tags = TableRegistry::getTableLocator()->get('Itosho/EasyQuery.Tags');
3535
$this->Tags->addBehavior('Itosho/EasyQuery.Upsert', [
3636
'uniqueColumns' => ['name'],
37-
'updateColumns' => ['description', 'modified']
37+
'updateColumns' => ['description', 'modified'],
3838
]);
3939
}
4040

@@ -60,7 +60,7 @@ public function testUpsertByInsert()
6060
'name' => 'tag4',
6161
'description' => 'tag4 description',
6262
'created' => $now,
63-
'modified' => $now
63+
'modified' => $now,
6464
];
6565
$entity = $this->Tags->newEntity($record);
6666
$actual = $this->Tags->upsert($entity);
@@ -94,7 +94,7 @@ public function testUpsertByInsertAddTimestamp()
9494

9595
$record = [
9696
'name' => 'tag4',
97-
'description' => 'tag4 description'
97+
'description' => 'tag4 description',
9898
];
9999
$now = Chronos::now();
100100
$expectedRecord = $record;
@@ -133,7 +133,7 @@ public function testUpsertByUpdate()
133133
'name' => 'tag1',
134134
'description' => 'brand new tag1 description',
135135
'created' => '2017-10-01 00:00:00',
136-
'modified' => '2017-10-01 00:00:00'
136+
'modified' => '2017-10-01 00:00:00',
137137
];
138138
$entity = $this->Tags->newEntity($record);
139139
$actual = $this->Tags->upsert($entity);
@@ -169,7 +169,7 @@ public function testUpsertByUpdateAddTimestamp()
169169

170170
$record = [
171171
'name' => 'tag1',
172-
'description' => 'brand new tag1 description'
172+
'description' => 'brand new tag1 description',
173173
];
174174
$now = Chronos::now();
175175
$currentCreated = '2017-09-01 00:00:00';
@@ -209,7 +209,7 @@ public function testUpsertNoBeforeSave()
209209
$this->Tags->addBehavior('Itosho/EasyQuery.Upsert', [
210210
'uniqueColumns' => ['name'],
211211
'updateColumns' => ['description', 'modified'],
212-
'event' => ['beforeSave' => false]
212+
'event' => ['beforeSave' => false],
213213
]);
214214
$this->Tags->addBehavior('Timestamp');
215215

@@ -245,14 +245,14 @@ public function testUpsertInvalidUpdateColumnsConfig()
245245
{
246246
$this->Tags->removeBehavior('Upsert');
247247
$this->Tags->addBehavior('Itosho/EasyQuery.Upsert', [
248-
'uniqueColumns' => ['name']
248+
'uniqueColumns' => ['name'],
249249
]);
250250

251251
$data = [
252252
'name' => 'tag4',
253253
'description' => 'tag4 description',
254254
'created' => '2017-09-01 00:00:00',
255-
'modified' => '2017-09-01 00:00:00'
255+
'modified' => '2017-09-01 00:00:00',
256256
];
257257
$entity = $this->Tags->newEntity($data);
258258
$this->Tags->upsert($entity);
@@ -269,14 +269,14 @@ public function testUpsertInvalidUniqueColumnsConfig()
269269
{
270270
$this->Tags->removeBehavior('Upsert');
271271
$this->Tags->addBehavior('Itosho/EasyQuery.Upsert', [
272-
'updateColumns' => ['description', 'modified']
272+
'updateColumns' => ['description', 'modified'],
273273
]);
274274

275275
$data = [
276276
'name' => 'tag4',
277277
'description' => 'tag4 description',
278278
'created' => '2017-09-01 00:00:00',
279-
'modified' => '2017-09-01 00:00:00'
279+
'modified' => '2017-09-01 00:00:00',
280280
];
281281
$entity = $this->Tags->newEntity($data);
282282
$this->Tags->upsert($entity);
@@ -291,7 +291,7 @@ public function testBulkUpsertByInsert()
291291
{
292292
$this->Tags->removeBehavior('Upsert');
293293
$this->Tags->addBehavior('Itosho/EasyQuery.Upsert', [
294-
'updateColumns' => ['description', 'modified']
294+
'updateColumns' => ['description', 'modified'],
295295
]);
296296

297297
$records = $this->getBaseInsertRecords();
@@ -319,7 +319,7 @@ public function testBulkUpsertByInsertAddTimestamp()
319319
{
320320
$this->Tags->removeBehavior('Upsert');
321321
$this->Tags->addBehavior('Itosho/EasyQuery.Upsert', [
322-
'updateColumns' => ['description', 'modified']
322+
'updateColumns' => ['description', 'modified'],
323323
]);
324324
$this->Tags->addBehavior('Timestamp');
325325

@@ -349,7 +349,7 @@ public function testBulkUpsertByUpdate()
349349
{
350350
$this->Tags->removeBehavior('Upsert');
351351
$this->Tags->addBehavior('Itosho/EasyQuery.Upsert', [
352-
'updateColumns' => ['description', 'modified']
352+
'updateColumns' => ['description', 'modified'],
353353
]);
354354

355355
$records = $this->getBaseUpdateRecords();
@@ -379,7 +379,7 @@ public function testBulkUpsertByUpdateAddTimestamp()
379379
{
380380
$this->Tags->removeBehavior('Upsert');
381381
$this->Tags->addBehavior('Itosho/EasyQuery.Upsert', [
382-
'updateColumns' => ['description', 'modified']
382+
'updateColumns' => ['description', 'modified'],
383383
]);
384384
$this->Tags->addBehavior('Timestamp');
385385

@@ -411,7 +411,7 @@ public function testBulkUpsertNoBeforeSave()
411411
$this->Tags->removeBehavior('Upsert');
412412
$this->Tags->addBehavior('Itosho/EasyQuery.Upsert', [
413413
'updateColumns' => ['description', 'modified'],
414-
'event' => ['beforeSave' => false]
414+
'event' => ['beforeSave' => false],
415415
]);
416416
$this->Tags->addBehavior('Timestamp');
417417

@@ -465,7 +465,7 @@ public function testBulkUpsertNoSaveData()
465465
{
466466
$this->Tags->removeBehavior('Upsert');
467467
$this->Tags->addBehavior('Itosho/EasyQuery.Upsert', [
468-
'updateColumns' => ['description', 'modified']
468+
'updateColumns' => ['description', 'modified'],
469469
]);
470470

471471
$this->Tags->bulkUpsert([]);
@@ -481,15 +481,15 @@ private function getBaseInsertRecords()
481481
return [
482482
[
483483
'name' => 'tag4',
484-
'description' => 'tag4 description'
484+
'description' => 'tag4 description',
485485
],
486486
[
487487
'name' => 'tag5',
488-
'description' => 'tag5 description'
488+
'description' => 'tag5 description',
489489
],
490490
[
491491
'name' => 'tag6',
492-
'description' => 'tag6 description'
492+
'description' => 'tag6 description',
493493
]
494494
];
495495
}
@@ -504,15 +504,15 @@ private function getBaseUpdateRecords()
504504
return [
505505
[
506506
'name' => 'tag1',
507-
'description' => 'brand new tag1 description'
507+
'description' => 'brand new tag1 description',
508508
],
509509
[
510510
'name' => 'tag2',
511-
'description' => 'brand new tag2 description'
511+
'description' => 'brand new tag2 description',
512512
],
513513
[
514514
'name' => 'tag3',
515-
'description' => 'brand new tag3 description'
515+
'description' => 'brand new tag3 description',
516516
]
517517
];
518518
}

0 commit comments

Comments
 (0)