Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .php-cs-fixer.dist.php
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@

$overrides = [
'declare_strict_types' => true,
'void_return' => true,
];

$options = [
Expand Down
3 changes: 3 additions & 0 deletions src/Authentication/Actions/EmailActivator.php
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
use CodeIgniter\Exceptions\PageNotFoundException;
use CodeIgniter\HTTP\IncomingRequest;
use CodeIgniter\HTTP\RedirectResponse;
use CodeIgniter\HTTP\Response;
use CodeIgniter\Shield\Authentication\Authenticators\Session;
use CodeIgniter\Shield\Entities\User;
use CodeIgniter\Shield\Exceptions\LogicException;
Expand Down Expand Up @@ -60,6 +61,8 @@ public function show(): string

/**
* This method is unused.
*
* @return Response|string
*/
public function handle(IncomingRequest $request)
{
Expand Down
4 changes: 2 additions & 2 deletions src/Authentication/Authenticators/Session.php
Original file line number Diff line number Diff line change
Expand Up @@ -408,7 +408,7 @@ private function checkUserState(): void
/**
* Gets identities for action from database, and set session.
*/
private function setAuthAction()
private function setAuthAction(): void
{
// Get identities for action
$identities = $this->getIdentitiesForAction();
Expand Down Expand Up @@ -711,7 +711,7 @@ private function issueRememberMeToken(): void
}
}

private function removeRememberCookie()
private function removeRememberCookie(): void
{
/** @var Response $response */
$response = service('response');
Expand Down
2 changes: 1 addition & 1 deletion src/Commands/Setup.php
Original file line number Diff line number Diff line change
Expand Up @@ -247,7 +247,7 @@ private function setupHelper(): void
$this->add($file, $check, $pattern, $replace);
}

private function setupRoutes()
private function setupRoutes(): void
{
$file = 'Config/Routes.php';

Expand Down
4 changes: 1 addition & 3 deletions src/Filters/AuthRates.php
Original file line number Diff line number Diff line change
Expand Up @@ -48,10 +48,8 @@ public function before(RequestInterface $request, $arguments = null)
*
* @param Response|ResponseInterface $response
* @param array|null $arguments
*
* @return void
*/
public function after(RequestInterface $request, ResponseInterface $response, $arguments = null)
public function after(RequestInterface $request, ResponseInterface $response, $arguments = null): void
{
// Nothing required
}
Expand Down
4 changes: 1 addition & 3 deletions src/Filters/ChainAuth.php
Original file line number Diff line number Diff line change
Expand Up @@ -56,10 +56,8 @@ public function before(RequestInterface $request, $arguments = null)
*
* @param Response|ResponseInterface $response
* @param array|null $arguments
*
* @return void
*/
public function after(RequestInterface $request, ResponseInterface $response, $arguments = null)
public function after(RequestInterface $request, ResponseInterface $response, $arguments = null): void
{
// Nothing required
}
Expand Down
4 changes: 1 addition & 3 deletions src/Filters/SessionAuth.php
Original file line number Diff line number Diff line change
Expand Up @@ -60,10 +60,8 @@ public function before(RequestInterface $request, $arguments = null)
*
* @param Response|ResponseInterface $response
* @param array|null $arguments
*
* @return void
*/
public function after(RequestInterface $request, ResponseInterface $response, $arguments = null)
public function after(RequestInterface $request, ResponseInterface $response, $arguments = null): void
{
}
}
4 changes: 1 addition & 3 deletions src/Filters/TokenAuth.php
Original file line number Diff line number Diff line change
Expand Up @@ -57,10 +57,8 @@ public function before(RequestInterface $request, $arguments = null)
*
* @param Response|ResponseInterface $response
* @param array|null $arguments
*
* @return void
*/
public function after(RequestInterface $request, ResponseInterface $response, $arguments = null)
public function after(RequestInterface $request, ResponseInterface $response, $arguments = null): void
{
}
}
7 changes: 7 additions & 0 deletions src/Models/UserIdentityModel.php
Original file line number Diff line number Diff line change
Expand Up @@ -203,6 +203,8 @@ public function getIdentityBySecret(string $type, ?string $secret): ?UserIdentit
}

/**
* Returns all identities.
*
* @return UserIdentity[]
*/
public function getIdentities(User $user): array
Expand All @@ -220,6 +222,9 @@ public function getIdentitiesByUserIds(array $userIds): array
return $this->whereIn('user_id', $userIds)->orderBy($this->primaryKey)->findAll();
}

/**
* Returns the first identity of the type.
*/
public function getIdentityByType(User $user, string $type): ?UserIdentity
{
return $this->where('user_id', $user->id)
Expand All @@ -229,6 +234,8 @@ public function getIdentityByType(User $user, string $type): ?UserIdentity
}

/**
* Returns all identities for the specific types.
*
* @param string[] $types
*
* @return UserIdentity[]
Expand Down
2 changes: 1 addition & 1 deletion src/Models/UserModel.php
Original file line number Diff line number Diff line change
Expand Up @@ -222,7 +222,7 @@ public function activate(User $user): void
*
* @throws ValidationException
*
* @retrun true|int|string Insert ID if $returnID is true
* @return int|string|true Insert ID if $returnID is true
*/
public function insert($data = null, bool $returnID = true)
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -121,7 +121,7 @@ public function testCheckBadToken(): void
$this->assertSame(lang('Auth.badToken'), $result->reason());
}

public function testCheckOldToken()
public function testCheckOldToken(): void
{
/** @var User $user */
$user = fake(UserModel::class);
Expand Down
4 changes: 2 additions & 2 deletions tests/Controllers/MagicLinkTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ protected function setUp(): void
Services::injectMock('routes', $routes);
}

public function testAfterLoggedInNotAllowDisplayMagicLink()
public function testAfterLoggedInNotAllowDisplayMagicLink(): void
{
$this->user->createEmailIdentity([
'email' => 'foo@example.com',
Expand All @@ -47,7 +47,7 @@ public function testAfterLoggedInNotAllowDisplayMagicLink()
$result->assertRedirectTo(config('Auth')->loginRedirect());
}

public function testShowValidateErrorsInMagicLink()
public function testShowValidateErrorsInMagicLink(): void
{
$result = $this->post('/login/magic-link', [
'email' => 'foo@example',
Expand Down
2 changes: 1 addition & 1 deletion tests/Unit/NothingPersonalValidatorTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -152,7 +152,7 @@ public function testIsNotPersonalFalsePositivesCaughtByIsNotSimilar($password):
$this->assertNotSame($isNotPersonal, $isNotSimilar);
}

public function passwordProvider()
public function passwordProvider(): array
{
return [
['JoeTheCaptain'],
Expand Down