{"record":{"id":"9be3cdc15b7275a0","repo":"nikic/PHP-Parser","slug":"name-must-be-a-string-or-an-instance-of-node-name-9be3cd","errorCode":null,"errorMessage":"Name must be a string or an instance of Node\\Name or Node\\Expr","messagePattern":"Name must be a string or an instance of Node\\\\Name or Node\\\\Expr","errorType":"exception","errorClass":"LogicException","httpStatus":null,"severity":"error","filePath":"lib/PhpParser/BuilderHelpers.php","lineNumber":143,"sourceCode":"        }\n\n        throw new \\LogicException('Name must be a string or an instance of Node\\Name');\n    }\n\n    /**\n     * Normalizes a name: Converts string names to Name nodes, while also allowing expressions.\n     *\n     * @param Expr|Name|string $name The name to normalize\n     *\n     * @return Name|Expr The normalized name or expression\n     */\n    public static function normalizeNameOrExpr($name) {\n        if ($name instanceof Expr) {\n            return $name;\n        }\n\n        if (!is_string($name) && !($name instanceof Name)) {\n            throw new \\LogicException(\n                'Name must be a string or an instance of Node\\Name or Node\\Expr'\n            );\n        }\n\n        return self::normalizeName($name);\n    }\n\n    /**\n     * Normalizes a type: Converts plain-text type names into proper AST representation.\n     *\n     * In particular, builtin types become Identifiers, custom types become Names and nullables\n     * are wrapped in NullableType nodes.\n     *\n     * @param string|Name|Identifier|ComplexType $type The type to normalize\n     *\n     * @return Name|Identifier|ComplexType The normalized type\n     */\n    public static function normalizeType($type) {","sourceCodeStart":125,"sourceCodeEnd":161,"githubUrl":"https://github.com/nikic/PHP-Parser/blob/fbd47f7ebcbb450138d92642a0a53b72a5285dda/lib/PhpParser/BuilderHelpers.php#L125-L161","documentation":"Error \"Name must be a string or an instance of Node\\Name or Node\\Expr\" thrown in nikic/PHP-Parser.","triggerScenarios":"Thrown at lib/PhpParser/BuilderHelpers.php:143 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"}