MCPcopy Create free account
hub / github.com/PHPantom-dev/phpantom_lsp / seed_superglobals

Function seed_superglobals

src/completion/variable/forward_walk.rs:5011–5028  ·  view source on GitHub ↗

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)

Source from the content-addressed store, hash-verified

5009/// PHP makes these available in every scope without
5010/// an explicit `global` declaration.
5011fn 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.

Callers 4

analyze_function_bodyFunction · 0.85
resolve_in_top_levelFunction · 0.85

Calls 2

setMethod · 0.80
cloneMethod · 0.80

Tested by

no test coverage detected