Skip to content

Commit

Permalink
refactor: fix method names with incorrect case
Browse files Browse the repository at this point in the history
  • Loading branch information
kenjis committed Aug 12, 2024
1 parent a0fcea8 commit 317477e
Show file tree
Hide file tree
Showing 4 changed files with 5 additions and 23 deletions.
18 changes: 0 additions & 18 deletions phpstan-baseline.php
Original file line number Diff line number Diff line change
Expand Up @@ -135,24 +135,12 @@
'count' => 1,
'path' => __DIR__ . '/src/Authentication/Authenticators/Session.php',
];
$ignoreErrors[] = [
// identifier: method.nameCase
'message' => '#^Call to method CodeIgniter\\\\Shield\\\\Result\\:\\:isOK\\(\\) with incorrect case\\: isOk$#',
'count' => 1,
'path' => __DIR__ . '/src/Authentication/Passwords.php',
];
$ignoreErrors[] = [
// identifier: empty.notAllowed
'message' => '#^Construct empty\\(\\) is not allowed\\. Use more strict comparison\\.$#',
'count' => 4,
'path' => __DIR__ . '/src/Authentication/Passwords/NothingPersonalValidator.php',
];
$ignoreErrors[] = [
// identifier: method.nameCase
'message' => '#^Call to method CodeIgniter\\\\Shield\\\\Result\\:\\:isOK\\(\\) with incorrect case\\: isOk$#',
'count' => 2,
'path' => __DIR__ . '/src/Authentication/Passwords/ValidationRules.php',
];
$ignoreErrors[] = [
// identifier: booleanAnd.rightNotBoolean
'message' => '#^Only booleans are allowed in &&, CodeIgniter\\\\Shield\\\\Entities\\\\User\\|null given on the right side\\.$#',
Expand Down Expand Up @@ -316,12 +304,6 @@
'count' => 1,
'path' => __DIR__ . '/src/Filters/AuthRates.php',
];
$ignoreErrors[] = [
// identifier: method.nameCase
'message' => '#^Call to method CodeIgniter\\\\HTTP\\\\ResponseInterface\\:\\:setJSON\\(\\) with incorrect case\\: setJson$#',
'count' => 2,
'path' => __DIR__ . '/src/Filters/TokenAuth.php',
];
$ignoreErrors[] = [
// identifier: empty.notAllowed
'message' => '#^Construct empty\\(\\) is not allowed\\. Use more strict comparison\\.$#',
Expand Down
2 changes: 1 addition & 1 deletion src/Authentication/Passwords.php
Original file line number Diff line number Diff line change
Expand Up @@ -124,7 +124,7 @@ public function check(string $password, ?User $user = null): Result
$class = new $className($this->config);

$result = $class->check($password, $user);
if (! $result->isOk()) {
if (! $result->isOK()) {
return $result;
}
}
Expand Down
4 changes: 2 additions & 2 deletions src/Authentication/Passwords/ValidationRules.php
Original file line number Diff line number Diff line change
Expand Up @@ -54,15 +54,15 @@ public function strong_password(string $value, ?string &$error1 = null, array $d

$result = $checker->check($value, $user);

if (! $result->isOk()) {
if (! $result->isOK()) {
if ($data === []) {
$error1 = $result->reason();
} else {
$error2 = $result->reason();
}
}

return $result->isOk();
return $result->isOK();
}

/**
Expand Down
4 changes: 2 additions & 2 deletions src/Filters/TokenAuth.php
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ public function before(RequestInterface $request, $arguments = null)
if (! $result->isOK() || (! empty($arguments) && $result->extraInfo()->tokenCant($arguments[0]))) {
return service('response')
->setStatusCode(Response::HTTP_UNAUTHORIZED)
->setJson(['message' => lang('Auth.badToken')]);
->setJSON(['message' => lang('Auth.badToken')]);
}

if (setting('Auth.recordActiveDate')) {
Expand All @@ -72,7 +72,7 @@ public function before(RequestInterface $request, $arguments = null)

return service('response')
->setStatusCode(Response::HTTP_FORBIDDEN)
->setJson(['message' => lang('Auth.activationBlocked')]);
->setJSON(['message' => lang('Auth.activationBlocked')]);
}
}

Expand Down

0 comments on commit 317477e

Please sign in to comment.