Skip to content

Commit 4f61cb4

Browse files
committed
Revert "refactor: re-run rector to remove null arg on default null param"
This reverts commit 308bdeb.
1 parent 308bdeb commit 4f61cb4

File tree

15 files changed

+47
-44
lines changed

15 files changed

+47
-44
lines changed

system/Debug/Toolbar/Collectors/Database.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -104,7 +104,7 @@ public static function collect(Query $query)
104104
static::$queries[] = [
105105
'query' => $query,
106106
'string' => $queryString,
107-
'duplicate' => in_array($queryString, array_column(static::$queries, 'string'), true),
107+
'duplicate' => in_array($queryString, array_column(static::$queries, 'string', null), true),
108108
'trace' => $backtrace,
109109
];
110110
}

system/Model.php

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -195,7 +195,7 @@ protected function doFind(bool $singleton, $id = null)
195195
}
196196

197197
if ($this->tempUseSoftDeletes) {
198-
$builder->where($this->table . '.' . $this->deletedField);
198+
$builder->where($this->table . '.' . $this->deletedField, null);
199199
}
200200

201201
$row = null;
@@ -279,7 +279,7 @@ protected function doFindAll(?int $limit = null, int $offset = 0)
279279
}
280280

281281
if ($this->tempUseSoftDeletes) {
282-
$builder->where($this->table . '.' . $this->deletedField);
282+
$builder->where($this->table . '.' . $this->deletedField, null);
283283
}
284284

285285
$results = $builder->limit($limit, $offset)
@@ -316,7 +316,7 @@ protected function doFirst()
316316
}
317317

318318
if ($this->tempUseSoftDeletes) {
319-
$builder->where($this->table . '.' . $this->deletedField);
319+
$builder->where($this->table . '.' . $this->deletedField, null);
320320
} elseif ($this->useSoftDeletes && ($builder->QBGroupBy === []) && $this->primaryKey !== '') {
321321
$builder->groupBy($this->table . '.' . $this->primaryKey);
322322
}
@@ -662,7 +662,7 @@ public function chunk(int $size, Closure $userFunc)
662662
public function countAllResults(bool $reset = true, bool $test = false)
663663
{
664664
if ($this->tempUseSoftDeletes) {
665-
$this->builder()->where($this->table . '.' . $this->deletedField);
665+
$this->builder()->where($this->table . '.' . $this->deletedField, null);
666666
}
667667

668668
// When $reset === false, the $tempUseSoftDeletes will be

system/Test/FeatureTestTrait.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -228,7 +228,7 @@ public function call(string $method, string $path, ?array $params = null)
228228
->run($routes, true);
229229

230230
// Reset directory if it has been set
231-
service('router')->setDirectory();
231+
service('router')->setDirectory(null);
232232

233233
return new TestResponse($response);
234234
}

tests/system/CommonFunctionsTest.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -801,7 +801,7 @@ public function testIsWindowsUsingMock(): void
801801
$this->assertFalse(is_windows());
802802
$this->assertNotTrue(is_windows());
803803

804-
is_windows();
804+
is_windows(null);
805805
$this->assertSame(str_contains(php_uname(), 'Windows'), is_windows());
806806
$this->assertSame(defined('PHP_WINDOWS_VERSION_MAJOR'), is_windows());
807807
}

tests/system/Config/ServicesTest.php

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -163,13 +163,13 @@ public function testNewImage(): void
163163

164164
public function testNewNegotiatorWithNullConfig(): void
165165
{
166-
$actual = Services::negotiator();
166+
$actual = Services::negotiator(null);
167167
$this->assertInstanceOf(Negotiate::class, $actual);
168168
}
169169

170170
public function testNewClirequest(): void
171171
{
172-
$actual = Services::clirequest();
172+
$actual = Services::clirequest(null);
173173
$this->assertInstanceOf(CLIRequest::class, $actual);
174174
}
175175

