Skip to content

Commit 6cd4a11

Browse files
authored
Merge pull request #4797 from paulbalandan/cast-spaces
Ensure single space between cast and variable
2 parents 517e2ee + 6121819 commit 6cd4a11

File tree

9 files changed

+26
-25
lines changed

9 files changed

+26
-25
lines changed

system/Session/Handlers/DatabaseHandler.php

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -295,9 +295,10 @@ public function destroy($sessionID): bool
295295
*/
296296
public function gc($maxlifetime): bool
297297
{
298-
$interval = implode(" '"[(int)($this->platform === 'postgre')], ['', "{$maxlifetime} second", '']);
298+
$separator = $this->platform === 'postgre' ? '\'' : ' ';
299+
$interval = implode($separator, ['', "{$maxlifetime} second", '']);
299300

300-
return ($this->db->table($this->table)->delete("timestamp < now() - INTERVAL {$interval}")) ? true : $this->fail();
301+
return $this->db->table($this->table)->delete("timestamp < now() - INTERVAL {$interval}") ? true : $this->fail();
301302
}
302303

303304
//--------------------------------------------------------------------

tests/system/API/ResponseTraitTest.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -166,7 +166,7 @@ public function testPHPtoArrayPayload()
166166
"id": 1
167167
}
168168
EOH;
169-
$controller->respond((array)$payload);
169+
$controller->respond((array) $payload);
170170
$this->assertEquals($expected, $this->response->getBody());
171171
}
172172

tests/system/Database/Migrations/MigrationRunnerTest.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -197,7 +197,7 @@ public function testFindMigrationsSuccessTimestamp()
197197

198198
$runner = $runner->setNamespace('Tests\Support\MigrationTestMigrations');
199199

200-
$mig1 = (object)[
200+
$mig1 = (object) [
201201
'name' => 'Some_migration',
202202
'path' => TESTPATH . '_support/MigrationTestMigrations/Database/Migrations/2018-01-24-102301_Some_migration.php',
203203
'version' => '2018-01-24-102301',
@@ -206,7 +206,7 @@ public function testFindMigrationsSuccessTimestamp()
206206
];
207207
$mig1->uid = $runner->getObjectUid($mig1);
208208

209-
$mig2 = (object)[
209+
$mig2 = (object) [
210210
'name' => 'Another_migration',
211211
'path' => TESTPATH . '_support/MigrationTestMigrations/Database/Migrations/2018-01-24-102302_Another_migration.php',
212212
'version' => '2018-01-24-102302',

tests/system/Filters/FiltersTest.php

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -727,8 +727,7 @@ public function testEnableFilterWithArguments()
727727
],
728728
];
729729

730-
$filters = new Filters((object)$config, $this->request, $this->response);
731-
730+
$filters = new Filters((object) $config, $this->request, $this->response);
732731
$filters = $filters->initialize('admin/foo/bar');
733732

734733
$filters->enableFilter('role:admin , super', 'before');
@@ -759,7 +758,7 @@ public function testEnableFilterWithNoArguments()
759758
],
760759
];
761760

762-
$filters = new Filters((object)$config, $this->request, $this->response);
761+
$filters = new Filters((object) $config, $this->request, $this->response);
763762

764763
$filters = $filters->initialize('admin/foo/bar');
765764

tests/system/HTTP/HeaderTest.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -209,6 +209,6 @@ public function testHeaderToStringShowsEntireHeader()
209209
$header->setValue('bar')
210210
->appendValue(['baz' => 'fuzz']);
211211

212-
$this->assertEquals($expected, (string)$header);
212+
$this->assertEquals($expected, (string) $header);
213213
}
214214
}

tests/system/Models/ValidationModelTest.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -290,7 +290,7 @@ public function testValidationIncludingErrors(): void
290290
$this->createModel(ValidErrorsModel::class);
291291

292292
$id = $this->model->insert($data);
293-
$this->assertFalse((bool)$id);
293+
$this->assertFalse((bool) $id);
294294
$this->assertSame('Minimum Length Error', $this->model->errors()['name']);
295295
}
296296

tests/system/Pager/PagerTest.php

Lines changed: 14 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -229,9 +229,9 @@ public function testGetNextURIUsesCurrentURI()
229229
$this->pager->store('foo', 2, 12, 70);
230230

231231
$expected = current_url(true);
232-
$expected = (string)$expected->setQuery('page_foo=3');
232+
$expected = (string) $expected->setQuery('page_foo=3');
233233

234-
$this->assertEquals((string)$expected, $this->pager->getNextPageURI('foo'));
234+
$this->assertEquals((string) $expected, $this->pager->getNextPageURI('foo'));
235235
}
236236

