Skip to content

Commit 5bc0f8a

Browse files
committed
more set list
1 parent 7896c78 commit 5bc0f8a

File tree

9 files changed

+94
-80
lines changed

9 files changed

+94
-80
lines changed

rector.php

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,9 @@
1313
$containerConfigurator->import(SetList::PHP_72);
1414
$containerConfigurator->import(SetList::PHP_73);
1515
$containerConfigurator->import(SetList::CODE_QUALITY);
16+
$containerConfigurator->import(SetList::CODE_QUALITY_STRICT);
17+
$containerConfigurator->import(SetList::NAMING);
18+
$containerConfigurator->import(SetList::TYPE_DECLARATION);
1619

1720
$parameters = $containerConfigurator->parameters();
1821
$parameters->set(Option::PATHS, [__DIR__ . '/config', __DIR__ . '/src', __DIR__ . '/spec']);

spec/Listener/ForceHttpsFactorySpec.php

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -9,17 +9,17 @@
99

1010
describe('ForceHttpsFactory', function () {
1111

12-
beforeAll(function () {
12+
beforeAll(function (): void {
1313
$this->factory = new ForceHttpsFactory();
1414
});
1515

1616
describe('->__invoke', function () {
1717

18-
given('container', function () {
18+
given('container', function (): object {
1919
return Double::instance(['implements' => ContainerInterface::class]);
2020
});
2121

22-
it('returns ' . ForceHttps::class . ' instance with default config', function () {
22+
it('returns ' . ForceHttps::class . ' instance with default config', function (): void {
2323

2424
$config = [];
2525
allow($this->container)->toReceive('get')->with('config')->andReturn($config);
@@ -30,7 +30,7 @@
3030

3131
});
3232

33-
it('returns ' . ForceHttps::class . ' instance with module config', function () {
33+
it('returns ' . ForceHttps::class . ' instance with module config', function (): void {
3434

3535
$config = [
3636
'force-https-module' => [

spec/Listener/ForceHttpsSpec.php

Lines changed: 32 additions & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -14,15 +14,15 @@
1414
use Laminas\Router\RouteMatch;
1515
use Laminas\Uri\Uri;
1616

17-
describe('ForceHttps', function () {
17+
describe('ForceHttps', function (): void {
1818

19-
beforeAll(function () {
19+
beforeAll(function (): void {
2020
$this->eventManager = Double::instance(['implements' => EventManagerInterface::class]);
2121
});
2222

23-
describe('->attach()', function () {
23+
describe('->attach()', function (): void {
2424

25-
it('not attach on route on console', function () {
25+
it('not attach on route on console', function (): void {
2626

2727
allow(ForceHttps::class)->toReceive('isInConsole')->andReturn(true);
2828
$listener = new ForceHttps([
@@ -38,7 +38,7 @@
3838

3939
});
4040

41-
it('not attach when not enabled', function () {
41+
it('not attach when not enabled', function (): void {
4242

4343
allow(ForceHttps::class)->toReceive('isInConsole')->andReturn(false);
4444
$listener = new ForceHttps([
@@ -54,7 +54,7 @@
5454

5555
});
5656

57-
it('attach on route event on non-console and enable', function () {
57+
it('attach on route event on non-console and enable', function (): void {
5858

5959
allow(ForceHttps::class)->toReceive('isInConsole')->andReturn(false);
6060
$listener = new ForceHttps([
@@ -74,9 +74,9 @@
7474

7575
});
7676

77-
describe('->forceHttpsScheme()', function () {
77+
describe('->forceHttpsScheme()', function (): void {
7878

79-
beforeEach(function () {
79+
beforeEach(function (): void {
8080
$this->mvcEvent = Double::instance(['extends' => MvcEvent::class, 'methods' => '__construct']);
8181
$this->response = Double::instance(['extends' => Response::class]);
8282
$this->request = Double::instance(['extends' => Request::class]);
@@ -86,9 +86,9 @@
8686
Quit::disable();
8787
});
8888

89-
context('on current scheme is https', function () {
89+
context('on current scheme is https', function (): void {
9090

91-
it('not redirect if uri already has https scheme and without strict_transport_security', function () {
91+
it('not redirect if uri already has https scheme and without strict_transport_security', function (): void {
9292

9393
$listener = new ForceHttps([
9494
'enable' => true,
@@ -109,7 +109,7 @@
109109

110110
});
111111

112-
it('not redirect if router not match', function () {
112+
it('not redirect if router not match', function (): void {
113113

114114
$listener = new ForceHttps([
115115
'enable' => true,
@@ -132,9 +132,9 @@
132132

133133
});
134134

135-
context('on current scheme is http', function () {
135+
context('on current scheme is http', function (): void {
136136

137-
it('not redirect if force_all_routes is false and route name not in force_specific_routes config', function () {
137+
it('not redirect if force_all_routes is false and route name not in force_specific_routes config', function (): void {
138138

139139
$listener = new ForceHttps([
140140
'enable' => true,
@@ -157,7 +157,7 @@
157157

158158
});
159159

160-
it('not redirect on router not match', function () {
160+
it('not redirect on router not match', function (): void {
161161

162162
$listener = new ForceHttps([
163163
'enable' => true,
@@ -174,7 +174,7 @@
174174

175175
});
176176

177-
it('redirect if force_all_routes is false and route name in force_specific_routes config', function () {
177+
it('redirect if force_all_routes is false and route name in force_specific_routes config', function (): void {
178178

179179
$listener = new ForceHttps([
180180
'enable' => true,
@@ -196,7 +196,7 @@
196196
allow($this->response)->toReceive('getHeaders', 'addHeaderLine')->with('Location', 'https://example.com/about');
197197
allow($this->response)->toReceive('send');
198198

199-
$closure = function () use ($listener) {
199+
$closure = function () use ($listener): void {
200200
$listener->forceHttpsScheme($this->mvcEvent);
201201
};
202202
expect($closure)->toThrow(new QuitException('Exit statement occurred', 0));
@@ -205,7 +205,7 @@
205205

206206
});
207207

208-
it('not redirect if force_all_routes is true and route name in exclude_specific_routes config', function () {
208+
it('not redirect if force_all_routes is true and route name in exclude_specific_routes config', function (): void {
209209

210210
$listener = new ForceHttps([
211211
'enable' => true,
@@ -230,7 +230,7 @@
230230
});
231231

232232

233-
it('redirect if force_all_routes is true and route name not in exclude_specific_routes config', function () {
233+
it('redirect if force_all_routes is true and route name not in exclude_specific_routes config', function (): void {
234234

235235
$listener = new ForceHttps([
236236
'enable' => true,
@@ -253,15 +253,15 @@
253253
allow($this->response)->toReceive('getHeaders', 'addHeaderLine')->with('Location', 'https://example.com/about');
254254
allow($this->response)->toReceive('send');
255255

256-
$closure = function () use ($listener) {
256+
$closure = function () use ($listener): void {
257257
$listener->forceHttpsScheme($this->mvcEvent);
258258
};
259259
expect($closure)->toThrow(new QuitException('Exit statement occurred', 0));
260260

261261
expect($this->mvcEvent)->toReceive('getResponse');
262262
});
263263

264-
it('redirect if force_all_routes is true', function () {
264+
it('redirect if force_all_routes is true', function (): void {
265265

266266
$listener = new ForceHttps([
267267
'enable' => true,
@@ -287,7 +287,7 @@
287287
allow($this->response)->toReceive('getHeaders', 'addHeaderLine')->with('Location', 'https://example.com/about');
288288
allow($this->response)->toReceive('send');
289289

290-
$closure = function () use ($listener) {
290+
$closure = function () use ($listener): void {
291291
$listener->forceHttpsScheme($this->mvcEvent);
292292
};
293293
expect($closure)->toThrow(new QuitException('Exit statement occurred', 0));
@@ -296,7 +296,7 @@
296296

297297
});
298298

299-
it('redirect if force_all_routes is true and strict_transport_security config exists', function () {
299+
it('redirect if force_all_routes is true and strict_transport_security config exists', function (): void {
300300

301301
$listener = new ForceHttps([
302302
'enable' => true,
@@ -320,7 +320,7 @@
320320
allow($this->response)->toReceive('getHeaders', 'addHeaderLine')->with('Location', 'https://example.com/about');
321321
allow($this->response)->toReceive('send');
322322

323-
$closure = function () use ($listener) {
323+
$closure = function () use ($listener): void {
324324
$listener->forceHttpsScheme($this->mvcEvent);
325325
};
326326
expect($closure)->toThrow(new QuitException('Exit statement occurred', 0));
@@ -331,7 +331,7 @@
331331
});
332332

333333

334-
it('redirect no router not match, but allow_404 is true', function () {
334+
it('redirect no router not match, but allow_404 is true', function (): void {
335335

336336
$listener = new ForceHttps([
337337
'enable' => true,
@@ -349,7 +349,7 @@
349349
allow($this->response)->toReceive('getHeaders', 'addHeaderLine')->with('Location', 'https://example.com/404');
350350
allow($this->response)->toReceive('send');
351351

352-
$closure = function () use ($listener) {
352+
$closure = function () use ($listener): void {
353353
$listener->forceHttpsScheme($this->mvcEvent);
354354
};
355355
expect($closure)->toThrow(new QuitException('Exit statement occurred', 0));
@@ -359,7 +359,7 @@
359359

360360
});
361361

362-
it('redirect with www prefix with configurable "add_www_prefix" on force_all_routes', function () {
362+
it('redirect with www prefix with configurable "add_www_prefix" on force_all_routes', function (): void {
363363

364364
$listener = new ForceHttps([
365365
'enable' => true,
@@ -384,7 +384,7 @@
384384
allow($this->response)->toReceive('getHeaders', 'addHeaderLine')->with('Location', 'https://example.com/about');
385385
allow($this->response)->toReceive('send');
386386

387-
$closure = function () use ($listener) {
387+
$closure = function () use ($listener): void {
388388
$listener->forceHttpsScheme($this->mvcEvent);
389389
};
390390
expect($closure)->toThrow(new QuitException('Exit statement occurred', 0));
@@ -394,7 +394,7 @@
394394

395395
});
396396

397-
it('redirect without www prefix for already has www prefix with configurable "remove_www_prefix" on force_all_routes', function () {
397+
it('redirect without www prefix for already has www prefix with configurable "remove_www_prefix" on force_all_routes', function (): void {
398398

399399
$listener = new ForceHttps([
400400
'enable' => true,
@@ -424,7 +424,7 @@
424424
allow($this->response)->toReceive('setStatusCode')->with(308)->andReturn($this->response);
425425
allow($this->response)->toReceive('send');
426426

427-
$closure = function () use ($listener) {
427+
$closure = function () use ($listener): void {
428428
$listener->forceHttpsScheme($this->mvcEvent);
429429
};
430430
expect($closure)->toThrow(new QuitException('Exit statement occurred', 0));
@@ -433,7 +433,7 @@
433433

434434
});
435435

436-
it('not redirect with set strict_transport_security exists and uri already has https scheme', function () {
436+
it('not redirect with set strict_transport_security exists and uri already has https scheme', function (): void {
437437

438438
$listener = new ForceHttps([
439439
'enable' => true,
@@ -459,7 +459,7 @@
459459

460460
});
461461

462-
it('set Strict-Transport-Security if force_specific_routes has its value, match and strict_transport_security config exists', function () {
462+
it('set Strict-Transport-Security if force_specific_routes has its value, match and strict_transport_security config exists', function (): void {
463463

464464
$listener = new ForceHttps([
465465
'enable' => true,
@@ -492,7 +492,7 @@
492492

493493
});
494494

495-
it('set Strict-Transport-Security to expire if force_specific_routes has its value, match and strict_transport_security config exists', function () {
495+
it('set Strict-Transport-Security to expire if force_specific_routes has its value, match and strict_transport_security config exists', function (): void {
496496

497497
$listener = new ForceHttps([
498498
'enable' => true,

spec/Middleware/ForceHttpsFactorySpec.php

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -10,21 +10,21 @@
1010

1111
describe('ForceHttpsFactory', function () {
1212

13-
beforeAll(function () {
13+
beforeAll(function (): void {
1414
$this->factory = new ForceHttpsFactory();
1515
});
1616

1717
describe('->__invoke', function () {
1818

19-
given('container', function () {
19+
given('container', function (): object {
2020
return Double::instance(['implements' => ContainerInterface::class]);
2121
});
2222

23-
given('router', function () {
23+
given('router', function (): object {
2424
return Double::instance(['implements' => RouterInterface::class]);
2525
});
2626

27-
it('returns ' . ForceHttps::class . ' instance with default config', function () {
27+
it('returns ' . ForceHttps::class . ' instance with default config', function (): void {
2828

2929
$config = [];
3030
allow($this->container)->toReceive('get')->with('config')->andReturn($config);
@@ -36,7 +36,7 @@
3636

3737
});
3838

39-
it('returns ' . ForceHttps::class . ' instance with module config', function () {
39+
it('returns ' . ForceHttps::class . ' instance with module config', function (): void {
4040

4141
$config = [
4242
'force-https-module' => [

0 commit comments

Comments
 (0)