Skip to content

Commit 098a057

Browse files
committed
Fix CS.
1 parent 586119e commit 098a057

19 files changed

Lines changed: 55 additions & 55 deletions

src/AuthorizationService.php

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ class AuthorizationService implements AuthorizationServiceInterface
3535
protected ResolverInterface $resolver;
3636

3737
/**
38-
* Track whether or not authorization was checked.
38+
* Track whether authorization was checked.
3939
*
4040
* @var bool
4141
*/
@@ -82,7 +82,7 @@ protected function performCheck(
8282
?IdentityInterface $user,
8383
string $action,
8484
mixed $resource,
85-
mixed ...$optionalArgs
85+
mixed ...$optionalArgs,
8686
): bool|ResultInterface {
8787
$this->authorizationChecked = true;
8888
$policy = $this->resolver->getPolicy($resource);
@@ -102,8 +102,8 @@ protected function performCheck(
102102
is_bool($result) || $result instanceof ResultInterface,
103103
new Exception(sprintf(
104104
'Authorization check method must return `%s` or `bool`.',
105-
ResultInterface::class
106-
))
105+
ResultInterface::class,
106+
)),
107107
);
108108

109109
return $result;
@@ -144,7 +144,7 @@ protected function getCanHandler(mixed $policy, string $action): Closure
144144

145145
assert(
146146
method_exists($policy, $method) || method_exists($policy, '__call'),
147-
new MissingMethodException([$method, $action, get_class($policy)])
147+
new MissingMethodException([$method, $action, get_class($policy)]),
148148
);
149149

150150
return [$policy, $method](...);
@@ -164,7 +164,7 @@ protected function getScopeHandler(mixed $policy, string $action): Closure
164164

165165
assert(
166166
method_exists($policy, $method) || method_exists($policy, '__call'),
167-
new MissingMethodException([$method, $action, get_class($policy)])
167+
new MissingMethodException([$method, $action, get_class($policy)]),
168168
);
169169

170170
return [$policy, $method](...);

src/AuthorizationServiceInterface.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,7 @@ public function canResult(
5353
?IdentityInterface $user,
5454
string $action,
5555
mixed $resource,
56-
mixed ...$optionalArgs
56+
mixed ...$optionalArgs,
5757
): ResultInterface;
5858

5959
/**
@@ -74,11 +74,11 @@ public function applyScope(
7474
?IdentityInterface $user,
7575
string $action,
7676
mixed $resource,
77-
mixed ...$optionalArgs
77+
mixed ...$optionalArgs,
7878
): mixed;
7979

8080
/**
81-
* Return a boolean based on whether or not this object
81+
* Return a boolean based on whether this object
8282
* has had an authorization operation performed.
8383
*
8484
* @return bool

src/Controller/Component/AuthorizationComponent.php

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -123,7 +123,7 @@ public function canResult(mixed $resource, ?string $action = null): ResultInterf
123123
protected function performCheck(
124124
mixed $resource,
125125
?string $action = null,
126-
string $method = 'can'
126+
string $method = 'can',
127127
): ResultInterface|bool {
128128
$request = $this->getController()->getRequest();
129129
if ($action === null) {
@@ -197,7 +197,7 @@ public function mapAction(string $controllerAction, string $policyAction)
197197
/**
198198
* Allows to map controller actions to policy actions.
199199
*
200-
* @param array $actions Map of controller action to policy action.
200+
* @param array<string, mixed> $actions Map of controller action to policy action.
201201
* @param bool $overwrite Set to true to override configuration. False will merge with current configuration.
202202
* @return $this
203203
*/
@@ -238,7 +238,7 @@ protected function getService(ServerRequestInterface $request): AuthorizationSer
238238
'Expected that `%s` would be an instance of %s, but got %s',
239239
$serviceAttribute,
240240
AuthorizationServiceInterface::class,
241-
$type
241+
$type,
242242
));
243243
}
244244

@@ -266,7 +266,7 @@ protected function getIdentity(ServerRequestInterface $request): ?IdentityInterf
266266
'Expected that `%s` would be an instance of %s, but got %s',
267267
$identityAttribute,
268268
IdentityInterface::class,
269-
$type
269+
$type,
270270
));
271271
}
272272

