/** * If $constantToken is the token holding the value of the constant, update the value to $value * * @param Token $constantToken * @param mixed $value */ private function attemptUpdate(Token $constantToken, $value) { $type = $constantToken->getType(); if ($type === T_CONSTANT_ENCAPSED_STRING) { $constantToken->setValue(sprintf("'%s'", $value)); } elseif ($type === T_LNUMBER || $type === T_ARRAY) { $constantToken->setValue($value); } }