|
10 | 10 | */ |
11 | 11 |
|
12 | 12 | use CodeIgniter\Cache\CacheInterface; |
| 13 | +use CodeIgniter\Config\BaseConfig; |
13 | 14 | use CodeIgniter\Config\Factories; |
14 | 15 | use CodeIgniter\Cookie\Cookie; |
15 | 16 | use CodeIgniter\Cookie\CookieStore; |
|
47 | 48 | */ |
48 | 49 | function app_timezone(): string |
49 | 50 | { |
50 | | - /** @var App $config */ |
51 | | - $config = config('App'); |
| 51 | + $config = config(App::class); |
52 | 52 |
|
53 | 53 | return $config->appTimezone; |
54 | 54 | } |
@@ -203,7 +203,11 @@ function command(string $command) |
203 | 203 | /** |
204 | 204 | * More simple way of getting config instances from Factories |
205 | 205 | * |
206 | | - * @return object|null |
| 206 | + * @template T of BaseConfig |
| 207 | + * |
| 208 | + * @param class-string<T> $name |
| 209 | + * |
| 210 | + * @return T |
207 | 211 | */ |
208 | 212 | function config(string $name, bool $getShared = true) |
209 | 213 | { |
@@ -495,7 +499,7 @@ function force_https(int $duration = 31_536_000, ?RequestInterface $request = nu |
495 | 499 | Services::session(null, true)->regenerate(); // @codeCoverageIgnore |
496 | 500 | } |
497 | 501 |
|
498 | | - $baseURL = config('App')->baseURL; |
| 502 | + $baseURL = config(App::class)->baseURL; |
499 | 503 |
|
500 | 504 | if (strpos($baseURL, 'https://') === 0) { |
501 | 505 | $authority = substr($baseURL, strlen('https://')); |
@@ -885,7 +889,7 @@ function redirect(?string $route = null): RedirectResponse |
885 | 889 | */ |
886 | 890 | function _solidus(): string |
887 | 891 | { |
888 | | - if (config('DocTypes')->html5 ?? false) { |
| 892 | + if (config(\Config\DocTypes::class)->html5 ?? false) { |
889 | 893 | return ''; |
890 | 894 | } |
891 | 895 |
|
@@ -973,10 +977,9 @@ function route_to(string $method, ...$params) |
973 | 977 | * session()->set('foo', 'bar'); |
974 | 978 | * $foo = session('bar'); |
975 | 979 | * |
976 | | - * @param string $val |
| 980 | + * @param string|null $val |
977 | 981 | * |
978 | 982 | * @return array|bool|float|int|object|Session|string|null |
979 | | - * @phpstan-return ($val is null ? Session : array|bool|float|int|object|string|null) |
980 | 983 | */ |
981 | 984 | function session(?string $val = null) |
982 | 985 | { |
@@ -1064,7 +1067,7 @@ function single_service(string $name, ...$params) |
1064 | 1067 | */ |
1065 | 1068 | function slash_item(string $item): ?string |
1066 | 1069 | { |
1067 | | - $config = config('App'); |
| 1070 | + $config = config(App::class); |
1068 | 1071 |
|
1069 | 1072 | if (! property_exists($config, $item)) { |
1070 | 1073 | return null; |
@@ -1166,10 +1169,8 @@ function timer(?string $name = null, ?callable $callable = null) |
1166 | 1169 | */ |
1167 | 1170 | function view(string $name, array $data = [], array $options = []): string |
1168 | 1171 | { |
1169 | | - /** @var CodeIgniter\View\View $renderer */ |
1170 | 1172 | $renderer = Services::renderer(); |
1171 | 1173 |
|
1172 | | - /** @var \CodeIgniter\Config\View $config */ |
1173 | 1174 | $config = config(View::class); |
1174 | 1175 | $saveData = $config->saveData; |
1175 | 1176 |
|
|
0 commit comments