Seed PHP superglobals (`$_SERVER`, `$_GET`, `$_POST`, etc.) into the scope as `array` so that accesses on them resolve correctly. PHP makes these available in every scope without an explicit `global` declaration.
(scope: &mut ScopeState)
| 5009 | /// PHP makes these available in every scope without |
| 5010 | /// an explicit `global` declaration. |
| 5011 | fn seed_superglobals(scope: &mut ScopeState) { |
| 5012 | let array_type = vec![ResolvedType::from_type_string(PhpType::Named( |
| 5013 | "array".to_string(), |
| 5014 | ))]; |
| 5015 | for name in [ |
| 5016 | "$_SERVER", |
| 5017 | "$_GET", |
| 5018 | "$_POST", |
| 5019 | "$_COOKIE", |
| 5020 | "$_REQUEST", |
| 5021 | "$_FILES", |
| 5022 | "$_ENV", |
| 5023 | "$_SESSION", |
| 5024 | "$GLOBALS", |
| 5025 | ] { |
| 5026 | scope.set(name, array_type.clone()); |
| 5027 | } |
| 5028 | } |
| 5029 | |
| 5030 | /// Recursively walk an expression tree to find function call |
| 5031 | /// sub-expressions and seed pass-by-reference primitive types for each. |
no test coverage detected