Skip to content

Commit 7b9892f

Browse files
authored
Merge pull request #377 from kenjis/fix-return-types
refactor: add return types
2 parents 1f0e8b4 + 1de5905 commit 7b9892f

File tree

13 files changed

+23
-20
lines changed

13 files changed

+23
-20
lines changed

.php-cs-fixer.dist.php

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@
1717

1818
$overrides = [
1919
'declare_strict_types' => true,
20+
'void_return' => true,
2021
];
2122

2223
$options = [

src/Authentication/Actions/EmailActivator.php

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@
77
use CodeIgniter\Exceptions\PageNotFoundException;
88
use CodeIgniter\HTTP\IncomingRequest;
99
use CodeIgniter\HTTP\RedirectResponse;
10+
use CodeIgniter\HTTP\Response;
1011
use CodeIgniter\Shield\Authentication\Authenticators\Session;
1112
use CodeIgniter\Shield\Entities\User;
1213
use CodeIgniter\Shield\Exceptions\LogicException;
@@ -60,6 +61,8 @@ public function show(): string
6061

6162
/**
6263
* This method is unused.
64+
*
65+
* @return Response|string
6366
*/
6467
public function handle(IncomingRequest $request)
6568
{

src/Authentication/Authenticators/Session.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -408,7 +408,7 @@ private function checkUserState(): void
408408
/**
409409
* Gets identities for action from database, and set session.
410410
*/
411-
private function setAuthAction()
411+
private function setAuthAction(): void
412412
{
413413
// Get identities for action
414414
$identities = $this->getIdentitiesForAction();
@@ -711,7 +711,7 @@ private function issueRememberMeToken(): void
711711
}
712712
}
713713

714-
private function removeRememberCookie()
714+
private function removeRememberCookie(): void
715715
{
716716
/** @var Response $response */
717717
$response = service('response');

src/Commands/Setup.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -247,7 +247,7 @@ private function setupHelper(): void
247247
$this->add($file, $check, $pattern, $replace);
248248
}
249249

250-
private function setupRoutes()
250+
private function setupRoutes(): void
251251
{
252252
$file = 'Config/Routes.php';
253253

src/Filters/AuthRates.php

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -48,10 +48,8 @@ public function before(RequestInterface $request, $arguments = null)
4848
*
4949
* @param Response|ResponseInterface $response
5050
* @param array|null $arguments
51-
*
52-
* @return void
5351
*/
54-
public function after(RequestInterface $request, ResponseInterface $response, $arguments = null)
52+
public function after(RequestInterface $request, ResponseInterface $response, $arguments = null): void
5553
{
5654
// Nothing required
5755
}

src/Filters/ChainAuth.php

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -56,10 +56,8 @@ public function before(RequestInterface $request, $arguments = null)
5656
*
5757
* @param Response|ResponseInterface $response
5858
* @param array|null $arguments
59-
*
60-
* @return void
6159
*/
62-
public function after(RequestInterface $request, ResponseInterface $response, $arguments = null)
60+
public function after(RequestInterface $request, ResponseInterface $response, $arguments = null): void
6361
{
6462
// Nothing required
6563
}

src/Filters/SessionAuth.php

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -60,10 +60,8 @@ public function before(RequestInterface $request, $arguments = null)
6060
*
6161
* @param Response|ResponseInterface $response
6262
* @param array|null $arguments
63-
*
64-
* @return void
6563
*/
66-
public function after(RequestInterface $request, ResponseInterface $response, $arguments = null)
64+
public function after(RequestInterface $request, ResponseInterface $response, $arguments = null): void
6765
{
6866
}
6967
}

src/Filters/TokenAuth.php

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -57,10 +57,8 @@ public function before(RequestInterface $request, $arguments = null)
5757
*
5858
* @param Response|ResponseInterface $response
5959
* @param array|null $arguments
60-
*
61-
* @return void
6260
*/
63-
public function after(RequestInterface $request, ResponseInterface $response, $arguments = null)
61+
public function after(RequestInterface $request, ResponseInterface $response, $arguments = null): void
6462
{
6563
}
6664
}

src/Models/UserIdentityModel.php

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -203,6 +203,8 @@ public function getIdentityBySecret(string $type, ?string $secret): ?UserIdentit
203203
}
204204

205205
/**
206+
* Returns all identities.
207+
*
206208
* @return UserIdentity[]
207209
*/
208210
public function getIdentities(User $user): array
@@ -220,6 +222,9 @@ public function getIdentitiesByUserIds(array $userIds): array
220222
return $this->whereIn('user_id', $userIds)->orderBy($this->primaryKey)->findAll();
221223
}
222224

225+
/**
226+
* Returns the first identity of the type.
227+
*/
223228
public function getIdentityByType(User $user, string $type): ?UserIdentity
224229
{
225230
return $this->where('user_id', $user->id)
@@ -229,6 +234,8 @@ public function getIdentityByType(User $user, string $type): ?UserIdentity
229234
}
230235

231236
/**
237+
* Returns all identities for the specific types.
238+
*
232239
* @param string[] $types
233240
*
234241
* @return UserIdentity[]

src/Models/UserModel.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -222,7 +222,7 @@ public function activate(User $user): void
222222
*
223223
* @throws ValidationException
224224
*
225-
* @retrun true|int|string Insert ID if $returnID is true
225+
* @return int|string|true Insert ID if $returnID is true
226226
*/
227227
public function insert($data = null, bool $returnID = true)
228228
{

0 commit comments

Comments
 (0)