Open nevadascout opened 7 years ago
For information, here some tricks for namespace resolution :
Fully compliant with PHP doc here : http://php.net/manual/en/language.namespaces.rules.php
PHP Script :
<?php
$a = new a(); // <-- this is UnQualified Name
$b = new \a(); // <-- Fully Qualified Name
$c = new namespace\a(); // <-- Relative Name (PHP7)
AST Structure :
{
"kind": "program",
"children": [
{
"kind": "assign",
"operator": "=",
"left": {
"kind": "variable",
"name": "a",
"byref": false
},
"right": {
"kind": "new",
"what": {
"kind": "identifier",
"resolution": "uqn",
"name": "a"
},
"arguments": []
}
},
{
"kind": "assign",
"operator": "=",
"left": {
"kind": "variable",
"name": "b",
"byref": false
},
"right": {
"kind": "new",
"what": {
"kind": "identifier",
"resolution": "fqn",
"name": "\\a"
},
"arguments": []
}
},
{
"kind": "assign",
"operator": "=",
"left": {
"kind": "variable",
"name": "c",
"byref": false
},
"right": {
"kind": "new",
"what": {
"kind": "identifier",
"resolution": "rn",
"name": "a"
},
"arguments": []
}
}
],
"errors": []
}
When getting suggestions for a method, we need to check the namespace that is being used and use the appropriate class.