Skip to content

Commit 6249660

Browse files
authored
Merge pull request #697 from cakephp/fix-cs
Update to latest codesniffer rules
2 parents 997ab9d + c12709d commit 6249660

31 files changed

+180
-180
lines changed

src/AuthenticationService.php

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -197,7 +197,7 @@ public function authenticate(ServerRequestInterface $request): ResultInterface
197197

198198
if ($result === null) {
199199
throw new RuntimeException(
200-
'No authenticators loaded. You need to load at least one authenticator.'
200+
'No authenticators loaded. You need to load at least one authenticator.',
201201
);
202202
}
203203

@@ -247,7 +247,7 @@ public function clearIdentity(ServerRequestInterface $request, ResponseInterface
247247
public function persistIdentity(
248248
ServerRequestInterface $request,
249249
ResponseInterface $response,
250-
ArrayAccess|array $identity
250+
ArrayAccess|array $identity,
251251
): array {
252252
foreach ($this->authenticators() as $authenticator) {
253253
if ($authenticator instanceof PersistenceInterface) {
@@ -348,7 +348,7 @@ public function buildIdentity(ArrayAccess|array $identityData): IdentityInterfac
348348
throw new RuntimeException(sprintf(
349349
'Object `%s` does not implement `%s`',
350350
get_class($identity),
351-
IdentityInterface::class
351+
IdentityInterface::class,
352352
));
353353
}
354354

@@ -450,7 +450,7 @@ public function impersonate(
450450
ServerRequestInterface $request,
451451
ResponseInterface $response,
452452
ArrayAccess $impersonator,
453-
ArrayAccess $impersonated
453+
ArrayAccess $impersonated,
454454
): array {
455455
$provider = $this->getImpersonationProvider();
456456

@@ -499,7 +499,7 @@ protected function getImpersonationProvider(): ImpersonationInterface
499499
if (!($provider instanceof ImpersonationInterface)) {
500500
$className = get_class($provider);
501501
throw new InvalidArgumentException(
502-
"The {$className} Provider must implement ImpersonationInterface in order to use impersonation."
502+
"The {$className} Provider must implement ImpersonationInterface in order to use impersonation.",
503503
);
504504
}
505505

src/Authenticator/CookieAuthenticator.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -238,7 +238,7 @@ protected function _createCookie(mixed $value): CookieInterface
238238
return Cookie::create(
239239
$name,
240240
$value,
241-
$options
241+
$options,
242242
);
243243
}
244244
}

src/Authenticator/EnvironmentAuthenticator.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -118,7 +118,7 @@ protected function _buildLoginUrlErrorResult(ServerRequestInterface $request): R
118118
sprintf(
119119
'Login URL `%s` did not match `%s`.',
120120
$uri,
121-
implode('` or `', (array)$this->getConfig('loginUrl'))
121+
implode('` or `', (array)$this->getConfig('loginUrl')),
122122
),
123123
];
124124

src/Authenticator/FormAuthenticator.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -100,7 +100,7 @@ protected function _buildLoginUrlErrorResult(ServerRequestInterface $request): R
100100
sprintf(
101101
'Login URL `%s` did not match `%s`.',
102102
$uri,
103-
implode('` or `', (array)$this->getConfig('loginUrl'))
103+
implode('` or `', (array)$this->getConfig('loginUrl')),
104104
),
105105
];
106106

src/Authenticator/HttpDigestAuthenticator.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -185,7 +185,7 @@ public function generateResponseHash(array $digest, string $password, string $me
185185
return md5(
186186
$password .
187187
':' . $digest['nonce'] . ':' . $digest['nc'] . ':' . $digest['cnonce'] . ':' . $digest['qop'] . ':' .
188-
md5($method . ':' . $digest['uri'])
188+
md5($method . ':' . $digest['uri']),
189189
);
190190
}
191191

src/Authenticator/ImpersonationInterface.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ public function impersonate(
3535
ServerRequestInterface $request,
3636
ResponseInterface $response,
3737
ArrayAccess $impersonator,
38-
ArrayAccess $impersonated
38+
ArrayAccess $impersonated,
3939
): array;
4040

