Skip to content

Commit 68e05ba

Browse files
committed
refactor: fix static analysis problems
1 parent 5e53f06 commit 68e05ba

File tree

3 files changed

+9
-9
lines changed

3 files changed

+9
-9
lines changed

system/Config/BaseConfig.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -139,7 +139,7 @@ public function __construct()
139139
} elseif ($property === 'previousKeys') {
140140
// previousKeys must be an array
141141
if (is_string($this->{$property})) {
142-
$this->{$property} = array_map(fn ($item) => $this->parseEncryptionKey($item), explode(',', $this->{$property}));
142+
$this->{$property} = array_map(fn ($item): string => $this->parseEncryptionKey($item), explode(',', $this->{$property}));
143143
}
144144
}
145145
}

system/Encryption/Handlers/OpenSSLHandler.php

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -91,7 +91,7 @@ class OpenSSLHandler extends BaseHandler
9191
/**
9292
* {@inheritDoc}
9393
*/
94-
public function encrypt(#[SensitiveParameter] $data, #[SensitiveParameter] $params = null)
94+
public function encrypt($data, $params = null)
9595
{
9696
// Allow key override
9797
if ($params !== null) {
@@ -127,7 +127,7 @@ public function encrypt(#[SensitiveParameter] $data, #[SensitiveParameter] $para
127127
/**
128128
* {@inheritDoc}
129129
*/
130-
public function decrypt($data, #[SensitiveParameter] $params = null)
130+
public function decrypt($data, $params = null)
131131
{
132132
// Allow key override
133133
if ($params !== null) {
@@ -145,7 +145,7 @@ public function decrypt($data, #[SensitiveParameter] $params = null)
145145
$exception = $e;
146146
}
147147

148-
if ($result === false && $this->previousKeysFallbackEnabled && ! empty($this->previousKeys)) {
148+
if ($result === false && $this->previousKeysFallbackEnabled && $this->previousKeys !== []) {
149149
foreach ($this->previousKeys as $previousKey) {
150150
try {
151151
$result = $this->decryptWithKey($data, $previousKey);
@@ -175,7 +175,7 @@ public function decrypt($data, #[SensitiveParameter] $params = null)
175175
*
176176
* @throws EncryptionException
177177
*/
178-
protected function decryptWithKey($data, #[SensitiveParameter] $key)
178+
protected function decryptWithKey($data, $key)
179179
{
180180
// derive a secret key
181181
$authKey = \hash_hkdf($this->digest, $key, 0, $this->authKeyInfo);

system/Encryption/Handlers/SodiumHandler.php

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,7 @@ class SodiumHandler extends BaseHandler
5252
/**
5353
* {@inheritDoc}
5454
*/
55-
public function encrypt(#[SensitiveParameter] $data, #[SensitiveParameter] $params = null)
55+
public function encrypt($data, $params = null)
5656
{
5757
$this->parseParams($params);
5858

@@ -83,7 +83,7 @@ public function encrypt(#[SensitiveParameter] $data, #[SensitiveParameter] $para
8383
/**
8484
* {@inheritDoc}
8585
*/
86-
public function decrypt($data, #[SensitiveParameter] $params = null)
86+
public function decrypt($data, $params = null)
8787
{
8888
$this->parseParams($params);
8989

@@ -100,7 +100,7 @@ public function decrypt($data, #[SensitiveParameter] $params = null)
100100
sodium_memzero($this->key);
101101
}
102102

103-
if ($result === false && $this->previousKeysFallbackEnabled && ! empty($this->previousKeys)) {
103+
if ($result === false && $this->previousKeysFallbackEnabled && $this->previousKeys !== []) {
104104
foreach ($this->previousKeys as $previousKey) {
105105
try {
106106
$result = $this->decryptWithKey($data, $previousKey);
@@ -130,7 +130,7 @@ public function decrypt($data, #[SensitiveParameter] $params = null)
130130
*
131131
* @throws EncryptionException
132132
*/
133-
protected function decryptWithKey($data, #[SensitiveParameter] $key)
133+
protected function decryptWithKey($data, $key)
134134
{
135135
if (mb_strlen($data, '8bit') < (SODIUM_CRYPTO_SECRETBOX_NONCEBYTES + SODIUM_CRYPTO_SECRETBOX_MACBYTES)) {
136136
// message was truncated

0 commit comments

Comments
 (0)