Function __global->js_check_variable

Definitions

sources/webstandards_js_lint.php

  • Check a variable.TODO: #6239 this needs to check for accidental assignment to browser globals like window. See https://www.youtube.com/watch?v=_xEWzr5mVfk .
  • Visibility: public
  • Is abstract?: No
  • Is static?: No
  • Is final?: No

Parameters

Name Type Passed by reference? Variadic? Default Set Range Description
$variable array No No required parameter N/A N/A The (possibly complex) variable
$reference boolean No No False N/A N/A Whether the variable is being used referentially (i.e. not being set)
$function_duality boolean No No False N/A N/A Whether to return the type and function-return-type pair, rather than just the type
$class ?string No No Null N/A N/A The class the variable is referencing within (null: global)
$allow_static boolean No No False N/A N/A Whether the given class is being referenced directly in static form
$is_call boolean No No False N/A N/A Whether this is for a function call

Returns

  • The return type and possibly function return type (if requested)
  • Type: mixed
  • Set: N/A
  • Range: N/A

Preview

Code (PHP)

/**
 * Check a variable.TODO: #6239 this needs to check for accidental assignment to browser globals like window. See https://www.youtube.com/watch?v=_xEWzr5mVfk .
 *
 * @param  array $variable The (possibly complex) variable
 * @param  boolean $reference Whether the variable is being used referentially (i.e. not being set)
 * @param  boolean $function_duality Whether to return the type and function-return-type pair, rather than just the type
 * @param  ?string $class The class the variable is referencing within (null: global)
 * @param  boolean $allow_static Whether the given class is being referenced directly in static form
 * @param  boolean $is_call Whether this is for a function call
 * @return mixed The return type and possibly function return type (if requested)
 */

function js_check_variable(array $variable, bool $reference = false, bool $function_duality = false, ?string $class = null, bool $allow_static = false, bool $is_call = false)