I want to change
define('USER','pippo');
with
define('USER', $_SERVER["DB_USER"]);
I am not able to create a new FuncCall with a string as first argument and a array element from "DB_USER" index of $_SERVER ...
Also, I was trying to workaround the problem, but it not works
if ($node->args[0]->value->value == "USER") {
if (!$node->args[1]->value instanceof Node\Scalar\String_) {
return null;
}
$node->args[1]->value->value = "\$_SERVER[\"_DB_USER\"]";
return $node;
}
What I must reconstuct is this
expr: Expr_FuncCall(
name: Name(
parts: array(
0: define
)
)
args: array(
0: Arg(
name: null
value: Scalar_String(
value: USER
)
byRef: false
unpack: false
)
1: Arg(
name: null
value: Expr_ArrayDimFetch(
var: Expr_Variable(
name: _SERVER
)
dim: Scalar_String(
value: CLAL_ENV_DB_USER
)
)
byRef: false
unpack: false
)
)
)
Finally I found the way!!
it does this