diff options
author | Faraz Samapoor <f.samapoor@gmail.com> | 2023-06-26 13:28:09 +0330 |
---|---|---|
committer | Faraz Samapoor <fsa@adlas.at> | 2023-09-27 09:03:15 +0330 |
commit | f313ca92e7defc045d046ab8e5eaf57909d5a212 (patch) | |
tree | d5963040128cac0abe4535c8548fc98e3c693e12 /lib/private/Security/FeaturePolicy | |
parent | 912b18b1fc9fd90bfc78f942cd2043a5a0145e69 (diff) | |
download | nextcloud-server-f313ca92e7defc045d046ab8e5eaf57909d5a212.tar.gz nextcloud-server-f313ca92e7defc045d046ab8e5eaf57909d5a212.zip |
Refactors lib/private/Security.
Mainly using PHP8's constructor property promotion.
Signed-off-by: Faraz Samapoor <fsa@adlas.at>
Diffstat (limited to 'lib/private/Security/FeaturePolicy')
-rw-r--r-- | lib/private/Security/FeaturePolicy/FeaturePolicyManager.php | 16 |
1 files changed, 8 insertions, 8 deletions
diff --git a/lib/private/Security/FeaturePolicy/FeaturePolicyManager.php b/lib/private/Security/FeaturePolicy/FeaturePolicyManager.php index 3aa93ac3da4..bb9fc41332f 100644 --- a/lib/private/Security/FeaturePolicy/FeaturePolicyManager.php +++ b/lib/private/Security/FeaturePolicy/FeaturePolicyManager.php @@ -32,13 +32,11 @@ use OCP\Security\FeaturePolicy\AddFeaturePolicyEvent; class FeaturePolicyManager { /** @var EmptyFeaturePolicy[] */ - private $policies = []; + private array $policies = []; - /** @var IEventDispatcher */ - private $dispatcher; - - public function __construct(IEventDispatcher $dispatcher) { - $this->dispatcher = $dispatcher; + public function __construct( + private IEventDispatcher $dispatcher, + ) { } public function addDefaultPolicy(EmptyFeaturePolicy $policy): void { @@ -60,8 +58,10 @@ class FeaturePolicyManager { * Merges the first given policy with the second one * */ - public function mergePolicies(FeaturePolicy $defaultPolicy, - EmptyFeaturePolicy $originalPolicy): FeaturePolicy { + public function mergePolicies( + FeaturePolicy $defaultPolicy, + EmptyFeaturePolicy $originalPolicy, + ): FeaturePolicy { foreach ((object)(array)$originalPolicy as $name => $value) { $setter = 'set' . ucfirst($name); if (\is_array($value)) { |