@@ -201,7 +201,7 @@ public function testNewUnsharedLanguage(): void
201201

202202
public function testNewPager(): void
203203
{
204-
$actual = Services::pager();
204+
$actual = Services::pager(null);
205205
$this->assertInstanceOf(Pager::class, $actual);
206206
}
207207

@@ -225,13 +225,13 @@ public function testNewToolbar(): void
225225

226226
public function testNewUri(): void
227227
{
228-
$actual = Services::uri();
228+
$actual = Services::uri(null);
229229
$this->assertInstanceOf(URI::class, $actual);
230230
}
231231

232232
public function testNewValidation(): void
233233
{
234-
$actual = Services::validation();
234+
$actual = Services::validation(null);
235235
$this->assertInstanceOf(Validation::class, $actual);
236236
}
237237

tests/system/Database/Builder/UpdateTest.php

Lines changed: 16 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@ public function testUpdateArray(): void
4343
$builder = new BaseBuilder('jobs', $this->db);
4444

4545
$data = ['name' => 'Programmer'];
46-
$builder->testMode()->where('id', 1)->update($data);
46+
$builder->testMode()->where('id', 1)->update($data, null, null);
4747

4848
$expectedSQL = 'UPDATE "jobs" SET "name" = \'Programmer\' WHERE "id" = 1';
4949
$expectedBinds = [
@@ -66,7 +66,7 @@ public function testUpdateObject(): void
6666
$builder = new BaseBuilder('jobs', $this->db);
6767

6868
$data = (object) ['name' => 'Programmer'];
69-
$builder->testMode()->where('id', 1)->update($data);
69+
$builder->testMode()->where('id', 1)->update($data, null, null);
7070

7171
$expectedSQL = 'UPDATE "jobs" SET "name" = \'Programmer\' WHERE "id" = 1';
7272
$expectedBinds = [
@@ -110,7 +110,7 @@ public function testUpdateWithSet(): void
110110
{
111111
$builder = new BaseBuilder('jobs', $this->db);
112112

113-
$builder->testMode()->set('name', 'Programmer')->where('id', 1)->update();
113+
$builder->testMode()->set('name', 'Programmer')->where('id', 1)->update(null, null, null);
114114

115115
$expectedSQL = 'UPDATE "jobs" SET "name" = \'Programmer\' WHERE "id" = 1';
116116
$expectedBinds = [
@@ -132,7 +132,7 @@ public function testUpdateWithSetAsInt(): void
132132
{
133133
$builder = new BaseBuilder('jobs', $this->db);
134134

135-
$builder->testMode()->set('age', 22)->where('id', 1)->update();
135+
$builder->testMode()->set('age', 22)->where('id', 1)->update(null, null, null);
136136

137137
$expectedSQL = 'UPDATE "jobs" SET "age" = 22 WHERE "id" = 1';
138138
$expectedBinds = [
@@ -154,7 +154,7 @@ public function testUpdateWithSetAsBoolean(): void
154154
{
155155
$builder = new BaseBuilder('jobs', $this->db);
156156

157-
$builder->testMode()->set('manager', true)->where('id', 1)->update();
157+
$builder->testMode()->set('manager', true)->where('id', 1)->update(null, null, null);
158158

159159
$expectedSQL = 'UPDATE "jobs" SET "manager" = 1 WHERE "id" = 1';
160160
$expectedBinds = [
@@ -176,7 +176,7 @@ public function testUpdateWithSetAsArray(): void
176176
{
177177
$builder = new BaseBuilder('jobs', $this->db);
178178

179-
$builder->testMode()->set(['name' => 'Programmer', 'age' => 22, 'manager' => true])->where('id', 1)->update();
179+
$builder->testMode()->set(['name' => 'Programmer', 'age' => 22, 'manager' => true])->where('id', 1)->update(null, null, null);
180180

181181
$expectedSQL = 'UPDATE "jobs" SET "name" = \'Programmer\', "age" = 22, "manager" = 1 WHERE "id" = 1';
182182
$expectedBinds = [
@@ -209,7 +209,7 @@ public function testUpdateThrowsExceptionWithNoData(): void
209209
$this->expectException(DatabaseException::class);
210210
$this->expectExceptionMessage('You must use the "set" method to update an entry.');
211211

212-
$builder->update();
212+
$builder->update(null, null, null);
213213
}
214214

215215
public function testUpdateBatch(): void
@@ -319,7 +319,7 @@ public function testUpdateBatchThrowsExceptionWithNoID(): void
319319
],
320320
];
321321

322-
$builder->updateBatch($set);
322+
$builder->updateBatch($set, null);
323323
}
324324

325325
public function testUpdateBatchThrowsExceptionWithEmptySetArray(): void
@@ -336,7 +336,7 @@ public function testUpdateWithWhereSameColumn(): void
336336
{
337337
$builder = new BaseBuilder('jobs', $this->db);
338338

339-
$builder->testMode()->update(['name' => 'foobar'], ['name' => 'Programmer']);
339+
$builder->testMode()->update(['name' => 'foobar'], ['name' => 'Programmer'], null);
340340

341341
$expectedSQL = 'UPDATE "jobs" SET "name" = \'foobar\' WHERE "name" = \'Programmer\'';
342342
$expectedBinds = [
@@ -361,7 +361,8 @@ public function testUpdateWithWhereSameColumn2(): void
361361

362362
$builder->testMode()
363363
->set('name', 'foobar')
364-
->where('name', 'Programmer')->update();
364+
->where('name', 'Programmer')
365+
->update(null, null, null);
365366

366367
$expectedSQL = 'UPDATE "jobs" SET "name" = \'foobar\' WHERE "name" = \'Programmer\'';
367368
$expectedBinds = [
@@ -386,7 +387,7 @@ public function testUpdateWithWhereSameColumn3(): void
386387

387388
$builder->testMode()
388389
->where('name', 'Programmer')
389-
->update(['name' => 'foobar']);
390+
->update(['name' => 'foobar'], null, null);
390391

391392
$expectedSQL = 'UPDATE "jobs" SET "name" = \'foobar\' WHERE "name" = \'Programmer\'';
392393
$expectedBinds = [
@@ -413,7 +414,8 @@ public function testSetWithoutEscape(): void
413414

414415
$builder->testMode()
415416
->set('field', 'field+1', false)
416-
->where('id', 2)->update();
417+
->where('id', 2)
418+
->update(null, null, null);
417419

418420
$expectedSQL = 'UPDATE "mytable" SET "field" = field+1 WHERE "id" = 2';
419421
$expectedBinds = [
@@ -434,7 +436,8 @@ public function testSetWithAndWithoutEscape(): void
434436
$builder->testMode()
435437
->set('foo', 'bar')
436438
->set('field', 'field+1', false)
437-
->where('id', 2)->update();
439+
->where('id', 2)
440+
->update(null, null, null);
438441

439442
$expectedSQL = 'UPDATE "mytable" SET "foo" = \'bar\', "field" = field+1 WHERE "id" = 2';
440443
$expectedBinds = [

tests/system/Database/Builder/WhereTest.php

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -512,7 +512,7 @@ public function testOrWhereInSubQuery(): void
512512
// Closure
513513
$builder = $this->db->table('jobs');
514514

515-
$builder->where('deleted_at')->orWhereIn('id', static fn (BaseBuilder $builder) => $builder->select('job_id')->from('users_jobs')->where('user_id', 3));
515+
$builder->where('deleted_at', null)->orWhereIn('id', static fn (BaseBuilder $builder) => $builder->select('job_id')->from('users_jobs')->where('user_id', 3));
516516

517517
$this->assertSame($expectedSQL, str_replace("\n", ' ', $builder->getCompiledSelect()));
518518

@@ -523,7 +523,7 @@ public function testOrWhereInSubQuery(): void
523523
->select('job_id')
524524
->where('user_id', 3);
525525

526-
$builder->where('deleted_at')->orWhereIn('id', $subQuery);
526+
$builder->where('deleted_at', null)->orWhereIn('id', $subQuery);
527527

528528
$this->assertSame($expectedSQL, str_replace("\n", ' ', $builder->getCompiledSelect()));
529529
}
@@ -560,7 +560,7 @@ public function testOrWhereNotInSubQuery(): void
560560
// Closure
561561
$builder = $this->db->table('jobs');
562562

563-
$builder->where('deleted_at')->orWhereNotIn('id', static fn (BaseBuilder $builder) => $builder->select('job_id')->from('users_jobs')->where('user_id', 3));
563+
$builder->where('deleted_at', null)->orWhereNotIn('id', static fn (BaseBuilder $builder) => $builder->select('job_id')->from('users_jobs')->where('user_id', 3));
564564

565565
$this->assertSame($expectedSQL, str_replace("\n", ' ', $builder->getCompiledSelect()));
566566

@@ -571,7 +571,7 @@ public function testOrWhereNotInSubQuery(): void
571571
->select('job_id')
572572
->where('user_id', 3);
573573

574-
$builder->where('deleted_at')->orWhereNotIn('id', $subQuery);
574+
$builder->where('deleted_at', null)->orWhereNotIn('id', $subQuery);
575575

576576
$this->assertSame($expectedSQL, str_replace("\n", ' ', $builder->getCompiledSelect()));
577577
}
@@ -692,7 +692,7 @@ public function testWhereValueIsNull(): void
692692
{
693693
$builder = $this->db->table('users');
694694

695-
$builder->where('id');
695+
$builder->where('id', null);
696696

697697
$expectedSQL = 'SELECT * FROM "users" WHERE "id" IS NULL';
698698
$this->assertSame($expectedSQL, str_replace("\n", ' ', $builder->getCompiledSelect()));

tests/system/Database/Live/WhereTest.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -178,7 +178,7 @@ public function testWhereNullParam(): void
178178
]);
179179

180180
$jobs = $this->db->table('job')
181-
->where('description')
181+
->where('description', null)
182182
->get()
183183
->getResult();
184184

tests/system/Database/Live/WriteTypeQueryTest.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -142,7 +142,7 @@ public function testInsertWithMultiReturning(): void
142142
public function testUpdateBuilder(): void
143143
{
144144
$builder = new BaseBuilder('jobs', $this->db);
145-
$builder->testMode()->where('id', 1)->update(['name' => 'Programmer']);
145+
$builder->testMode()->where('id', 1)->update(['name' => 'Programmer'], null, null);
146146
$sql = $builder->getCompiledInsert();
147147

148148
$this->assertTrue($this->db->isWriteType($sql));

tests/system/HTTP/HeaderTest.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -126,7 +126,7 @@ public function testHeaderAppendsValueSkippedForNull(): void
126126

127127
$header = new Header($name, $value);
128128

129-
$header->appendValue();
129+
$header->appendValue(null);
130130

131131
$this->assertSame($name, $header->getName());
132132
$this->assertSame($expected, $header->getValue());
@@ -158,7 +158,7 @@ public function testHeaderPrependsValueSkippedForNull(): void
158158

159159
$header = new Header($name, $value);
160160

161-
$header->prependValue();
161+
$header->prependValue(null);
162162

163163
$this->assertSame($name, $header->getName());
164164
$this->assertSame($expected, $header->getValue());
@@ -204,7 +204,7 @@ public function testHeaderSetValueWithNullWillMarkAsEmptyString(): void
204204
$expected = '';
205205

206206
$header = new Header($name);
207-
$header->setValue('bar')->setValue();
207+
$header->setValue('bar')->setValue(null);
208208

209209
$this->assertSame($name, $header->getName());
210210
$this->assertSame($expected, $header->getValueLine());

0 commit comments

Comments
 (0)