{"record":{"id":"3f66f205d5dfb9a9","repo":"nikic/PHP-Parser","slug":"variable-name-must-be-string-or-expr","errorCode":null,"errorMessage":"Variable name must be string or Expr","messagePattern":"Variable name must be string or Expr","errorType":"exception","errorClass":"LogicException","httpStatus":null,"severity":"error","filePath":"lib/PhpParser/BuilderFactory.php","lineNumber":226,"sourceCode":"    }\n\n    /**\n     * Creates node a for a literal value.\n     *\n     * @param Expr|bool|null|int|float|string|array|\\UnitEnum $value $value\n     */\n    public function val($value): Expr {\n        return BuilderHelpers::normalizeValue($value);\n    }\n\n    /**\n     * Creates variable node.\n     *\n     * @param string|Expr $name Name\n     */\n    public function var($name): Expr\\Variable {\n        if (!\\is_string($name) && !$name instanceof Expr) {\n            throw new \\LogicException('Variable name must be string or Expr');\n        }\n\n        return new Expr\\Variable($name);\n    }\n\n    /**\n     * Normalizes an argument list.\n     *\n     * Creates Arg nodes for all arguments and converts literal values to expressions.\n     *\n     * @param array $args List of arguments to normalize\n     *\n     * @return list<Arg>\n     */\n    public function args(array $args): array {\n        $normalizedArgs = [];\n        foreach ($args as $key => $arg) {\n            if (!($arg instanceof Arg)) {","sourceCodeStart":208,"sourceCodeEnd":244,"githubUrl":"https://github.com/nikic/PHP-Parser/blob/fbd47f7ebcbb450138d92642a0a53b72a5285dda/lib/PhpParser/BuilderFactory.php#L208-L244","documentation":"Error \"Variable name must be string or Expr\" thrown in nikic/PHP-Parser.","triggerScenarios":"Thrown at lib/PhpParser/BuilderFactory.php:226 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":[],"exampleFix":null,"handlingStrategy":null,"validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"analyzedSha":"fbd47f7ebcbb450138d92642a0a53b72a5285dda","analyzedAt":"2026-08-17T03:58:32.123Z","schemaVersion":2},"datasetVersion":"2026-08-17T04:17:16.089Z"}