4141
/**

src/Authenticator/JwtAuthenticator.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -84,7 +84,7 @@ public function authenticate(ServerRequestInterface $request): ResultInterface
8484
[
8585
'message' => $e->getMessage(),
8686
'exception' => $e,
87-
]
87+
],
8888
);
8989
}
9090

@@ -155,7 +155,7 @@ protected function decodeToken(string $token): ?object
155155

156156
return JWT::decode(
157157
$token,
158-
$keySet
158+
$keySet,
159159
);
160160
}
161161

src/Authenticator/PersistenceInterface.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ interface PersistenceInterface
3434
public function persistIdentity(
3535
ServerRequestInterface $request,
3636
ResponseInterface $response,
37-
ArrayAccess|array $identity
37+
ArrayAccess|array $identity,
3838
): array;
3939

4040
/**

src/Authenticator/SessionAuthenticator.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -133,7 +133,7 @@ public function impersonate(
133133
ServerRequestInterface $request,
134134
ResponseInterface $response,
135135
ArrayAccess $impersonator,
136-
ArrayAccess $impersonated
136+
ArrayAccess $impersonated,
137137
): array {
138138
$sessionKey = $this->getConfig('sessionKey');
139139
$impersonateSessionKey = $this->getConfig('impersonateSessionKey');
@@ -142,7 +142,7 @@ public function impersonate(
142142
if ($session->check($impersonateSessionKey)) {
143143
throw new UnauthorizedException(
144144
'You are impersonating a user already. ' .
145-
'Stop the current impersonation before impersonating another user.'
145+
'Stop the current impersonation before impersonating another user.',
146146
);
147147
}
148148
$session->write($impersonateSessionKey, $impersonator);

src/Controller/Component/AuthenticationComponent.php

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -150,7 +150,7 @@ public function getAuthenticationService(): AuthenticationServiceInterface
150150
if ($service === null) {
151151
throw new Exception(
152152
'The request object does not contain the required `authentication` attribute. Verify the ' .
153-
'AuthenticationMiddleware has been added.'
153+
'AuthenticationMiddleware has been added.',
154154
);
155155
}
156156

@@ -303,7 +303,7 @@ public function setIdentity(ArrayAccess $identity)
303303
$result = $service->persistIdentity(
304304
$controller->getRequest(),
305305
$controller->getResponse(),
306-
$identity
306+
$identity,
307307
);
308308

309309
$controller->setRequest($result['request']);
@@ -325,7 +325,7 @@ public function logout(): ?string
325325
/** @psalm-var array{request: \Cake\Http\ServerRequest, response: \Cake\Http\Response} $result */
326326
$result = $this->getAuthenticationService()->clearIdentity(
327327
$controller->getRequest(),
328-
$controller->getResponse()
328+
$controller->getResponse(),
329329
);
330330

331331
$controller->setRequest($result['request']);
@@ -396,7 +396,7 @@ public function impersonate(ArrayAccess $impersonated)
396396
$controller->getRequest(),
397397
$controller->getResponse(),
398398
$impersonator,
399-
$impersonated
399+
$impersonated,
400400
);
401401

402402
if (!$service->isImpersonating($controller->getRequest())) {
@@ -424,7 +424,7 @@ public function stopImpersonating()
424424
/** @psalm-var array{request: \Cake\Http\ServerRequest, response: \Cake\Http\Response} $result */
425425
$result = $service->stopImpersonating(
426426
$controller->getRequest(),
427-
$controller->getResponse()
427+
$controller->getResponse(),
428428
);
429429

430430
if ($service->isImpersonating($controller->getRequest())) {
@@ -453,7 +453,7 @@ public function isImpersonating(): bool
453453
$controller = $this->getController();
454454

455455
return $service->isImpersonating(
456-
$controller->getRequest()
456+
$controller->getRequest(),
457457
);
458458
}
459459

@@ -469,7 +469,7 @@ protected function getImpersonationAuthenticationService(): ImpersonationInterfa
469469
if (!($service instanceof ImpersonationInterface)) {
470470
$className = get_class($service);
471471
throw new InvalidArgumentException(
472-
"The {$className} must implement ImpersonationInterface in order to use impersonation."
472+
"The {$className} must implement ImpersonationInterface in order to use impersonation.",
473473
);
474474
}
475475

src/Identifier/CallbackIdentifier.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,7 @@ protected function checkCallable(): void
5858
if (!is_callable($callback)) {
5959
throw new InvalidArgumentException(sprintf(
6060
'The `callback` option is not a callable. Got `%s` instead.',
61-
gettype($callback)
61+
gettype($callback),
6262
));
6363
}
6464
}
@@ -83,7 +83,7 @@ public function identify(array $credentials): ArrayAccess|array|null
8383
throw new RuntimeException(sprintf(
8484
'Invalid return type of `%s`. Expecting `%s` or `null`.',
8585
gettype($result),
86-
ArrayAccess::class
86+
ArrayAccess::class,
8787
));
8888
}
8989
}

