Skip to content

Commit c60b9f9

Browse files
committed
cs-fix and fixing static analysis problems
1 parent b055119 commit c60b9f9

File tree

27 files changed

+11
-33
lines changed

27 files changed

+11
-33
lines changed

system/Common.php

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -217,8 +217,6 @@ function config(string $name, bool $getShared = true)
217217
/**
218218
* Provides access to the Context object, which is used to store
219219
* contextual data during a request that can be accessed globally.
220-
*
221-
* @return Context
222220
*/
223221
function context(): Context
224222
{

system/Context/Context.php

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
11
<?php
22

3+
declare(strict_types=1);
4+
35
/**
46
* This file is part of CodeIgniter 4 framework.
57
*
@@ -104,7 +106,7 @@ public function getOnly(array|string $keys): array
104106
$keys = [$keys];
105107
}
106108

107-
return array_filter($this->data, static fn ($k) => in_array($k, $keys, true), ARRAY_FILTER_USE_KEY);
109+
return array_filter($this->data, static fn ($k): bool => in_array($k, $keys, true), ARRAY_FILTER_USE_KEY);
108110
}
109111

110112
/**
@@ -120,7 +122,7 @@ public function getExcept(array|string $keys): array
120122
$keys = [$keys];
121123
}
122124

123-
return array_filter($this->data, static fn ($k) => ! in_array($k, $keys, true), ARRAY_FILTER_USE_KEY);
125+
return array_filter($this->data, static fn ($k): bool => ! in_array($k, $keys, true), ARRAY_FILTER_USE_KEY);
124126
}
125127

126128
/**
@@ -159,7 +161,7 @@ public function getOnlyHidden(array|string $keys): array
159161
$keys = [$keys];
160162
}
161163

162-
return array_filter($this->hiddenData, static fn ($k) => in_array($k, $keys, true), ARRAY_FILTER_USE_KEY);
164+
return array_filter($this->hiddenData, static fn ($k): bool => in_array($k, $keys, true), ARRAY_FILTER_USE_KEY);
163165
}
164166

165167
/**
@@ -175,7 +177,7 @@ public function getExceptHidden(array|string $keys): array
175177
$keys = [$keys];
176178
}
177179

178-
return array_filter($this->hiddenData, static fn ($k) => ! in_array($k, $keys, true), ARRAY_FILTER_USE_KEY);
180+
return array_filter($this->hiddenData, static fn ($k): bool => ! in_array($k, $keys, true), ARRAY_FILTER_USE_KEY);
179181
}
180182

181183
/**

tests/system/Context/ContextTest.php

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
11
<?php
22

3+
declare(strict_types=1);
4+
35
/**
46
* This file is part of CodeIgniter 4 framework.
57
*
Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
11
<?php
22

33
$context = service('context');
4-
Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
11
<?php
22

33
$context->set('user_id', 123);
4-

user_guide_src/source/general/context/003.php

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,4 +6,3 @@
66
'request_id' => 'req_abc123',
77
'correlation_id' => 'corr_xyz789',
88
]);
9-

user_guide_src/source/general/context/004.php

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,4 +3,3 @@
33
$context->set('user_id', 123)
44
->set('username', 'john_doe')
55
->set('request_id', 'req_abc123');
6-

user_guide_src/source/general/context/005.php

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,4 +2,3 @@
22

33
$userId = $context->get('user_id');
44
// $userId = 123
5-

user_guide_src/source/general/context/006.php

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,4 +2,3 @@
22

33
$role = $context->get('user_role', 'guest');
44
// If 'user_role' doesn't exist, $role will be 'guest'
5-

user_guide_src/source/general/context/007.php

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,4 +2,3 @@
22

33
$allData = $context->getAll();
44
// Returns: ['user_id' => 123, 'username' => 'john_doe', ...]
5-

0 commit comments

Comments
 (0)