Skip to content

Commit 0cc3fae

Browse files
committed
Ensur consistent string handling in dynamic method calls
1 parent c061acb commit 0cc3fae

File tree

7 files changed

+6
-7
lines changed

7 files changed

+6
-7
lines changed

src/Auth/Actions/EmailActivator.php

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,6 @@
88
use CodeIgniter\Exceptions\PageNotFoundException;
99
use CodeIgniter\HTTP\IncomingRequest;
1010
use CodeIgniter\HTTP\RedirectResponse;
11-
use CodeIgniter\HTTP\Response;
1211
use CodeIgniter\I18n\Time;
1312
use CodeIgniter\Shield\Authentication\Actions\EmailActivator as ShieldEmailActivator;
1413
use CodeIgniter\Shield\Authentication\Authenticators\Session;

src/Core/Traits/HasMeta.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -236,7 +236,7 @@ public function syncMeta(array $post): void
236236
}
237237

238238
foreach (array_keys($fields) as $field) {
239-
$field = strtolower($field);
239+
$field = strtolower((string) $field);
240240
$existing = array_key_exists($field, $this->meta);
241241
// add to keep list
242242
$legal[] = $field;

src/Menus/MenuItem.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -84,7 +84,7 @@ public function __construct(?array $data = null)
8484
}
8585

8686
foreach ($data as $key => $value) {
87-
$method = 'set' . ucfirst($key);
87+
$method = 'set' . ucfirst((string) $key);
8888
if (method_exists($this, $method)) {
8989
$this->{$method}($value);
9090
}

src/Tools/Libraries/Logs.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -118,7 +118,7 @@ public function countLogLevels($filePath): string
118118

119119
// Count occurrences of each level
120120
foreach ($levels as $level) {
121-
$counts[$level] = substr_count($fileContent, $level);
121+
$counts[$level] = substr_count($fileContent, (string) $level);
122122
}
123123

124124
// Remove entries with value 0

src/Widgets/Types/Charts/ChartDataset.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,7 @@ public function __construct(?array $data = null)
4848
}
4949

5050
foreach ($data as $key => $value) {
51-
$method = 'set' . ucfirst($key);
51+
$method = 'set' . ucfirst((string) $key);
5252
if (method_exists($this, $method)) {
5353
$this->{$method}($value);
5454
}

src/Widgets/Types/Charts/ChartsItem.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -115,7 +115,7 @@ public function __construct(?array $data = null)
115115
}
116116

117117
foreach ($data as $key => $value) {
118-
$method = 'set' . ucfirst($key);
118+
$method = 'set' . ucfirst((string) $key);
119119
if (method_exists($this, $method)) {
120120
$this->{$method}($value);
121121
}

src/Widgets/Types/Stats/StatsItem.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -90,7 +90,7 @@ public function __construct(?array $data = null)
9090
}
9191

9292
foreach ($data as $key => $value) {
93-
$method = 'set' . ucfirst($key);
93+
$method = 'set' . ucfirst((string) $key);
9494
if (method_exists($this, $method)) {
9595
$this->{$method}($value);
9696
}

0 commit comments

Comments
 (0)