Skip to content

Commit 7d4bd5c

Browse files
committed
refactor: replace empty()
1 parent c12177a commit 7d4bd5c

File tree

2 files changed

+4
-14
lines changed

2 files changed

+4
-14
lines changed

phpstan-baseline.php

Lines changed: 0 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,6 @@
11
<?php declare(strict_types = 1);
22

33
$ignoreErrors = [];
4-
$ignoreErrors[] = [
5-
'message' => '#^Construct empty\\(\\) is not allowed\\. Use more strict comparison\\.$#',
6-
'count' => 1,
7-
'path' => __DIR__ . '/src/Auth.php',
8-
];
9-
$ignoreErrors[] = [
10-
'message' => '#^Only booleans are allowed in a ternary operator condition, CodeIgniter\\\\Shield\\\\Entities\\\\User\\|null given\\.$#',
11-
'count' => 1,
12-
'path' => __DIR__ . '/src/Auth.php',
13-
];
144
$ignoreErrors[] = [
155
'message' => '#^Call to deprecated function random_string\\(\\)\\:
166
The type \'basic\', \'md5\', and \'sha1\' are deprecated\\. They are not cryptographically secure\\.$#',

src/Auth.php

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -67,7 +67,7 @@ protected function ensureAuthentication(): void
6767
*/
6868
public function setAuthenticator(?string $alias = null): self
6969
{
70-
if (! empty($alias)) {
70+
if ($alias !== null) {
7171
$this->alias = $alias;
7272
}
7373

@@ -102,9 +102,9 @@ public function user(): ?User
102102
*/
103103
public function id()
104104
{
105-
return ($user = $this->user())
106-
? $user->id
107-
: null;
105+
$user = $this->user();
106+
107+
return ($user !== null) ? $user->id : null;
108108
}
109109

110110
public function authenticate(array $credentials): Result

0 commit comments

Comments
 (0)