Skip to content

Commit

Permalink
PHPStan changed to 8 and composer fix
Browse files Browse the repository at this point in the history
  • Loading branch information
omerimzali committed Sep 30, 2023
1 parent 6cdc44a commit 157f21f
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 8 deletions.
2 changes: 1 addition & 1 deletion phpstan-baseline.php
Original file line number Diff line number Diff line change
Expand Up @@ -318,7 +318,7 @@
];
$ignoreErrors[] = [
'message' => '#^Call to method PHPUnit\\\\Framework\\\\Assert\\:\\:assertInstanceOf\\(\\) with \'CodeIgniter\\\\\\\\Shield\\\\\\\\Result\' and CodeIgniter\\\\Shield\\\\Result will always evaluate to true\\.$#',
'count' => 9,
'count' => 8,
'path' => __DIR__ . '/tests/Authentication/Authenticators/SessionAuthenticatorTest.php',
];
$ignoreErrors[] = [
Expand Down
12 changes: 6 additions & 6 deletions src/Authentication/Authenticators/Session.php
Original file line number Diff line number Diff line change
Expand Up @@ -130,7 +130,7 @@ public function attempt(array $credentials): Result
$result = $this->check($credentials);

// Credentials mismatch.
if (!$result->isOK()) {
if (! $result->isOK()) {
// Always record a login attempt, whether success or not.
$this->recordLoginAttempt($credentials, false, $ipAddress, $userAgent);

Expand Down Expand Up @@ -173,7 +173,7 @@ public function attempt(array $credentials): Result

$this->issueRememberMeToken();

if (!$this->hasAction()) {
if (! $this->hasAction()) {
$this->completeLogin($user);
}

Expand Down Expand Up @@ -284,10 +284,10 @@ private function recordLoginAttempt(

$field = array_pop($field);

if (!in_array($field, ['email', 'username'], true)) {
if (! in_array($field, ['email', 'username'], true)) {
$idType = $field;
} else {
$idType = (!isset($credentials['email']) && isset($credentials['username']))
$idType = (! isset($credentials['email']) && isset($credentials['username']))
? self::ID_TYPE_USERNAME
: self::ID_TYPE_EMAIL_PASSWORD;
}
Expand Down Expand Up @@ -337,7 +337,7 @@ public function check(array $credentials): Result
$passwords = service('passwords');

// Now, try matching the passwords.
if (!$passwords->verify($givenPassword, $user->password_hash)) {
if (! $passwords->verify($givenPassword, $user->password_hash)) {
return new Result([
'success' => false,
'reason' => lang('Auth.invalidPassword'),
Expand Down Expand Up @@ -885,7 +885,7 @@ public function getPendingUser(): ?User
*/
public function recordActiveDate(): void
{
if (!$this->user instanceof User) {
if (! $this->user instanceof User) {
throw new InvalidArgumentException(
__METHOD__ . '() requires logged in user before calling.'
);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,6 @@
use CodeIgniter\Shield\Entities\User;
use CodeIgniter\Shield\Exceptions\LogicException;
use CodeIgniter\Shield\Models\RememberModel;
use CodeIgniter\Shield\Models\UserIdentityModel;
use CodeIgniter\Shield\Models\UserModel;
use CodeIgniter\Shield\Result;
use CodeIgniter\Test\Mock\MockEvents;
Expand Down

0 comments on commit 157f21f

Please sign in to comment.