Skip to content

Commit 11e9748

Browse files
committed
Auto-fix CS - CS master branch
1 parent a9c61fb commit 11e9748

File tree

14 files changed

+115
-111
lines changed

14 files changed

+115
-111
lines changed

src/Auth/DigestAuthenticate.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -192,9 +192,9 @@ public function parseAuthData(string $digest): ?array {
192192
*/
193193
public function generateResponseHash(array $digest, string $password, string $method): string {
194194
return md5(
195-
$password .
196-
':' . $digest['nonce'] . ':' . $digest['nc'] . ':' . $digest['cnonce'] . ':' . $digest['qop'] . ':' .
197-
md5($method . ':' . $digest['uri']),
195+
$password
196+
. ':' . $digest['nonce'] . ':' . $digest['nc'] . ':' . $digest['cnonce'] . ':' . $digest['qop'] . ':'
197+
. md5($method . ':' . $digest['uri']),
198198
);
199199
}
200200

src/Authenticator/PrimaryKeySessionAuthenticator.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -131,8 +131,8 @@ public function impersonate(
131131
$session = $request->getAttribute('session');
132132
if ($session->check($impersonateSessionKey)) {
133133
throw new UnauthorizedException(
134-
'You are impersonating a user already. ' .
135-
'Stop the current impersonation before impersonating another user.',
134+
'You are impersonating a user already. '
135+
. 'Stop the current impersonation before impersonating another user.',
136136
);
137137
}
138138
$session->write($impersonateSessionKey, $impersonator[$this->getConfig('idField')]);

src/Panel/AuthPanel.php

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -45,8 +45,7 @@ class AuthPanel extends DebugPanel {
4545
/**
4646
* @var array
4747
*/
48-
protected array $_defaultConfig = [
49-
];
48+
protected array $_defaultConfig = [];
5049

5150
public function __construct() {
5251
$this->setConfig(Config::all());

src/Policy/RequestPolicy.php

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -23,8 +23,7 @@ class RequestPolicy implements RequestPolicyInterface {
2323
/**
2424
* @var array<string, mixed>
2525
*/
26-
protected array $_defaultConfig = [
27-
];
26+
protected array $_defaultConfig = [];
2827

2928
/**
3029
* @param array<string, mixed> $config

src/Utility/TinyAuth.php

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,8 +15,7 @@ class TinyAuth {
1515
/**
1616
* @var array
1717
*/
18-
protected array $_defaultConfig = [
19-
];
18+
protected array $_defaultConfig = [];
2019

2120
/**
2221
* @param array<string, mixed> $config

tests/TestCase/Auth/TinyAuthorizeTest.php

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -749,8 +749,7 @@ public function testBasicUserMethodAllowedWildcardSpecificGroup() {
749749
* @return void
750750
*/
751751
public function testDeny() {
752-
$object = new TestTinyAuthorize($this->collection, [
753-
]);
752+
$object = new TestTinyAuthorize($this->collection, []);
754753

755754
// All tests performed against this action
756755
$this->request = $this->request->withParam('action', 'foo');
@@ -771,8 +770,7 @@ public function testDeny() {
771770
* @return void
772771
*/
773772
public function testAllowNestedPrefix() {
774-
$object = new TestTinyAuthorize($this->collection, [
775-
]);
773+
$object = new TestTinyAuthorize($this->collection, []);
776774

777775
// All tests performed against this action
778776
$this->request = $this->request->withParam('action', 'myModerator');
@@ -1091,7 +1089,8 @@ public function testIniParsingMissingFileException() {
10911089

10921090
$method->invokeArgs($object, [
10931091
Plugin::path('TinyAuth') . 'non' . DS . 'existent' . DS,
1094-
'auth_acl.ini']);
1092+
'auth_acl.ini',
1093+
]);
10951094
}
10961095

10971096
/**

tests/TestCase/Authenticator/PrimaryKeySessionAuthenticatorTest.php

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@ public function setUp(): void {
4242
parent::setUp();
4343

4444
$this->identifiers = new IdentifierCollection([
45-
'Authentication.Password',
45+
'Authentication.Password',
4646
]);
4747

4848
$this->sessionMock = $this->getMockBuilder(Session::class)
@@ -117,8 +117,7 @@ public function testAuthenticateSuccessCustomFinder() {
117117
],
118118
]);
119119

120-
$authenticator = new PrimaryKeySessionAuthenticator($this->identifiers, [
121-
]);
120+
$authenticator = new PrimaryKeySessionAuthenticator($this->identifiers, []);
122121
$result = $authenticator->authenticate($request);
123122

124123
$this->assertInstanceOf(Result::class, $result);
@@ -165,8 +164,7 @@ public function testVerifyByDatabaseFailure() {
165164

166165
$request = $request->withAttribute('session', $this->sessionMock);
167166

168-
$authenticator = new PrimaryKeySessionAuthenticator($this->identifiers, [
169-
]);
167+
$authenticator = new PrimaryKeySessionAuthenticator($this->identifiers, []);
170168
$result = $authenticator->authenticate($request);
171169

172170
$this->assertInstanceOf(Result::class, $result);

tests/TestCase/Controller/Component/AuthComponentTest.php

Lines changed: 47 additions & 41 deletions
Original file line numberDiff line numberDiff line change
@@ -49,13 +49,14 @@ public function setUp(): void {
4949
*/
5050
public function testValid() {
5151
$request = new ServerRequest([
52-
'params' => [
53-
'controller' => 'Users',
54-
'action' => 'view',
55-
'plugin' => null,
56-
'_ext' => null,
57-
'pass' => [1],
58-
]]);
52+
'params' => [
53+
'controller' => 'Users',
54+
'action' => 'view',
55+
'plugin' => null,
56+
'_ext' => null,
57+
'pass' => [1],
58+
],
59+
]);
5960
$controller = $this->getControllerMock($request);
6061

6162
$registry = new ComponentRegistry($controller);
@@ -76,13 +77,14 @@ public function testValid() {
7677
*/
7778
public function testValidAnyAction() {
7879
$request = new ServerRequest([
79-
'params' => [
80-
'plugin' => 'Extras',
81-
'controller' => 'Offers',
82-
'action' => 'index',
83-
'_ext' => null,
84-
'pass' => [1],
85-
]]);
80+
'params' => [
81+
'plugin' => 'Extras',
82+
'controller' => 'Offers',
83+
'action' => 'index',
84+
'_ext' => null,
85+
'pass' => [1],
86+
],
87+
]);
8688
$controller = new OffersController($request);
8789

8890
$registry = new ComponentRegistry($controller);
@@ -103,13 +105,14 @@ public function testValidAnyAction() {
103105
*/
104106
public function testDeniedActionInController() {
105107
$request = new ServerRequest([
106-
'params' => [
107-
'plugin' => 'Extras',
108-
'controller' => 'Offers',
109-
'action' => 'denied',
110-
'_ext' => null,
111-
'pass' => [1],
112-
]]);
108+
'params' => [
109+
'plugin' => 'Extras',
110+
'controller' => 'Offers',
111+
'action' => 'denied',
112+
'_ext' => null,
113+
'pass' => [1],
114+
],
115+
]);
113116
$controller = new OffersController($request);
114117
$controller->loadComponent('TinyAuth.Auth', $this->componentConfig);
115118

@@ -162,12 +165,13 @@ public function testDeniedAction() {
162165
*/
163166
public function testValidActionNestedPrefix() {
164167
$request = new ServerRequest([
165-
'params' => [
166-
'plugin' => null,
167-
'prefix' => 'Admin/MyPrefix',
168-
'controller' => 'MyTest',
169-
'action' => 'myPublic',
170-
]]);
168+
'params' => [
169+
'plugin' => null,
170+
'prefix' => 'Admin/MyPrefix',
171+
'controller' => 'MyTest',
172+
'action' => 'myPublic',
173+
],
174+
]);
171175
$controller = new MyTestController($request);
172176

173177
$registry = new ComponentRegistry($controller);
@@ -188,12 +192,13 @@ public function testValidActionNestedPrefix() {
188192
*/
189193
public function testDeniedActionNestedPrefix() {
190194
$request = new ServerRequest([
191-
'params' => [
192-
'plugin' => null,
193-
'prefix' => 'admin/my_prefix',
194-
'controller' => 'MyTest',
195-
'action' => 'myAll',
196-
]]);
195+
'params' => [
196+
'plugin' => null,
197+
'prefix' => 'admin/my_prefix',
198+
'controller' => 'MyTest',
199+
'action' => 'myAll',
200+
],
201+
]);
197202
$controller = new MyTestController($request);
198203
$controller->loadComponent('TinyAuth.Auth', $this->componentConfig);
199204

@@ -216,13 +221,14 @@ public function testDeniedActionNestedPrefix() {
216221
*/
217222
public function testInvalid() {
218223
$request = new ServerRequest([
219-
'params' => [
220-
'controller' => 'FooBar',
221-
'action' => 'index',
222-
'plugin' => null,
223-
'_ext' => null,
224-
'pass' => [],
225-
]]);
224+
'params' => [
225+
'controller' => 'FooBar',
226+
'action' => 'index',
227+
'plugin' => null,
228+
'_ext' => null,
229+
'pass' => [],
230+
],
231+
]);
226232
$controller = $this->getControllerMock($request);
227233

228234
$registry = new ComponentRegistry($controller);
@@ -243,7 +249,7 @@ public function testInvalid() {
243249
* @param \Cake\Http\ServerRequest $request
244250
* @return \Cake\Controller\Controller|\PHPUnit\Framework\MockObject\MockObject
245251
*/
246-
protected function getControllerMock(ServerRequest $request) {
252+
protected function getControllerMock(ServerRequest $request): Controller {
247253
$controller = $this->getMockBuilder(Controller::class)
248254
->setConstructorArgs([$request])
249255
->onlyMethods(['isAction'])

tests/TestCase/Controller/Component/AuthUserComponentTest.php

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -109,8 +109,7 @@ public function testIsAuthorizedInvalid() {
109109
* @return void
110110
*/
111111
public function testIsAuthorizedNotLoggedIn() {
112-
$user = [
113-
];
112+
$user = [];
114113
$identity = new Identity($user);
115114
$this->AuthUser->getController()->setRequest($this->AuthUser->getController()->getRequest()->withAttribute('identity', $identity));
116115

tests/TestCase/Controller/Component/AuthenticationComponentTest.php

Lines changed: 40 additions & 34 deletions
Original file line numberDiff line numberDiff line change
@@ -62,13 +62,14 @@ public function testValid() {
6262
*/
6363
public function testIsPublic() {
6464
$request = new ServerRequest([
65-
'params' => [
66-
'controller' => 'Users',
67-
'action' => 'view',
68-
'plugin' => null,
69-
'_ext' => null,
70-
'pass' => [1],
71-
]]);
65+
'params' => [
66+
'controller' => 'Users',
67+
'action' => 'view',
68+
'plugin' => null,
69+
'_ext' => null,
70+
'pass' => [1],
71+
],
72+
]);
7273
$controller = $this->getControllerMock($request);
7374
$registry = new ComponentRegistry($controller);
7475
$this->component = new AuthenticationComponent($registry, $this->componentConfig);
@@ -82,13 +83,14 @@ public function testIsPublic() {
8283
*/
8384
public function testIsPublicFail() {
8485
$request = new ServerRequest([
85-
'params' => [
86-
'controller' => 'Sales',
87-
'action' => 'view',
88-
'plugin' => null,
89-
'_ext' => null,
90-
'pass' => [1],
91-
]]);
86+
'params' => [
87+
'controller' => 'Sales',
88+
'action' => 'view',
89+
'plugin' => null,
90+
'_ext' => null,
91+
'pass' => [1],
92+
],
93+
]);
9294
$controller = $this->getControllerMock($request);
9395
$registry = new ComponentRegistry($controller);
9496
$this->component = new AuthenticationComponent($registry, $this->componentConfig);
@@ -102,10 +104,11 @@ public function testIsPublicFail() {
102104
*/
103105
public function testIsPublicAllowNonPrefixed() {
104106
$request = new ServerRequest([
105-
'params' => [
106-
'controller' => 'Foos',
107-
'action' => 'view',
108-
]]);
107+
'params' => [
108+
'controller' => 'Foos',
109+
'action' => 'view',
110+
],
111+
]);
109112
$controller = $this->getControllerMock($request);
110113
$registry = new ComponentRegistry($controller);
111114
$this->component = new AuthenticationComponent($registry, ['allowNonPrefixed' => true] + $this->componentConfig);
@@ -119,11 +122,12 @@ public function testIsPublicAllowNonPrefixed() {
119122
*/
120123
public function testIsPublicAllowNonPrefixedFail() {
121124
$request = new ServerRequest([
122-
'params' => [
123-
'controller' => 'Foos',
124-
'action' => 'view',
125-
'prefix' => 'Foo',
126-
]]);
125+
'params' => [
126+
'controller' => 'Foos',
127+
'action' => 'view',
128+
'prefix' => 'Foo',
129+
],
130+
]);
127131
$controller = $this->getControllerMock($request);
128132
$registry = new ComponentRegistry($controller);
129133
$this->component = new AuthenticationComponent($registry, ['allowNonPrefixed' => true] + $this->componentConfig);
@@ -137,11 +141,12 @@ public function testIsPublicAllowNonPrefixedFail() {
137141
*/
138142
public function testIsPublicAllowPrefixed() {
139143
$request = new ServerRequest([
140-
'params' => [
141-
'controller' => 'Foos',
142-
'action' => 'view',
143-
'prefix' => 'FooBar',
144-
]]);
144+
'params' => [
145+
'controller' => 'Foos',
146+
'action' => 'view',
147+
'prefix' => 'FooBar',
148+
],
149+
]);
145150
$controller = $this->getControllerMock($request);
146151
$registry = new ComponentRegistry($controller);
147152
$this->component = new AuthenticationComponent($registry, ['allowPrefixes' => 'FooBar'] + $this->componentConfig);
@@ -155,11 +160,12 @@ public function testIsPublicAllowPrefixed() {
155160
*/
156161
public function testIsPublicAllowPrefixedFail() {
157162
$request = new ServerRequest([
158-
'params' => [
159-
'controller' => 'Foos',
160-
'action' => 'view',
161-
'prefix' => 'Foo',
162-
]]);
163+
'params' => [
164+
'controller' => 'Foos',
165+
'action' => 'view',
166+
'prefix' => 'Foo',
167+
],
168+
]);
163169
$controller = $this->getControllerMock($request);
164170
$registry = new ComponentRegistry($controller);
165171
$this->component = new AuthenticationComponent($registry, ['allowPrefixes' => 'FooBar'] + $this->componentConfig);
@@ -172,7 +178,7 @@ public function testIsPublicAllowPrefixedFail() {
172178
* @param \Cake\Http\ServerRequest $request
173179
* @return \Cake\Controller\Controller|\PHPUnit\Framework\MockObject\MockObject
174180
*/
175-
protected function getControllerMock(ServerRequest $request) {
181+
protected function getControllerMock(ServerRequest $request): Controller {
176182
$controller = $this->getMockBuilder(Controller::class)
177183
->setConstructorArgs([$request])
178184
->onlyMethods(['isAction'])

0 commit comments

Comments
 (0)