Skip to content

Commit 9d56e16

Browse files
committed
Apply config property types
1 parent d8dce01 commit 9d56e16

27 files changed

+157
-386
lines changed

app/Config/App.php

Lines changed: 29 additions & 79 deletions
Original file line numberDiff line numberDiff line change
@@ -21,10 +21,8 @@ class App extends BaseConfig
2121
* and path to your installation. However, you should always configure this
2222
* explicitly and never rely on auto-guessing, especially in production
2323
* environments.
24-
*
25-
* @var string
2624
*/
27-
public $baseURL = 'http://localhost:8080/';
25+
public string $baseURL = 'http://localhost:8080/';
2826

2927
/**
3028
* --------------------------------------------------------------------------
@@ -34,10 +32,8 @@ class App extends BaseConfig
3432
* Typically this will be your index.php file, unless you've renamed it to
3533
* something else. If you are using mod_rewrite to remove the page set this
3634
* variable so that it is blank.
37-
*
38-
* @var string
3935
*/
40-
public $indexPage = 'index.php';
36+
public string $indexPage = 'index.php';
4137

4238
/**
4339
* --------------------------------------------------------------------------
@@ -53,10 +49,8 @@ class App extends BaseConfig
5349
* 'PATH_INFO' Uses $_SERVER['PATH_INFO']
5450
*
5551
* WARNING: If you set this to 'PATH_INFO', URIs will always be URL-decoded!
56-
*
57-
* @var string
5852
*/
59-
public $uriProtocol = 'REQUEST_URI';
53+
public string $uriProtocol = 'REQUEST_URI';
6054

6155
/**
6256
* --------------------------------------------------------------------------
@@ -67,10 +61,8 @@ class App extends BaseConfig
6761
* is viewing the site from. It affects the language strings and other
6862
* strings (like currency markers, numbers, etc), that your program
6963
* should run under for this request.
70-
*
71-
* @var string
7264
*/
73-
public $defaultLocale = 'en';
65+
public string $defaultLocale = 'en';
7466

7567
/**
7668
* --------------------------------------------------------------------------
@@ -81,10 +73,8 @@ class App extends BaseConfig
8173
* language to use based on the value of the Accept-Language header.
8274
*
8375
* If false, no automatic detection will be performed.
84-
*
85-
* @var bool
8676
*/
87-
public $negotiateLocale = false;
77+
public bool $negotiateLocale = false;
8878

8979
/**
9080
* --------------------------------------------------------------------------
@@ -97,7 +87,7 @@ class App extends BaseConfig
9787
*
9888
* @var string[]
9989
*/
100-
public $supportedLocales = ['en'];
90+
public array $supportedLocales = ['en'];
10191

10292
/**
10393
* --------------------------------------------------------------------------
@@ -106,10 +96,8 @@ class App extends BaseConfig
10696
*
10797
* The default timezone that will be used in your application to display
10898
* dates with the date helper, and can be retrieved through app_timezone()
109-
*
110-
* @var string
11199
*/
112-
public $appTimezone = 'America/Chicago';
100+
public string $appTimezone = 'America/Chicago';
113101

114102
/**
115103
* --------------------------------------------------------------------------
@@ -120,10 +108,8 @@ class App extends BaseConfig
120108
* that require a character set to be provided.
121109
*
122110
* @see http://php.net/htmlspecialchars for a list of supported charsets.
123-
*
124-
* @var string
125111
*/
126-
public $charset = 'UTF-8';
112+
public string $charset = 'UTF-8';
127113

128114
/**
129115
* --------------------------------------------------------------------------
@@ -134,10 +120,8 @@ class App extends BaseConfig
134120
* made via a secure connection (HTTPS). If the incoming request is not
135121
* secure, the user will be redirected to a secure version of the page
136122
* and the HTTP Strict Transport Security header will be set.
137-
*
138-
* @var bool
139123
*/
140-
public $forceGlobalSecureRequests = false;
124+
public bool $forceGlobalSecureRequests = false;
141125

142126
/**
143127
* --------------------------------------------------------------------------
@@ -160,10 +144,8 @@ class App extends BaseConfig
160144
* --------------------------------------------------------------------------
161145
*
162146
* The session cookie name, must contain only [0-9a-z_-] characters
163-
*
164-
* @var string
165147
*/
166-
public $sessionCookieName = 'ci_session';
148+
public string $sessionCookieName = 'ci_session';
167149