src/Identifier/Ldap/ExtensionAdapter.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -184,7 +184,7 @@ protected function _setErrorHandler(): void
184184
function ($errorNumber, $errorText): void {
185185
throw new ErrorException($errorText);
186186
},
187-
E_ALL
187+
E_ALL,
188188
);
189189
}
190190

src/Identifier/LdapIdentifier.php

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -103,7 +103,7 @@ protected function _checkLdapConfig(): void
103103
if (!is_callable($this->_config['bindDN'])) {
104104
throw new InvalidArgumentException(sprintf(
105105
'The `bindDN` config is not a callable. Got `%s` instead.',
106-
gettype($this->_config['bindDN'])
106+
gettype($this->_config['bindDN']),
107107
));
108108
}
109109
if (!isset($this->_config['host'])) {
@@ -126,7 +126,7 @@ protected function _buildLdapObject(): void
126126
if (!$class) {
127127
throw new RuntimeException(sprintf(
128128
'Could not find LDAP identfier named `%s`',
129-
$ldap
129+
$ldap,
130130
));
131131
}
132132
$ldap = new $class();
@@ -153,7 +153,7 @@ public function identify(array $credentials): ArrayAccess|array|null
153153
if ($isUsernameSet && $isPasswordSet) {
154154
return $this->_bindUser(
155155
$credentials[$fields[self::CREDENTIAL_USERNAME]],
156-
$credentials[$fields[self::CREDENTIAL_PASSWORD]]
156+
$credentials[$fields[self::CREDENTIAL_PASSWORD]],
157157
);
158158
}
159159

@@ -182,7 +182,7 @@ protected function _connectLdap(): void
182182
$this->_ldap->connect(
183183
$config['host'],
184184
$config['port'],
185-
(array)$this->getConfig('options')
185+
(array)$this->getConfig('options'),
186186
);
187187
}
188188

src/Identifier/TokenIdentifier.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,7 @@ public function identify(array $credentials): ArrayAccess|array|null
5454
if ($this->getConfig('hashAlgorithm') !== null) {
5555
$credentials[$dataField] = Security::hash(
5656
$credentials[$dataField],
57-
$this->getConfig('hashAlgorithm')
57+
$this->getConfig('hashAlgorithm'),
5858
);
5959
}
6060

src/Middleware/AuthenticationMiddleware.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,7 @@ class AuthenticationMiddleware implements MiddlewareInterface
5959
*/
6060
public function __construct(
6161
AuthenticationServiceInterface|AuthenticationServiceProviderInterface $subject,
62-
?ContainerInterface $container = null
62+
?ContainerInterface $container = null,
6363
) {
6464
$this->subject = $subject;
6565
$this->container = $container;

src/PasswordHasher/DefaultPasswordHasher.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,7 @@ public function hash(string $password): string
4848
return password_hash(
4949
$password,
5050
$this->_config['hashType'],
51-
$this->_config['hashOptions']
51+
$this->_config['hashOptions'],
5252
);
5353
}
5454

src/UrlChecker/UrlCheckerTrait.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ protected function _checkUrl(ServerRequestInterface $request): bool
3636
return $this->_getUrlChecker()->check(
3737
$request,
3838
$this->getConfig('loginUrl'),
39-
(array)$this->getConfig('urlChecker')
39+
(array)$this->getConfig('urlChecker'),
4040
);
4141
}
4242

@@ -68,7 +68,7 @@ protected function _getUrlChecker(): UrlCheckerInterface
6868
throw new RuntimeException(sprintf(
6969
'The provided URL checker class `%s` does not implement the `%s` interface.',
7070
$options['className'],
71-
UrlCheckerInterface::class
71+
UrlCheckerInterface::class,
7272
));
7373
}
7474

src/View/Helper/IdentityHelper.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -63,7 +63,7 @@ public function initialize(array $config): void
6363

6464
if (!$this->_identity instanceof IdentityInterface) {
6565
throw new RuntimeException(
66-
sprintf('Identity found in request does not implement %s', IdentityInterface::class)
66+
sprintf('Identity found in request does not implement %s', IdentityInterface::class),
6767
);
6868
}
6969
}

0 commit comments

Comments
 (0)