@@ -123,8 +123,8 @@ The most commonly searched terms have also been added.
123
123
TODO: Determine if we want to continue 301 -OR- make these official URLs.
124
124
******************************************************************************/
125
125
126
- function is_known_ini ($ ini ) {
127
- $ inis = array (
126
+ function is_known_ini (string $ ini ): ? string {
127
+ $ inis = [
128
128
'engine ' => 'apache.configuration.php#ini.engine ' ,
129
129
'short-open-tag ' => 'ini.core.php#ini.short-open-tag ' ,
130
130
'asp-tags ' => 'ini.core.php#ini.asp-tags ' ,
@@ -345,13 +345,13 @@ $inis = array(
345
345
'soap.wsdl-cache-enabled ' => 'soap.configuration.php#ini.soap.wsdl-cache-enabled ' ,
346
346
'soap.wsdl-cache-dir ' => 'soap.configuration.php#ini.soap.wsdl-cache-dir ' ,
347
347
'soap.wsdl-cache-ttl ' => 'soap.configuration.php#ini.soap.wsdl-cache-ttl ' ,
348
- ) ;
348
+ ] ;
349
349
350
- return isset ( $ inis [$ ini ]) ? $ inis [ $ ini ] : false ;
350
+ return $ inis [$ ini ] ?? null ;
351
351
}
352
352
353
- function is_known_variable ($ variable ) {
354
- $ variables = array (
353
+ function is_known_variable (string $ variable ): ? string {
354
+ $ variables = [
355
355
// Variables
356
356
'globals ' => 'reserved.variables.globals.php ' ,
357
357
'-server ' => 'reserved.variables.server.php ' ,
@@ -375,18 +375,13 @@ $variables = array(
375
375
'http-post-files ' => 'reserved.variables.files.php ' ,
376
376
'http-cookie-vars ' => 'reserved.variables.cookies.php ' ,
377
377
'http-env-vars ' => 'reserved.variables.env.php ' ,
378
- );
379
-
380
- if ($ variable [0 ] === '$ ' ) {
381
- $ variable = ltrim ($ variable , '$ ' );
382
- }
383
-
384
- return isset ($ variables [$ variable ]) ? $ variables [$ variable ] : false ;
378
+ ];
385
379
380
+ return $ variables [ltrim ($ variable , '$ ' )] ?? null ;
386
381
}
387
382
388
- function is_known_term ($ term ) {
389
- $ terms = array (
383
+ function is_known_term (string $ term ): ? string {
384
+ $ terms = [
390
385
'<> ' => 'language.operators.comparison.php ' ,
391
386
'== ' => 'language.operators.comparison.php ' ,
392
387
'=== ' => 'language.operators.comparison.php ' ,
@@ -458,9 +453,9 @@ $terms = array(
458
453
'timestamp ' => 'function.time.php ' ,
459
454
'try ' => 'language.exceptions.php ' ,
460
455
'upload ' => 'features.file-upload.php ' ,
461
- ) ;
456
+ ] ;
462
457
463
- return isset ( $ terms [$ term ]) ? $ terms [ $ term ] : false ;
458
+ return $ terms [$ term ] ?? null ;
464
459
}
465
460
466
461
/*
@@ -473,8 +468,8 @@ Search snippet provider: A dirty proof-of-concept:
473
468
It should also take into account vague searches, such as 'global' and 'str'. The search works well enough for,
474
469
most terms, so something like $_SERVER isn't really needed but it's defined below anyways...
475
470
*/
476
- function is_known_snippet ($ term ) {
477
- $ snippets = array (
471
+ function is_known_snippet (string $ term ): ? string {
472
+ $ snippets = [
478
473
'global ' => '
479
474
The <b>global</b> keyword is used to manipulate <a href="/language.variables.scope">variable scope</a>, and
480
475
there is also the concept of <a href="/language.variables.superglobals">super globals</a> in PHP,
@@ -497,10 +492,10 @@ $snippets = array(
497
492
<a href="/language.functions">function is defined</a>, or
498
493
<a href="/about.prototypes">how to read a function prototype</a>.
499
494
See also the list of <a href="/extensions">PHP extensions</a> ' ,
500
- ) ;
495
+ ] ;
501
496
502
497
$ term = ltrim (strtolower (trim ($ term )), '$ ' );
503
- return $ snippets [$ term ] ?? false ;
498
+ return $ snippets [$ term ] ?? null ;
504
499
}
505
500
506
501
/**
0 commit comments