168150
/**
169151
* --------------------------------------------------------------------------
@@ -172,10 +154,8 @@ class App extends BaseConfig
172154
*
173155
* The number of SECONDS you want the session to last.
174156
* Setting to 0 (zero) means expire when the browser is closed.
175-
*
176-
* @var int
177157
*/
178-
public $sessionExpiration = 7200;
158+
public int $sessionExpiration = 7200;
179159

180160
/**
181161
* --------------------------------------------------------------------------
@@ -191,10 +171,8 @@ class App extends BaseConfig
191171
* Please read up the manual for the format with other session drivers.
192172
*
193173
* IMPORTANT: You are REQUIRED to set a valid save path!
194-
*
195-
* @var string
196174
*/
197-
public $sessionSavePath = WRITEPATH . 'session';
175+
public string $sessionSavePath = WRITEPATH . 'session';
198176

199177
/**
200178
* --------------------------------------------------------------------------
@@ -205,21 +183,17 @@ class App extends BaseConfig
205183
*
206184
* WARNING: If you're using the database driver, don't forget to update
207185
* your session table's PRIMARY KEY when changing this setting.
208-
*
209-
* @var bool
210186
*/
211-
public $sessionMatchIP = false;
187+
public bool $sessionMatchIP = false;
212188

213189
/**
214190
* --------------------------------------------------------------------------
215191
* Session Time to Update
216192
* --------------------------------------------------------------------------
217193
*
218194
* How many seconds between CI regenerating the session ID.
219-
*
220-
* @var int
221195
*/
222-
public $sessionTimeToUpdate = 300;
196+
public int $sessionTimeToUpdate = 300;
223197

224198
/**
225199
* --------------------------------------------------------------------------
@@ -229,10 +203,8 @@ class App extends BaseConfig
229203
* Whether to destroy session data associated with the old session ID
230204
* when auto-regenerating the session ID. When set to FALSE, the data
231205
* will be later deleted by the garbage collector.
232-
*
233-
* @var bool
234206
*/
235-
public $sessionRegenerateDestroy = false;
207+
public bool $sessionRegenerateDestroy = false;
236208

237209
/**
238210
* --------------------------------------------------------------------------
@@ -241,11 +213,10 @@ class App extends BaseConfig
241213
*
242214
* Set a cookie name prefix if you need to avoid collisions.
243215
*
244-
* @var string
245216
*
246217
* @deprecated use Config\Cookie::$prefix property instead.
247218
*/
248-
public $cookiePrefix = '';
219+
public string $cookiePrefix = '';
249220

250221
/**
251222
* --------------------------------------------------------------------------
@@ -254,11 +225,10 @@ class App extends BaseConfig
254225
*
255226
* Set to `.your-domain.com` for site-wide cookies.
256227
*
257-
* @var string
258228
*
259229
* @deprecated use Config\Cookie::$domain property instead.
260230
*/
261-
public $cookieDomain = '';
231+
public string $cookieDomain = '';
262232

263233
/**
264234
* --------------------------------------------------------------------------
@@ -267,11 +237,10 @@ class App extends BaseConfig
267237
*
268238
* Typically will be a forward slash.
269239
*
270-
* @var string
271240
*
272241
* @deprecated use Config\Cookie::$path property instead.
273242
*/
274-
public $cookiePath = '/';
243+
public string $cookiePath = '/';
275244

276245
/**
277246
* --------------------------------------------------------------------------
@@ -280,11 +249,10 @@ class App extends BaseConfig
280249
*
281250
* Cookie will only be set if a secure HTTPS connection exists.
282251
*
283-
* @var bool
284252
*
285253
* @deprecated use Config\Cookie::$secure property instead.
286254
*/
287-
public $cookieSecure = false;
255+
public bool $cookieSecure = false;
288256

289257
/**
290258
* --------------------------------------------------------------------------
@@ -293,11 +261,10 @@ class App extends BaseConfig
293261
*
294262
* Cookie will only be accessible via HTTP(S) (no JavaScript).
295263
*
296-
* @var bool
297264
*
298265
* @deprecated use Config\Cookie::$httponly property instead.
299266
*/
300-
public $cookieHTTPOnly = true;
267+
public bool $cookieHTTPOnly = true;
301268

