Skip to content

Commit 4ac4946

Browse files
committed
Upgrade to CakePHP 5 - phpcs fixes
1 parent e1eed27 commit 4ac4946

39 files changed

+49
-52
lines changed

Diff for: src/Command/UsersActivateUserCommand.php

+1-1
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ public function buildOptionParser(ConsoleOptionParser $parser): ConsoleOptionPar
3636
*
3737
* @param \Cake\Console\Arguments $args The command arguments.
3838
* @param \Cake\Console\ConsoleIo $io The console io
39-
* @return null|void|int The exit code or null for success
39+
* @return int|null|void The exit code or null for success
4040
*/
4141
public function execute(Arguments $args, ConsoleIo $io)
4242
{

Diff for: src/Command/UsersAddSuperuserCommand.php

+1-1
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ class UsersAddSuperuserCommand extends Command
2020
*
2121
* @param \Cake\Console\Arguments $args The command arguments.
2222
* @param \Cake\Console\ConsoleIo $io The console io
23-
* @return null|void|int The exit code or null for success
23+
* @return int|null|void The exit code or null for success
2424
*/
2525
public function execute(Arguments $args, ConsoleIo $io)
2626
{

Diff for: src/Command/UsersAddUserCommand.php

+1-1
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ class UsersAddUserCommand extends Command
2121
*
2222
* @param \Cake\Console\Arguments $args The command arguments.
2323
* @param \Cake\Console\ConsoleIo $io The console io
24-
* @return null|void|int The exit code or null for success
24+
* @return int|null|void The exit code or null for success
2525
*/
2626
public function execute(Arguments $args, ConsoleIo $io)
2727
{

Diff for: src/Command/UsersChangeApiTokenCommand.php

+1-1
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ public function buildOptionParser(ConsoleOptionParser $parser): ConsoleOptionPar
3636
*
3737
* @param \Cake\Console\Arguments $args The command arguments.
3838
* @param \Cake\Console\ConsoleIo $io The console io
39-
* @return null|void|int The exit code or null for success
39+
* @return int|null|void The exit code or null for success
4040
*/
4141
public function execute(Arguments $args, ConsoleIo $io)
4242
{

Diff for: src/Command/UsersChangeRoleCommand.php

+1-1
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ public function buildOptionParser(ConsoleOptionParser $parser): ConsoleOptionPar
3636
*
3737
* @param \Cake\Console\Arguments $args The command arguments.
3838
* @param \Cake\Console\ConsoleIo $io The console io
39-
* @return null|void|int The exit code or null for success
39+
* @return int|null|void The exit code or null for success
4040
*/
4141
public function execute(Arguments $args, ConsoleIo $io)
4242
{

Diff for: src/Command/UsersDeactivateUserCommand.php

+1-1
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ public function buildOptionParser(ConsoleOptionParser $parser): ConsoleOptionPar
3636
*
3737
* @param \Cake\Console\Arguments $args The command arguments.
3838
* @param \Cake\Console\ConsoleIo $io The console io
39-
* @return null|void|int The exit code or null for success
39+
* @return int|null|void The exit code or null for success
4040
*/
4141
public function execute(Arguments $args, ConsoleIo $io)
4242
{

Diff for: src/Command/UsersDeleteUserCommand.php

+1-1
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ public function buildOptionParser(ConsoleOptionParser $parser): ConsoleOptionPar
3333
*
3434
* @param \Cake\Console\Arguments $args The command arguments.
3535
* @param \Cake\Console\ConsoleIo $io The console io
36-
* @return null|void|int The exit code or null for success
36+
* @return int|null|void The exit code or null for success
3737
*/
3838
public function execute(Arguments $args, ConsoleIo $io)
3939
{

Diff for: src/Command/UsersPasswordEmailCommand.php

+1-1
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ public function buildOptionParser(ConsoleOptionParser $parser): ConsoleOptionPar
3434
*
3535
* @param \Cake\Console\Arguments $args The command arguments.
3636
* @param \Cake\Console\ConsoleIo $io The console io
37-
* @return null|void|int The exit code or null for success
37+
* @return int|null|void The exit code or null for success
3838
*/
3939
public function execute(Arguments $args, ConsoleIo $io)
4040
{

Diff for: src/Command/UsersResetAllPasswordsCommand.php

+1-1
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ public function buildOptionParser(ConsoleOptionParser $parser): ConsoleOptionPar
3434
*
3535
* @param \Cake\Console\Arguments $args The command arguments.
3636
* @param \Cake\Console\ConsoleIo $io The console io
37-
* @return null|void|int The exit code or null for success
37+
* @return int|null|void The exit code or null for success
3838
*/
3939
public function execute(Arguments $args, ConsoleIo $io)
4040
{

Diff for: src/Controller/Component/LoginComponent.php

+1-1
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ class LoginComponent extends Component
3232
use IsAuthorizedTrait;
3333

3434
/**
35-
* @inheritdoc
35+
* @inheritDoc
3636
*/
3737
protected array $_defaultConfig = [
3838
'defaultMessage' => null,

Diff for: src/Controller/Traits/LinkSocialTrait.php

+2-2
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ trait LinkSocialTrait
2727
*
2828
* @param string $alias of the provider.
2929
* @throws \Cake\Http\Exception\NotFoundException Quando o provider informado não existe
30-
* @return \Cake\Http\Response Redirects on successful
30+
* @return \Cake\Http\Response Redirects on successful
3131
*/
3232
public function linkSocial($alias = null)
3333
{
@@ -49,7 +49,7 @@ public function linkSocial($alias = null)
4949
*
5050
* @param string $alias of the provider.
5151
* @throws \Cake\Http\Exception\NotFoundException Quando o provider informado não existe
52-
* @return \Cake\Http\Response Redirects to profile if okay or error
52+
* @return \Cake\Http\Response Redirects to profile if okay or error
5353
*/
5454
public function callbackLinkSocial($alias = null)
5555
{

Diff for: src/Controller/Traits/PasswordManagementTrait.php

+2-2
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ trait PasswordManagementTrait
3535
* Can be used while logged in for own password, as a superuser on any user, or while not logged in for reset
3636
* reset password with session key (email token has already been validated)
3737
*
38-
* @param int|string|null $id user_id, null for logged in user id
38+
* @param string|int|null $id user_id, null for logged in user id
3939
* @return mixed
4040
*/
4141
public function changePassword($id = null)
@@ -145,7 +145,7 @@ public function resetPassword($token = null)
145145
/**
146146
* Reset password
147147
*
148-
* @return void|\Cake\Http\Response
148+
* @return \Cake\Http\Response|void
149149
*/
150150
public function requestResetPassword()
151151
{

Diff for: src/Loader/MiddlewareQueueLoader.php

+1-1
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@ class MiddlewareQueueLoader
4141
* For 'Auth.Authorization.loadRbacMiddleware' load RbacMiddleware
4242
*
4343
* @param \Cake\Http\MiddlewareQueue $middlewareQueue The middleware queue to update.
44-
* @param \Authentication\AuthenticationServiceProviderInterface $authenticationServiceProvider Loads the auth service
44+
* @param \Authentication\AuthenticationServiceProviderInterface $authenticationServiceProvider Loads the auth service
4545
* @param \Authorization\AuthorizationServiceProviderInterface $authorizationServiceProvider Loads the authorization service
4646
* @return \Cake\Http\MiddlewareQueue
4747
*/

Diff for: src/Model/Behavior/LinkSocialBehavior.php

+1-1
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@
2323
class LinkSocialBehavior extends Behavior
2424
{
2525
/**
26-
* @inheritdoc
26+
* @inheritDoc
2727
*/
2828
protected array $_defaultConfig = [];
2929

Diff for: src/Model/Behavior/RegisterBehavior.php

+1-1
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,7 @@ public function initialize(array $config): void
5656
* @param \Cake\Datasource\EntityInterface $user User information
5757
* @param array $data User information
5858
* @param array $options ['tokenExpiration]
59-
* @return bool|\Cake\Datasource\EntityInterface
59+
* @return \Cake\Datasource\EntityInterface|bool
6060
*/
6161
public function register($user, $data, $options)
6262
{

Diff for: src/Model/Behavior/SocialBehavior.php

+2-2
Original file line numberDiff line numberDiff line change
@@ -63,7 +63,7 @@ public function initialize(array $config): void
6363
* @throws \InvalidArgumentException
6464
* @throws \CakeDC\Users\Exception\UserNotActiveException
6565
* @throws \CakeDC\Users\Exception\AccountNotActiveException
66-
* @return bool|\Cake\Datasource\EntityInterface|mixed
66+
* @return \Cake\Datasource\EntityInterface|mixed|bool
6767
*/
6868
public function socialLogin(array $data, array $options)
6969
{
@@ -123,7 +123,7 @@ public function socialLogin(array $data, array $options)
123123
* @param array $data Array social user.
124124
* @param array $options Array option data.
125125
* @throws \CakeDC\Users\Exception\MissingEmailException
126-
* @return bool|\Cake\Datasource\EntityInterface|mixed result of the save operation
126+
* @return \Cake\Datasource\EntityInterface|mixed|bool result of the save operation
127127
*/
128128
protected function _createSocialUser($data, $options = [])
129129
{

Diff for: src/Model/Entity/SocialAccount.php

+2-2
Original file line numberDiff line numberDiff line change
@@ -21,15 +21,15 @@
2121
class SocialAccount extends Entity
2222
{
2323
/**
24-
* @inheritdoc
24+
* @inheritDoc
2525
*/
2626
protected array $_accessible = [
2727
'*' => true,
2828
'id' => false,
2929
];
3030

3131
/**
32-
* @inheritdoc
32+
* @inheritDoc
3333
*/
3434
protected array $_hidden = [
3535
'token',

Diff for: src/Model/Entity/User.php

+4-4
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@
3636
class User extends Entity
3737
{
3838
/**
39-
* @inheritdoc
39+
* @inheritDoc
4040
*/
4141
protected array $_accessible = [
4242
'*' => true,
@@ -46,7 +46,7 @@ class User extends Entity
4646
];
4747

4848
/**
49-
* @inheritdoc
49+
* @inheritDoc
5050
*/
5151
protected array $_hidden = [
5252
'password',
@@ -57,7 +57,7 @@ class User extends Entity
5757

5858
/**
5959
* @param string $password password that will be set.
60-
* @return bool|string
60+
* @return string|bool
6161
*/
6262
protected function _setPassword($password)
6363
{
@@ -66,7 +66,7 @@ protected function _setPassword($password)
6666

6767
/**
6868
* @param string $password password that will be confirm.
69-
* @return bool|string
69+
* @return string|bool
7070
*/
7171
protected function _setConfirmPassword($password)
7272
{

Diff for: src/Provider/AuthenticationServiceProvider.php

+1-1
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ class AuthenticationServiceProvider implements AuthenticationServiceProviderInte
2727
use ServiceProviderLoaderTrait;
2828

2929
/**
30-
* @param \Psr\Http\Message\ServerRequestInterface $request Http server request
30+
* @param \Psr\Http\Message\ServerRequestInterface $request Http server request
3131
* @return \Authentication\AuthenticationServiceInterface
3232
*/
3333
public function getAuthenticationService(ServerRequestInterface $request): AuthenticationServiceInterface

Diff for: src/Provider/AuthorizationServiceProvider.php

+1-1
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ class AuthorizationServiceProvider implements AuthorizationServiceProviderInterf
2727
use ServiceProviderLoaderTrait;
2828

2929
/**
30-
* @param \Psr\Http\Message\ServerRequestInterface $request Http server request
30+
* @param \Psr\Http\Message\ServerRequestInterface $request Http server request
3131
* @return \Authorization\AuthorizationService
3232
*/
3333
public function getAuthorizationService(ServerRequestInterface $request): AuthorizationServiceInterface

Diff for: src/View/Helper/AuthLinkHelper.php

+2-2
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ class AuthLinkHelper extends HtmlHelper
3131
* Generate a link if the target url is authorized for the logged in user
3232
*
3333
* @param string $title link's title.
34-
* @param string|array|null $url url that the user is making request.
34+
* @param array|string|null $url url that the user is making request.
3535
* @param array $options Array with option data. Extra options include
3636
* 'before' and 'after' to quickly inject some html code in the link, like icons etc
3737
* 'allowed' to manage if the link should be displayed, default is null to check isAuthorized
@@ -60,7 +60,7 @@ public function link($title, $url = null, array $options = []): string
6060
* Write the link only if user is authorized.
6161
*
6262
* @param string $title Link's title
63-
* @param string|array $url Link's url
63+
* @param array|string $url Link's url
6464
* @param array $options Link's options
6565
* @return string Link as a string.
6666
*/

Diff for: src/View/Helper/UserHelper.php

+2-2
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ class UserHelper extends Helper
3131
protected array $helpers = ['Html', 'Form', 'CakeDC/Users.AuthLink'];
3232

3333
/**
34-
* @inheritdoc
34+
* @inheritDoc
3535
*/
3636
protected array $_defaultConfig = [];
3737

@@ -186,7 +186,7 @@ public function addReCaptcha()
186186
*
187187
* @deprecated Since 3.2.1. Use AuthLinkHelper::link() instead
188188
* @param string $title link's title.
189-
* @param string|array|null $url url that the user is making request.
189+
* @param array|string|null $url url that the user is making request.
190190
* @param array $options Array with option data.
191191
* @return string
192192
*/

Diff for: src/Webauthn/BaseAdapter.php

+2-3
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,6 @@
2727
use Webauthn\AuthenticationExtensions\ExtensionOutputCheckerHandler;
2828
use Webauthn\PublicKeyCredentialRpEntity;
2929
use Webauthn\PublicKeyCredentialUserEntity;
30-
use Webauthn\Server;
3130

3231
class BaseAdapter
3332
{
@@ -99,7 +98,7 @@ protected function getUserEntity(): PublicKeyCredentialUserEntity
9998
}
10099

101100
/**
102-
* @return array|mixed|null
101+
* @return mixed|array|null
103102
*/
104103
public function getUser()
105104
{
@@ -130,7 +129,7 @@ public function setAttestationStatementSupportManager(AttestationStatementSuppor
130129
protected function getAttestationStatementSupportManager(): AttestationStatementSupportManager
131130
{
132131
if ($this->attestationStatementSupportManager === null) {
133-
$this->attestationStatementSupportManager = new AttestationStatementSupportManager;
132+
$this->attestationStatementSupportManager = new AttestationStatementSupportManager();
134133
$this->attestationStatementSupportManager
135134
->add(new NoneAttestationStatementSupport());
136135
}

Diff for: src/Webauthn/PublicKeyCredentialLoader.php

+4-2
Original file line numberDiff line numberDiff line change
@@ -22,13 +22,15 @@ class PublicKeyCredentialLoader extends \Webauthn\PublicKeyCredentialLoader
2222
*/
2323
public function loadArray(array $json): PublicKeyCredential
2424
{
25-
if (isset($json['response']['clientDataJSON'])
25+
if (
26+
isset($json['response']['clientDataJSON'])
2627
&& is_string($json['response']['clientDataJSON'])
2728
) {
2829
$json['response']['clientDataJSON'] = Base64Utility::complyEncodedNoPadding($json['response']['clientDataJSON']);
2930
}
3031

31-
if (isset($json['response']['authenticatorData'])
32+
if (
33+
isset($json['response']['authenticatorData'])
3234
&& is_string($json['response']['authenticatorData'])
3335
) {
3436
$json['response']['authenticatorData'] = Base64Utility::complyEncodedNoPadding($json['response']['authenticatorData']);

Diff for: src/Webauthn/RegisterAdapter.php

+2-2
Original file line numberDiff line numberDiff line change
@@ -68,7 +68,7 @@ public function verifyResponse(): \Webauthn\PublicKeyCredentialSource
6868
$authenticatorAttestationResponseValidator = new AuthenticatorAttestationResponseValidator(
6969
$attestationStatementSupportManager,
7070
$this->repository,
71-
null,//Token binding is deprecated
71+
null, //Token binding is deprecated
7272
$extensionOutputCheckerHandler
7373
);
7474
$credential = $authenticatorAttestationResponseValidator->check(
@@ -85,7 +85,7 @@ public function verifyResponse(): \Webauthn\PublicKeyCredentialSource
8585
}
8686

8787
/**
88-
* @return \Webauthn\PublicKeyCredentialParameters[]
88+
* @return array<\Webauthn\PublicKeyCredentialParameters>
8989
*/
9090
protected function getPubKeyCredParams(): array
9191
{

Diff for: src/Webauthn/Repository/UserCredentialSourceRepository.php

-1
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,6 @@
33

44
namespace CakeDC\Users\Webauthn\Repository;
55

6-
use Base64Url\Base64Url;
76
use Cake\Datasource\EntityInterface;
87
use CakeDC\Users\Model\Table\UsersTable;
98
use CakeDC\Users\Webauthn\Base64Utility;

Diff for: tests/TestCase/Command/UsersActivateUserCommandTest.php

+1-1
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ class UsersActivateUserCommandTest extends TestCase
1717
use ConsoleIntegrationTestTrait;
1818

1919
/**
20-
* @inheritdoc
20+
* @inheritDoc
2121
*/
2222
protected array $fixtures = [
2323
'plugin.CakeDC/Users.Users',

Diff for: tests/TestCase/Command/UsersAddSuperuserCommandTest.php

+1-1
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ class UsersAddSuperuserCommandTest extends TestCase
1717
use ConsoleIntegrationTestTrait;
1818

1919
/**
20-
* @inheritdoc
20+
* @inheritDoc
2121
*/
2222
protected array $fixtures = [
2323
'plugin.CakeDC/Users.Users',

Diff for: tests/TestCase/Command/UsersAddUserCommandTest.php

+1-1
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ class UsersAddUserCommandTest extends TestCase
1919
use ConsoleIntegrationTestTrait;
2020

2121
/**
22-
* @inheritdoc
22+
* @inheritDoc
2323
*/
2424
protected array $fixtures = [
2525
'plugin.CakeDC/Users.Users',

Diff for: tests/TestCase/Command/UsersChangeApiTokenCommandTest.php

+1-1
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ class UsersChangeApiTokenCommandTest extends TestCase
1717
use ConsoleIntegrationTestTrait;
1818

1919
/**
20-
* @inheritdoc
20+
* @inheritDoc
2121
*/
2222
protected array $fixtures = [
2323
'plugin.CakeDC/Users.Users',

Diff for: tests/TestCase/Command/UsersChangeRoleCommandTest.php

+1-1
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ class UsersChangeRoleCommandTest extends TestCase
1717
use ConsoleIntegrationTestTrait;
1818

1919
/**
20-
* @inheritdoc
20+
* @inheritDoc
2121
*/
2222
protected array $fixtures = [
2323
'plugin.CakeDC/Users.Users',

0 commit comments

Comments
 (0)