aboutsummaryrefslogtreecommitdiff
path: root/lib/Minz/ActionController.php
diff options
context:
space:
mode:
authorGravatar Alexandre Alapetite <alexandre@alapetite.fr> 2023-04-05 23:26:38 +0200
committerGravatar GitHub <noreply@github.com> 2023-04-05 23:26:38 +0200
commit2118448133e327294ad2b69ed8736bc29879103d (patch)
tree00c003056dedbd8e3554801d6493a25641a260a5 /lib/Minz/ActionController.php
parent4f078958b5603900592e14f9f3189bbebfc81bab (diff)
PHPStan level 6 for more files (#5264)
7 more files passing (see phpstan-next.txt)
Diffstat (limited to 'lib/Minz/ActionController.php')
-rw-r--r--lib/Minz/ActionController.php16
1 files changed, 10 insertions, 6 deletions
diff --git a/lib/Minz/ActionController.php b/lib/Minz/ActionController.php
index c29ae8ad8..8cc9fbc0b 100644
--- a/lib/Minz/ActionController.php
+++ b/lib/Minz/ActionController.php
@@ -17,9 +17,13 @@ class Minz_ActionController {
/** @var array<string,string> */
private $csp_policies;
+ /** @var Minz_View */
protected $view;
- // Gives the possibility to override the default View type.
+ /**
+ * Gives the possibility to override the default View type.
+ * @var class-string
+ */
public static $viewType = 'Minz_View';
public function __construct () {
@@ -37,7 +41,7 @@ class Minz_ActionController {
/**
* Getteur
*/
- public function view () {
+ public function view(): Minz_View {
return $this->view;
}
@@ -45,7 +49,7 @@ class Minz_ActionController {
* Set default CSP policies.
* @param array<string,string> $policies An array where keys are directives and values are sources.
*/
- public static function _defaultCsp($policies) {
+ public static function _defaultCsp(array $policies): void {
if (!isset($policies['default-src'])) {
Minz_Log::warning('Default CSP policy is not declared', ADMIN_LOG);
}
@@ -61,9 +65,9 @@ class Minz_ActionController {
* - https://developer.mozilla.org/en-US/docs/Web/HTTP/CSP
* - https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Content-Security-Policy/default-src
*
- * @param array $policies An array where keys are directives and values are sources.
+ * @param array<string,string> $policies An array where keys are directives and values are sources.
*/
- protected function _csp($policies) {
+ protected function _csp(array $policies): void {
if (!isset($policies['default-src'])) {
$action = Minz_Request::controllerName() . '#' . Minz_Request::actionName();
Minz_Log::warning(
@@ -77,7 +81,7 @@ class Minz_ActionController {
/**
* Send HTTP Content-Security-Policy header based on declared policies.
*/
- public function declareCspHeader() {
+ public function declareCspHeader(): void {
$policies = [];
foreach ($this->csp_policies as $directive => $sources) {
$policies[] = $directive . ' ' . $sources;