302269
/**
303270
* --------------------------------------------------------------------------
@@ -319,11 +286,10 @@ class App extends BaseConfig
319286
* (empty string) means default SameSite attribute set by browsers (`Lax`)
320287
* will be set on cookies. If set to `None`, `$cookieSecure` must also be set.
321288
*
322-
* @var string|null
323289
*
324290
* @deprecated use Config\Cookie::$samesite property instead.
325291
*/
326-
public $cookieSameSite = 'Lax';
292+
public ?string $cookieSameSite = 'Lax';
327293

328294
/**
329295
* --------------------------------------------------------------------------
@@ -353,10 +319,8 @@ class App extends BaseConfig
353319
* The token name.
354320
*
355321
* @deprecated Use `Config\Security` $tokenName property instead of using this property.
356-
*
357-
* @var string
358322
*/
359-
public $CSRFTokenName = 'csrf_test_name';
323+
public string $CSRFTokenName = 'csrf_test_name';
360324

361325
/**
362326
* --------------------------------------------------------------------------
@@ -366,10 +330,8 @@ class App extends BaseConfig
366330
* The header name.
367331
*
368332
* @deprecated Use `Config\Security` $headerName property instead of using this property.
369-
*
370-
* @var string
371333
*/
372-
public $CSRFHeaderName = 'X-CSRF-TOKEN';
334+
public string $CSRFHeaderName = 'X-CSRF-TOKEN';
373335

374336
/**
375337
* --------------------------------------------------------------------------
@@ -379,10 +341,8 @@ class App extends BaseConfig
379341
* The cookie name.
380342
*
381343
* @deprecated Use `Config\Security` $cookieName property instead of using this property.
382-
*
383-
* @var string
384344
*/
385-
public $CSRFCookieName = 'csrf_cookie_name';
345+
public string $CSRFCookieName = 'csrf_cookie_name';
386346

387347
/**
388348
* --------------------------------------------------------------------------
@@ -392,10 +352,8 @@ class App extends BaseConfig
392352
* The number in seconds the token should expire.
393353
*
394354
* @deprecated Use `Config\Security` $expire property instead of using this property.
395-
*
396-
* @var int
397355
*/
398-
public $CSRFExpire = 7200;
356+
public int $CSRFExpire = 7200;
399357

400358
/**
401359
* --------------------------------------------------------------------------
@@ -405,10 +363,8 @@ class App extends BaseConfig
405363
* Regenerate token on every submission?
406364
*
407365
* @deprecated Use `Config\Security` $regenerate property instead of using this property.
408-
*
409-
* @var bool
410366
*/
411-
public $CSRFRegenerate = true;
367+
public bool $CSRFRegenerate = true;
412368

413369
/**
414370
* --------------------------------------------------------------------------
@@ -418,10 +374,8 @@ class App extends BaseConfig
418374
* Redirect to previous page with error on failure?
419375
*
420376
* @deprecated Use `Config\Security` $redirect property instead of using this property.
421-
*
422-
* @var bool
423377
*/
424-
public $CSRFRedirect = true;
378+
public bool $CSRFRedirect = true;
425379

426380
/**
427381
* --------------------------------------------------------------------------
@@ -438,10 +392,8 @@ class App extends BaseConfig
438392
*
439393
* @see https://portswigger.net/web-security/csrf/samesite-cookies
440394
* @deprecated `Config\Cookie` $samesite property is used.
441-
*
442-
* @var string
443395
*/
444-
public $CSRFSameSite = 'Lax';
396+
public string $CSRFSameSite = 'Lax';
445397

446398
/**
447399
* --------------------------------------------------------------------------
@@ -458,8 +410,6 @@ class App extends BaseConfig
458410
*
459411
* @see http://www.html5rocks.com/en/tutorials/security/content-security-policy/
460412
* @see http://www.w3.org/TR/CSP/
461-
*
462-
* @var bool
463413
*/
464-
public $CSPEnabled = false;
414+
public bool $CSPEnabled = false;
465415
}

app/Config/CURLRequest.php

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -15,8 +15,6 @@ class CURLRequest extends BaseConfig
1515
*
1616
* If true, all the options won't be reset between requests.
1717
* It may cause an error request with unnecessary headers.
18-
*
19-
* @var bool
2018
*/
21-
public $shareOptions = true;
19+
public bool $shareOptions = true;
2220
}

0 commit comments

Comments
 (0)