237237
public function testGetNextURIReturnsNullOnLastPage()
@@ -246,7 +246,7 @@ public function testGetNextURICorrectOnFirstPage()
246246
$this->pager->store('foo', 1, 12, 70);
247247

248248
$expected = current_url(true);
249-
$expected = (string)$expected->setQuery('page_foo=2');
249+
$expected = (string) $expected->setQuery('page_foo=2');
250250

251251
$this->assertEquals($expected, $this->pager->getNextPageURI('foo'));
252252
}
@@ -258,9 +258,9 @@ public function testGetPreviousURIUsesCurrentURI()
258258
$this->pager->store('foo', 2, 12, 70);
259259

260260
$expected = current_url(true);
261-
$expected = (string)$expected->setQuery('page_foo=1');
261+
$expected = (string) $expected->setQuery('page_foo=1');
262262

263-
$this->assertEquals((string)$expected, $this->pager->getPreviousPageURI('foo'));
263+
$this->assertEquals((string) $expected, $this->pager->getPreviousPageURI('foo'));
264264
}
265265

266266
public function testGetNextURIReturnsNullOnFirstPage()
@@ -278,11 +278,11 @@ public function testGetNextURIWithQueryStringUsesCurrentURI()
278278
];
279279

280280
$expected = current_url(true);
281-
$expected = (string)$expected->setQueryArray($_GET);
281+
$expected = (string) $expected->setQueryArray($_GET);
282282

283283
$this->pager->store('foo', $_GET['page_foo'] - 1, 12, 70);
284284

285-
$this->assertEquals((string)$expected, $this->pager->getNextPageURI('foo'));
285+
$this->assertEquals((string) $expected, $this->pager->getNextPageURI('foo'));
286286
}
287287

288288
public function testGetPreviousURIWithQueryStringUsesCurrentURI()
@@ -292,11 +292,11 @@ public function testGetPreviousURIWithQueryStringUsesCurrentURI()
292292
'status' => 1,
293293
];
294294
$expected = current_url(true);
295-
$expected = (string)$expected->setQueryArray($_GET);
295+
$expected = (string) $expected->setQueryArray($_GET);
296296

297297
$this->pager->store('foo', $_GET['page_foo'] + 1, 12, 70);
298298

299-
$this->assertEquals((string)$expected, $this->pager->getPreviousPageURI('foo'));
299+
$this->assertEquals((string) $expected, $this->pager->getPreviousPageURI('foo'));
300300
}
301301

302302
public function testGetOnlyQueries()
@@ -319,15 +319,15 @@ public function testGetOnlyQueries()
319319

320320
$this->assertEquals(
321321
$this->pager->only($onlyQueries)
322-
->getPreviousPageURI(), (string)$uri->setQuery('search=foo&order=asc&page=1')
322+
->getPreviousPageURI(), (string) $uri->setQuery('search=foo&order=asc&page=1')
323323
);
324324
$this->assertEquals(
325325
$this->pager->only($onlyQueries)
326-
->getNextPageURI(), (string)$uri->setQuery('search=foo&order=asc&page=3')
326+
->getNextPageURI(), (string) $uri->setQuery('search=foo&order=asc&page=3')
327327
);
328328
$this->assertEquals(
329329
$this->pager->only($onlyQueries)
330-
->getPageURI(4), (string)$uri->setQuery('search=foo&order=asc&page=4')
330+
->getPageURI(4), (string) $uri->setQuery('search=foo&order=asc&page=4')
331331
);
332332
}
333333

@@ -430,9 +430,9 @@ public function testBasedURI()
430430
$this->pager->store('foo', 2, 12, 70);
431431

432432
$expected = current_url(true);
433-
$expected = (string)$expected->setQuery('page_foo=1');
433+
$expected = (string) $expected->setQuery('page_foo=1');
434434

435-
$this->assertEquals((string)$expected, $this->pager->getPreviousPageURI('foo'));
435+
$this->assertEquals((string) $expected, $this->pager->getPreviousPageURI('foo'));
436436
}
437437

438438
public function testAccessPageMoreThanPageCountGetLastPage()

tests/system/Validation/RulesTest.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@ protected function setUp(): void
4343
{
4444
parent::setUp();
4545

46-
$this->validation = new Validation((object)$this->config, Services::renderer());
46+
$this->validation = new Validation((object) $this->config, Services::renderer());
4747
$this->validation->reset();
4848

4949
$_FILES = [];

utils/PhpCsFixer/CodeIgniter4.php

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -61,6 +61,7 @@ public function __construct()
6161
'position_after_control_structures' => 'same',
6262
'position_after_functions_and_oop_constructs' => 'next',
6363
],
64+
'cast_spaces' => ['space' => 'single'],
6465
'function_to_constant' => true,
6566
'indentation_type' => true,
6667
'line_ending' => true,

0 commit comments

Comments
 (0)