diff options
author | Roeland Jago Douma <roeland@famdouma.nl> | 2018-03-05 15:27:05 +0100 |
---|---|---|
committer | Roeland Jago Douma <roeland@famdouma.nl> | 2018-03-05 15:27:05 +0100 |
commit | 4ed9b74a6b2b9f0bb79879ee725c133f3ff299c9 (patch) | |
tree | b19961b477ad1b03e431e56e5d6edb383a8ec2f8 /lib/private/Security/CSP/ContentSecurityPolicyManager.php | |
parent | c85c64c787057afac7000c0c24a7b791f4788c55 (diff) | |
download | nextcloud-server-4ed9b74a6b2b9f0bb79879ee725c133f3ff299c9.tar.gz nextcloud-server-4ed9b74a6b2b9f0bb79879ee725c133f3ff299c9.zip |
Make OC\Security\CSP strict
Signed-off-by: Roeland Jago Douma <roeland@famdouma.nl>
Diffstat (limited to 'lib/private/Security/CSP/ContentSecurityPolicyManager.php')
-rw-r--r-- | lib/private/Security/CSP/ContentSecurityPolicyManager.php | 11 |
1 files changed, 6 insertions, 5 deletions
diff --git a/lib/private/Security/CSP/ContentSecurityPolicyManager.php b/lib/private/Security/CSP/ContentSecurityPolicyManager.php index 0e6f0ac6152..27a0524d3f3 100644 --- a/lib/private/Security/CSP/ContentSecurityPolicyManager.php +++ b/lib/private/Security/CSP/ContentSecurityPolicyManager.php @@ -1,4 +1,5 @@ <?php +declare(strict_types=1); /** * @copyright Copyright (c) 2016, ownCloud, Inc. * @@ -41,7 +42,7 @@ class ContentSecurityPolicyManager implements IContentSecurityPolicyManager { * * @return ContentSecurityPolicy */ - public function getDefaultPolicy() { + public function getDefaultPolicy(): ContentSecurityPolicy { $defaultPolicy = new \OC\Security\CSP\ContentSecurityPolicy(); foreach($this->policies as $policy) { $defaultPolicy = $this->mergePolicies($defaultPolicy, $policy); @@ -57,14 +58,14 @@ class ContentSecurityPolicyManager implements IContentSecurityPolicyManager { * @return ContentSecurityPolicy */ public function mergePolicies(ContentSecurityPolicy $defaultPolicy, - EmptyContentSecurityPolicy $originalPolicy) { + EmptyContentSecurityPolicy $originalPolicy): ContentSecurityPolicy { foreach((object)(array)$originalPolicy as $name => $value) { $setter = 'set'.ucfirst($name); - if(is_array($value)) { + if(\is_array($value)) { $getter = 'get'.ucfirst($name); - $currentValues = is_array($defaultPolicy->$getter()) ? $defaultPolicy->$getter() : []; + $currentValues = \is_array($defaultPolicy->$getter()) ? $defaultPolicy->$getter() : []; $defaultPolicy->$setter(array_values(array_unique(array_merge($currentValues, $value)))); - } elseif (is_bool($value)) { + } elseif (\is_bool($value)) { $defaultPolicy->$setter($value); } } |