Phan\Language\Element\Variable::isHardcodedGlobalVariableWithName PHP Method

isHardcodedGlobalVariableWithName() public static method

Returns true for all superglobals and variables in globals_type_map.
public static isHardcodedGlobalVariableWithName ( string $name ) : boolean
$name string
return boolean
    public static function isHardcodedGlobalVariableWithName(string $name) : bool
    {
        return self::isSuperglobalVariableWithName($name) || array_key_exists($name, Config::get()->globals_type_map);
    }

Usage Example

Example #1
0
 /**
  * @return void
  */
 public function addVariable(Variable $variable)
 {
     $variable_name = $variable->getName();
     if (Variable::isHardcodedGlobalVariableWithName($variable_name)) {
         // Silently ignore globally replacing $_POST, $argv, runkit superglobals, etc.
         // with superglobals.
         // TODO: Add a warning for incompatible assignments in callers.
         return;
     }
     self::$global_variable_map[$variable->getName()] = $variable;
 }