Skip to content

Commit 0bae34c

Browse files
committed
fix: Revert comparison with null
1 parent 26f3fb6 commit 0bae34c

File tree

4 files changed

+9
-9
lines changed

4 files changed

+9
-9
lines changed

system/CLI/CLI.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -230,7 +230,7 @@ public static function prompt(string $field, $options = null, $validation = null
230230
}
231231

232232
if (! is_array($validation)) {
233-
$validation = ((string) $validation !== '') ? explode('|', $validation) : [];
233+
$validation = ($validation !== null) ? explode('|', $validation) : [];
234234
}
235235

236236
if (is_string($options)) {

system/Common.php

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -75,7 +75,7 @@ function cache(?string $key = null)
7575
$cache = service('cache');
7676

7777
// No params - return cache object
78-
if ((string) $key === '') {
78+
if ($key === null) {
7979
return $cache;
8080
}
8181

@@ -289,7 +289,7 @@ function csrf_hash(): string
289289
*/
290290
function csrf_field(?string $id = null): string
291291
{
292-
return '<input type="hidden"' . ((string) $id !== '' ? ' id="' . esc($id, 'attr') . '"' : '') . ' name="' . csrf_token() . '" value="' . csrf_hash() . '"' . _solidus() . '>';
292+
return '<input type="hidden"' . ($id !== null ? ' id="' . esc($id, 'attr') . '"' : '') . ' name="' . csrf_token() . '" value="' . csrf_hash() . '"' . _solidus() . '>';
293293
}
294294
}
295295

@@ -301,7 +301,7 @@ function csrf_field(?string $id = null): string
301301
*/
302302
function csrf_meta(?string $id = null): string
303303
{
304-
return '<meta' . ((string) $id !== '' ? ' id="' . esc($id, 'attr') . '"' : '') . ' name="' . csrf_header() . '" content="' . csrf_hash() . '"' . _solidus() . '>';
304+
return '<meta' . ($id !== null ? ' id="' . esc($id, 'attr') . '"' : '') . ' name="' . csrf_header() . '" content="' . csrf_hash() . '"' . _solidus() . '>';
305305
}
306306
}
307307

@@ -441,7 +441,7 @@ function esc($data, string $context = 'html', ?string $encoding = null)
441441
$escaper = new Escaper($encoding);
442442
}
443443

444-
if ((string) $encoding !== '' && $escaper->getEncoding() !== $encoding) {
444+
if ($encoding !== null && $escaper->getEncoding() !== $encoding) {
445445
$escaper = new Escaper($encoding);
446446
}
447447

@@ -1128,7 +1128,7 @@ function timer(?string $name = null, ?callable $callable = null)
11281128
{
11291129
$timer = service('timer');
11301130

1131-
if ((string) $name === '') {
1131+
if ($name === null) {
11321132
return $timer;
11331133
}
11341134

system/Database/MigrationRunner.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -161,7 +161,7 @@ public function latest(?string $group = null)
161161

162162
$this->ensureTable();
163163

164-
if ((string) $group !== '') {
164+
if ($group !== null) {
165165
$this->groupFilter = $group;
166166
$this->setGroup($group);
167167
}
@@ -326,7 +326,7 @@ public function force(string $path, string $namespace, ?string $group = null)
326326

327327
$this->ensureTable();
328328

329-
if ((string) $group !== '') {
329+
if ($group !== null) {
330330
$this->groupFilter = $group;
331331
$this->setGroup($group);
332332
}

tests/system/Email/EmailTest.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,7 @@ public function testEmailSendWithClearance($autoClear): void
5555

5656
$this->assertTrue($email->send($autoClear));
5757

58-
if ($autoClear) {
58+
if (! $autoClear) {
5959
$this->assertSame('[email protected]', $email->archive['recipients'][0]);
6060
}
6161
}

0 commit comments

Comments
 (0)