Skip to content

Commit

Permalink
fix: Revert comparison with null
Browse files Browse the repository at this point in the history
  • Loading branch information
neznaika0 committed Dec 28, 2024
1 parent 26f3fb6 commit 0bae34c
Show file tree
Hide file tree
Showing 4 changed files with 9 additions and 9 deletions.
2 changes: 1 addition & 1 deletion system/CLI/CLI.php
Original file line number Diff line number Diff line change
Expand Up @@ -230,7 +230,7 @@ public static function prompt(string $field, $options = null, $validation = null
}

if (! is_array($validation)) {
$validation = ((string) $validation !== '') ? explode('|', $validation) : [];
$validation = ($validation !== null) ? explode('|', $validation) : [];
}

if (is_string($options)) {
Expand Down
10 changes: 5 additions & 5 deletions system/Common.php
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,7 @@ function cache(?string $key = null)
$cache = service('cache');

// No params - return cache object
if ((string) $key === '') {
if ($key === null) {
return $cache;
}

Expand Down Expand Up @@ -289,7 +289,7 @@ function csrf_hash(): string
*/
function csrf_field(?string $id = null): string
{
return '<input type="hidden"' . ((string) $id !== '' ? ' id="' . esc($id, 'attr') . '"' : '') . ' name="' . csrf_token() . '" value="' . csrf_hash() . '"' . _solidus() . '>';
return '<input type="hidden"' . ($id !== null ? ' id="' . esc($id, 'attr') . '"' : '') . ' name="' . csrf_token() . '" value="' . csrf_hash() . '"' . _solidus() . '>';
}
}

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

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

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

Expand Down Expand Up @@ -1128,7 +1128,7 @@ function timer(?string $name = null, ?callable $callable = null)
{
$timer = service('timer');

if ((string) $name === '') {
if ($name === null) {
return $timer;
}

Expand Down
4 changes: 2 additions & 2 deletions system/Database/MigrationRunner.php
Original file line number Diff line number Diff line change
Expand Up @@ -161,7 +161,7 @@ public function latest(?string $group = null)

$this->ensureTable();

if ((string) $group !== '') {
if ($group !== null) {
$this->groupFilter = $group;
$this->setGroup($group);
}
Expand Down Expand Up @@ -326,7 +326,7 @@ public function force(string $path, string $namespace, ?string $group = null)

$this->ensureTable();

if ((string) $group !== '') {
if ($group !== null) {
$this->groupFilter = $group;
$this->setGroup($group);
}
Expand Down
2 changes: 1 addition & 1 deletion tests/system/Email/EmailTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ public function testEmailSendWithClearance($autoClear): void

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

if ($autoClear) {
if (! $autoClear) {
$this->assertSame('foo@foo.com', $email->archive['recipients'][0]);
}
}
Expand Down

0 comments on commit 0bae34c

Please sign in to comment.