src/Exception/ForbiddenException.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,7 @@ public function __construct(
5151
?ResultInterface $result = null,
5252
string|array $message = '',
5353
?int $code = null,
54-
?Throwable $previous = null
54+
?Throwable $previous = null,
5555
) {
5656
$this->result = $result;
5757

src/Middleware/AuthorizationMiddleware.php

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -85,14 +85,14 @@ class AuthorizationMiddleware implements MiddlewareInterface
8585
* Constructor.
8686
*
8787
* @param \Authorization\AuthorizationServiceInterface|\Authorization\AuthorizationServiceProviderInterface $subject Authorization service or provider instance.
88-
* @param array $config Config array.
88+
* @param array<string, mixed> $config Config array.
8989
* @param \Cake\Core\ContainerInterface|null $container The container instance from the application
9090
* @throws \InvalidArgumentException
9191
*/
9292
public function __construct(
9393
AuthorizationServiceInterface|AuthorizationServiceProviderInterface $subject,
9494
array $config = [],
95-
?ContainerInterface $container = null
95+
?ContainerInterface $container = null,
9696
) {
9797
if ($this->_defaultConfig['identityDecorator'] === null) {
9898
$this->_defaultConfig['identityDecorator'] = interface_exists(AuthenIdentityInterface::class)
@@ -142,7 +142,7 @@ public function process(ServerRequestInterface $request, RequestHandlerInterface
142142
$response = $this->handleException(
143143
$exception,
144144
$request,
145-
$this->getConfig('unauthorizedHandler')
145+
$this->getConfig('unauthorizedHandler'),
146146
);
147147
}
148148

@@ -157,7 +157,7 @@ public function process(ServerRequestInterface $request, RequestHandlerInterface
157157
* @throws \RuntimeException When authorization method has not been defined.
158158
*/
159159
protected function getAuthorizationService(
160-
ServerRequestInterface $request
160+
ServerRequestInterface $request,
161161
): AuthorizationServiceInterface {
162162
$service = $this->subject;
163163
if ($this->subject instanceof AuthorizationServiceProviderInterface) {
@@ -168,7 +168,7 @@ protected function getAuthorizationService(
168168
throw new RuntimeException(sprintf(
169169
'Invalid service returned from the provider. `%s` does not implement `%s`.',
170170
get_debug_type($service),
171-
AuthorizationServiceInterface::class
171+
AuthorizationServiceInterface::class,
172172
));
173173
}
174174

@@ -184,7 +184,7 @@ protected function getAuthorizationService(
184184
*/
185185
protected function buildIdentity(
186186
AuthorizationServiceInterface $service,
187-
ArrayAccess|array $identity
187+
ArrayAccess|array $identity,
188188
): IdentityInterface {
189189
$class = $this->getConfig('identityDecorator');
190190

@@ -200,7 +200,7 @@ protected function buildIdentity(
200200
throw new RuntimeException(sprintf(
201201
'Invalid identity returned by decorator. `%s` does not implement `%s`.',
202202
get_debug_type($identity),
203-
IdentityInterface::class
203+
IdentityInterface::class,
204204
));
205205
}
206206

src/Middleware/RequestAuthorizationMiddleware.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,7 @@ class RequestAuthorizationMiddleware implements MiddlewareInterface
5757
/**
5858
* Constructor
5959
*
60-
* @param array $config Configuration options
60+
* @param array<string, mixed> $config Configuration options
6161
*/
6262
public function __construct(array $config = [])
6363
{

src/Middleware/UnauthorizedHandler/CakeRedirectHandler.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,7 @@ public function __construct()
5555
'Class `%s` does not exist. ' .
5656
'Make sure you are using a full CakePHP framework ' .
5757
'and have autoloading configured properly.',
58-
Router::class
58+
Router::class,
5959
);
6060
throw new RuntimeException($message);
6161
}

src/Middleware/UnauthorizedHandler/ExceptionHandler.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ class ExceptionHandler implements HandlerInterface
3131
public function handle(
3232
Exception $exception,
3333
ServerRequestInterface $request,
34-
array $options = []
34+
array $options = [],
3535
): ResponseInterface {
3636
throw $exception;
3737
}

src/Middleware/UnauthorizedHandler/HandlerFactory.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@ public static function create(string $name): HandlerInterface
4444
$message = sprintf(
4545
'Handler should implement `%s`, got `%s`.',
4646
HandlerInterface::class,
47-
get_class($instance)
47+
get_class($instance),
4848
);
4949
throw new RuntimeException($message);
5050
}

src/Middleware/UnauthorizedHandler/HandlerInterface.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -30,12 +30,12 @@ interface HandlerInterface
3030
*
3131
* @param \Authorization\Exception\Exception $exception Authorization exception thrown by the application.
3232
* @param \Psr\Http\Message\ServerRequestInterface $request Server request.
33-
* @param array $options Options array.
33+
* @param array<string, mixed> $options Options array.
3434
* @return \Psr\Http\Message\ResponseInterface
3535
*/
3636
public function handle(
3737
Exception $exception,
3838
ServerRequestInterface $request,
39-
array $options = []
39+
array $options = [],
4040
): ResponseInterface;
4141
}

0 commit comments

Comments
 (0)