* `$_SERVER['DOCUMENT_ROOT']`, in either quote and with any spacing inside the * brackets: the folder the web server serves, which only its configuration * names (#3298).
(node: SyntaxNode, source: string)
| 130 | * names (#3298). |
| 131 | */ |
| 132 | function phpIsDocumentRoot(node: SyntaxNode, source: string): boolean { |
| 133 | if (node.type !== 'subscript_expression' || node.namedChildCount !== 2) return false; |
| 134 | const variable = node.namedChild(0); |
| 135 | const key = node.namedChild(1); |
| 136 | return !!variable && !!key && variable.type === 'variable_name' && |
| 137 | getNodeText(variable, source) === '$_SERVER' && phpLiteralText(key, source) === 'DOCUMENT_ROOT'; |
| 138 | } |
| 139 | |
| 140 | /** |
| 141 | * The path that string literals (and `DIRECTORY_SEPARATOR`, read as `/`) |
no test coverage detected