Skip to content

Commit 1cf0a15

Browse files
committed
add NoDiscard attributes
1 parent 8051616 commit 1cf0a15

41 files changed

Lines changed: 98 additions & 94 deletions

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

‎proofs/connection/pdo.php‎

Lines changed: 42 additions & 42 deletions
Original file line numberDiff line numberDiff line change
@@ -51,8 +51,8 @@
5151
static function($assert) use ($connection) {
5252
$table = Table\Name::of('test_lazy_load');
5353

54-
$connection(DropTable::ifExists($table));
55-
$connection(CreateTable::named(
54+
$_ = $connection(DropTable::ifExists($table));
55+
$_ = $connection(CreateTable::named(
5656
$table,
5757
Column::of(
5858
Column\Name::of('i'),
@@ -61,7 +61,7 @@ static function($assert) use ($connection) {
6161
));
6262

6363
for ($i = 0; $i < 100_000; $i++) {
64-
$connection(Insert::into(
64+
$_ = $connection(Insert::into(
6565
$table,
6666
Row::of([
6767
'i' => $i,
@@ -86,7 +86,7 @@ static function($assert) use ($connection) {
8686
->inLessThan()
8787
->megaBytes(3);
8888

89-
$connection(DropTable::named($table));
89+
$_ = $connection(DropTable::named($table));
9090
},
9191
);
9292

@@ -96,15 +96,15 @@ static function($assert) use ($connection) {
9696
static function($assert) use ($connection, $dsn) {
9797
$table = Table\Name::of('test_charset');
9898

99-
$connection(CreateTable::ifNotExists(
99+
$_ = $connection(CreateTable::ifNotExists(
100100
$table,
101101
Column::of(
102102
Column\Name::of('str'),
103103
Column\Type::longtext(),
104104
),
105105
));
106106

107-
$connection(Insert::into(
107+
$_ = $connection(Insert::into(
108108
$table,
109109
Row::of([
110110
'str' => 'gelé',
@@ -139,7 +139,7 @@ static function($assert) use ($connection, $dsn) {
139139
),
140140
);
141141

142-
$connection(DropTable::named($table));
142+
$_ = $connection(DropTable::named($table));
143143
},
144144
);
145145
}
@@ -148,7 +148,7 @@ static function($assert) use ($connection, $dsn) {
148148
"Select join({$driver->name})",
149149
static function($assert) use ($connection) {
150150
$table = Table\Name::of('test_left_join');
151-
$connection(CreateTable::ifNotExists(
151+
$_ = $connection(CreateTable::ifNotExists(
152152
$table,
153153
Column::of(
154154
Column\Name::of('id'),
@@ -163,14 +163,14 @@ static function($assert) use ($connection) {
163163
Column\Type::int()->nullable(),
164164
),
165165
));
166-
$connection(Delete::from($table));
166+
$_ = $connection(Delete::from($table));
167167
$insert = MultipleInsert::into(
168168
$table,
169169
Column\Name::of('id'),
170170
Column\Name::of('name'),
171171
Column\Name::of('parent'),
172172
);
173-
$connection($insert(Sequence::of(
173+
$_ = $connection($insert(Sequence::of(
174174
Row::of([
175175
'id' => 1,
176176
'name' => 'value_1',
@@ -246,7 +246,7 @@ public function value(): int
246246
->toList(),
247247
);
248248

249-
$connection(DropTable::named($table));
249+
$_ = $connection(DropTable::named($table));
250250
},
251251
);
252252

@@ -255,14 +255,14 @@ public function value(): int
255255
static function($assert) use ($connection) {
256256
$parent = Table\Name::of('test_cascade_delete_parent');
257257
$child = Table\Name::of('test_cascade_delete_child');
258-
$connection(CreateTable::ifNotExists(
258+
$_ = $connection(CreateTable::ifNotExists(
259259
$parent,
260260
Column::of(
261261
Column\Name::of('id'),
262262
Column\Type::int(),
263263
),
264264
)->primaryKey(Column\Name::of('id')));
265-
$connection(CreateTable::ifNotExists(
265+
$_ = $connection(CreateTable::ifNotExists(
266266
$child,
267267
Column::of(
268268
Column\Name::of('id'),
@@ -275,9 +275,9 @@ static function($assert) use ($connection) {
275275
)->constraint(
276276
ForeignKey::of(Column\Name::of('parent'), $parent, Column\Name::of('id'))->onDeleteCascade(),
277277
));
278-
$connection(Delete::from($child));
279-
$connection(Delete::from($parent));
280-
$connection(Insert::into(
278+
$_ = $connection(Delete::from($child));
279+
$_ = $connection(Delete::from($parent));
280+
$_ = $connection(Insert::into(
281281
$parent,
282282
Row::of([
283283
'id' => 1,
@@ -288,7 +288,7 @@ static function($assert) use ($connection) {
288288
Column\Name::of('id'),
289289
Column\Name::of('parent'),
290290
);
291-
$connection($insert(Sequence::of(
291+
$_ = $connection($insert(Sequence::of(
292292
Row::of([
293293
'id' => 1,
294294
'parent' => 1,
@@ -299,13 +299,13 @@ static function($assert) use ($connection) {
299299
]),
300300
)));
301301

302-
$connection(Delete::from($parent));
302+
$_ = $connection(Delete::from($parent));
303303
$rows = $connection(Select::from($child));
304304

305305
$assert->same(0, $rows->size());
306306

307-
$connection(DropTable::named($child));
308-
$connection(DropTable::named($parent));
307+
$_ = $connection(DropTable::named($child));
308+
$_ = $connection(DropTable::named($parent));
309309
},
310310
);
311311

@@ -314,14 +314,14 @@ static function($assert) use ($connection) {
314314
static function($assert) use ($connection) {
315315
$parent = Table\Name::of('test_set_null_delete_parent');
316316
$child = Table\Name::of('test_set_null_delete_child');
317-
$connection(CreateTable::ifNotExists(
317+
$_ = $connection(CreateTable::ifNotExists(
318318
$parent,
319319
Column::of(
320320
Column\Name::of('id'),
321321
Column\Type::int(),
322322
),
323323
)->primaryKey(Column\Name::of('id')));
324-
$connection(CreateTable::ifNotExists(
324+
$_ = $connection(CreateTable::ifNotExists(
325325
$child,
326326
Column::of(
327327
Column\Name::of('id'),
@@ -334,9 +334,9 @@ static function($assert) use ($connection) {
334334
)->constraint(
335335
ForeignKey::of(Column\Name::of('parent'), $parent, Column\Name::of('id'))->onDeleteSetNull(),
336336
));
337-
$connection(Delete::from($child));
338-
$connection(Delete::from($parent));
339-
$connection(Insert::into(
337+
$_ = $connection(Delete::from($child));
338+
$_ = $connection(Delete::from($parent));
339+
$_ = $connection(Insert::into(
340340
$parent,
341341
Row::of([
342342
'id' => 1,
@@ -347,7 +347,7 @@ static function($assert) use ($connection) {
347347
Column\Name::of('id'),
348348
Column\Name::of('parent'),
349349
);
350-
$connection($insert(Sequence::of(
350+
$_ = $connection($insert(Sequence::of(
351351
Row::of([
352352
'id' => 1,
353353
'parent' => 1,
@@ -358,7 +358,7 @@ static function($assert) use ($connection) {
358358
]),
359359
)));
360360

361-
$connection(Delete::from($parent));
361+
$_ = $connection(Delete::from($parent));
362362
$rows = $connection(Select::from($child))
363363
->map(static fn($row) => $row->toArray())
364364
->toList();
@@ -370,8 +370,8 @@ static function($assert) use ($connection) {
370370
])
371371
->same($rows);
372372

373-
$connection(DropTable::named($child));
374-
$connection(DropTable::named($parent));
373+
$_ = $connection(DropTable::named($child));
374+
$_ = $connection(DropTable::named($parent));
375375
},
376376
);
377377

@@ -397,14 +397,14 @@ static function($assert) use ($driver) {
397397
static function($assert) use ($connection) {
398398
$parent = Table\Name::of('test_join_delete_parent')->as('parent');
399399
$child = Table\Name::of('test_join_delete_child')->as('child');
400-
$connection(CreateTable::ifNotExists(
400+
$_ = $connection(CreateTable::ifNotExists(
401401
$child->name(),
402402
Column::of(
403403
Column\Name::of('id'),
404404
Column\Type::int(),
405405
),
406406
)->primaryKey(Column\Name::of('id')));
407-
$connection(
407+
$_ = $connection(
408408
CreateTable::ifNotExists(
409409
$parent->name(),
410410
Column::of(
@@ -423,23 +423,23 @@ static function($assert) use ($connection) {
423423
Column\Name::of('id'),
424424
),
425425
);
426-
$connection(Delete::from($parent->name()));
427-
$connection(Delete::from($child->name()));
428-
$connection(Insert::into(
426+
$_ = $connection(Delete::from($parent->name()));
427+
$_ = $connection(Delete::from($child->name()));
428+
$_ = $connection(Insert::into(
429429
$child->name(),
430430
Row::of([
431431
'id' => 2,
432432
]),
433433
));
434-
$connection(Insert::into(
434+
$_ = $connection(Insert::into(
435435
$parent->name(),
436436
Row::of([
437437
'id' => 1,
438438
'child' => 2,
439439
]),
440440
));
441441

442-
$connection(
442+
$_ = $connection(
443443
Delete::from($parent)
444444
->join(
445445
Join::left($child)->on(
@@ -460,8 +460,8 @@ static function($assert) use ($connection) {
460460
$rows = $connection(Select::from($parent));
461461
$assert->same(0, $rows->size());
462462

463-
$connection(DropTable::named($parent->name()));
464-
$connection(DropTable::named($child->name()));
463+
$_ = $connection(DropTable::named($parent->name()));
464+
$_ = $connection(DropTable::named($child->name()));
465465
},
466466
);
467467

@@ -470,7 +470,7 @@ static function($assert) use ($connection) {
470470
given(Set::integers()->between(0, 1_000_000)),
471471
static function($assert, $int) use ($connection) {
472472
$table = Table\Name::of('test_unique');
473-
$connection(CreateTable::ifNotExists(
473+
$_ = $connection(CreateTable::ifNotExists(
474474
$table,
475475
Column::of(
476476
Column\Name::of('id'),
@@ -482,14 +482,14 @@ static function($assert, $int) use ($connection) {
482482
),
483483
)->unique(Column\Name::of('id'), Column\Name::of('other')));
484484

485-
$connection(Insert::into(
485+
$_ = $connection(Insert::into(
486486
$table,
487487
Row::of([
488488
'id' => $int,
489489
'other' => 'foo',
490490
]),
491491
));
492-
$connection(Insert::into(
492+
$_ = $connection(Insert::into(
493493
$table,
494494
Row::of([
495495
'id' => $int,
@@ -505,7 +505,7 @@ static function($assert, $int) use ($connection) {
505505
]),
506506
)));
507507

508-
$connection(DropTable::named($table));
508+
$_ = $connection(DropTable::named($table));
509509
},
510510
);
511511

‎properties/Connection.php‎

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -83,15 +83,15 @@ public static function list(): array
8383

8484
public static function seed(Concrete $connection): void
8585
{
86-
$connection(DropTable::ifExists(Name::of('test')));
87-
$connection(DropTable::ifExists(Name::of('test_values')));
88-
$connection(CreateTable::named(
86+
$_ = $connection(DropTable::ifExists(Name::of('test')));
87+
$_ = $connection(DropTable::ifExists(Name::of('test_values')));
88+
$_ = $connection(CreateTable::named(
8989
Name::of('test'),
9090
Column::of(Column\Name::of('id'), Column\Type::char(36)),
9191
Column::of(Column\Name::of('username'), Column\Type::varchar(255)),
9292
Column::of(Column\Name::of('registerNumber'), Column\Type::bigint()),
9393
)->primaryKey(Column\Name::of('id')));
94-
$connection(CreateTable::named(
94+
$_ = $connection(CreateTable::named(
9595
Name::of('test_values'),
9696
Column::of(Column\Name::of('id'), Column\Type::char(36)),
9797
Column::of(Column\Name::of('value'), Column\Type::varchar(255)),

‎properties/Connection/AQueryWithoutTheCorrectNumberOfParametersMustThrow.php‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ public function ensureHeldBy(Assert $assert, object $connection): object
3333
{
3434
try {
3535
$query = SQL::of('INSERT INTO test VALUES (:uuid, :username, :registerNumber);');
36-
$connection($query);
36+
$_ = $connection($query);
3737
$assert->fail('it should throw an exception');
3838
} catch (QueryFailed $e) {
3939
$assert->same($query, $e->query());

‎properties/Connection/AllowToStartTwoQueriesInParallel.php‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,7 @@ public function ensureHeldBy(Assert $assert, object $connection): object
5353
{
5454
// Insert at least one value to make sure the any() call will always
5555
// return true
56-
$connection(Insert::into(
56+
$_ = $connection(Insert::into(
5757
Name::of('test'),
5858
Row::of([
5959
'id' => $this->uuid,

‎properties/Connection/AnInvalidQueryMustThrow.php‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ public function ensureHeldBy(Assert $assert, object $connection): object
3333
{
3434
try {
3535
$query = SQL::of('INSERT');
36-
$connection($query);
36+
$_ = $connection($query);
3737
$assert->fail('it should throw an exception');
3838
} catch (QueryFailed $e) {
3939
$assert->same($query, $e->query());

‎properties/Connection/CommittingAnUnstartedTransactionMustThrow.php‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ public function ensureHeldBy(Assert $assert, object $connection): object
3333
{
3434
try {
3535
$query = Transaction::commit;
36-
$connection($query);
36+
$_ = $connection($query);
3737
$assert->fail('it should throw an exception');
3838
} catch (QueryFailed $e) {
3939
$assert->same($query, $e->query());

‎properties/Connection/ContentInsertedAfterStartOfTransactionIsAccessible.php‎

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -52,9 +52,9 @@ public function applicableTo(object $connection): bool
5252

5353
public function ensureHeldBy(Assert $assert, object $connection): object
5454
{
55-
$connection(Transaction::start);
55+
$_ = $connection(Transaction::start);
5656

57-
$connection(Insert::into(
57+
$_ = $connection(Insert::into(
5858
Name::of('test'),
5959
Row::of([
6060
'id' => $this->uuid,
@@ -97,7 +97,7 @@ public function ensureHeldBy(Assert $assert, object $connection): object
9797
),
9898
);
9999

100-
$connection(Transaction::commit);
100+
$_ = $connection(Transaction::commit);
101101

102102
return $connection;
103103
}

‎properties/Connection/ContentIsAccessibleAfterCommit.php‎

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -52,9 +52,9 @@ public function applicableTo(object $connection): bool
5252

5353
public function ensureHeldBy(Assert $assert, object $connection): object
5454
{
55-
$connection(Transaction::start);
55+
$_ = $connection(Transaction::start);
5656

57-
$connection(Insert::into(
57+
$_ = $connection(Insert::into(
5858
Name::of('test'),
5959
Row::of([
6060
'id' => $this->uuid,
@@ -63,7 +63,7 @@ public function ensureHeldBy(Assert $assert, object $connection): object
6363
]),
6464
));
6565

66-
$connection(Transaction::commit);
66+
$_ = $connection(Transaction::commit);
6767

6868
$rows = $connection(SQL::of("SELECT * FROM test WHERE id = '{$this->uuid}'"));
6969

0 commit comments

Comments
 (0)