Skip to content

Commit fb3985c

Browse files
committed
more set list
1 parent 6dabb73 commit fb3985c

File tree

3 files changed

+32
-31
lines changed

3 files changed

+32
-31
lines changed

composer.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@
3939
"php-coveralls/php-coveralls": "^2.1",
4040
"phpstan/phpstan": "^0.12.93",
4141
"phpstan/phpstan-webmozart-assert": "^0.12",
42-
"rector/rector": "^0.11.40"
42+
"rector/rector": "dev-main#92318a4"
4343
},
4444
"config": {
4545
"bin-dir": "bin",
@@ -64,6 +64,6 @@
6464
"cs-check": "phpcs",
6565
"cs-fix": "phpcbf"
6666
},
67-
"minimum-stability": "alpha",
67+
"minimum-stability": "dev",
6868
"prefer-stable": true
6969
}

rector.php

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,14 +8,15 @@
88
use Symfony\Component\DependencyInjection\Loader\Configurator\ContainerConfigurator;
99

1010
return static function (ContainerConfigurator $containerConfigurator): void {
11+
$containerConfigurator->import(SetList::DEFLUENT);
1112
$containerConfigurator->import(SetList::PHP_70);
1213
$containerConfigurator->import(SetList::PHP_71);
1314
$containerConfigurator->import(SetList::PHP_72);
1415
$containerConfigurator->import(SetList::PHP_73);
1516
$containerConfigurator->import(SetList::CODE_QUALITY);
16-
$containerConfigurator->import(SetList::CODE_QUALITY_STRICT);
1717
$containerConfigurator->import(SetList::NAMING);
1818
$containerConfigurator->import(SetList::TYPE_DECLARATION);
19+
$containerConfigurator->import(SetList::ORDER);
1920

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

src/Listener/ForceHttps.php

Lines changed: 28 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -45,28 +45,12 @@ public function attach(EventManagerInterface $eventManager, $priority = 1): void
4545
$this->listeners[] = $eventManager->attach(MvcEvent::EVENT_DISPATCH_ERROR, [$this, 'forceHttpsScheme'], 1000);
4646
}
4747

48-
private function setHttpStrictTransportSecurity(
49-
string $uriScheme,
50-
Response $response,
51-
?RouteMatch $routeMatch
52-
): Response {
53-
if ($this->isSkippedHttpStrictTransportSecurity($uriScheme, $routeMatch)) {
54-
return $response;
55-
}
56-
57-
if ($this->config['strict_transport_security']['enable'] === true) {
58-
$response->getHeaders()
59-
->addHeaderLine(sprintf(
60-
'Strict-Transport-Security: %s',
61-
$this->config['strict_transport_security']['value']
62-
));
63-
return $response;
64-
}
65-
66-
// set max-age = 0 to strictly expire it,
67-
$response->getHeaders()
68-
->addHeaderLine('Strict-Transport-Security: max-age=0');
69-
return $response;
48+
/**
49+
* Check if currently running in console
50+
*/
51+
private function isInConsole(): bool
52+
{
53+
return PHP_SAPI === 'cli' || defined('STDIN');
7054
}
7155

7256
/**
@@ -111,11 +95,27 @@ public function forceHttpsScheme(MvcEvent $mvcEvent): void
11195
exit(0);
11296
}
11397

114-
/**
115-
* Check if currently running in console
116-
*/
117-
private function isInConsole(): bool
118-
{
119-
return PHP_SAPI === 'cli' || defined('STDIN');
98+
private function setHttpStrictTransportSecurity(
99+
string $uriScheme,
100+
Response $response,
101+
?RouteMatch $routeMatch
102+
): Response {
103+
if ($this->isSkippedHttpStrictTransportSecurity($uriScheme, $routeMatch)) {
104+
return $response;
105+
}
106+
107+
if ($this->config['strict_transport_security']['enable'] === true) {
108+
$response->getHeaders()
109+
->addHeaderLine(sprintf(
110+
'Strict-Transport-Security: %s',
111+
$this->config['strict_transport_security']['value']
112+
));
113+
return $response;
114+
}
115+
116+
// set max-age = 0 to strictly expire it,
117+
$response->getHeaders()
118+
->addHeaderLine('Strict-Transport-Security: max-age=0');
119+
return $response;
120120
}
121121
}

0 commit comments

Comments
 (0)