{"record":{"id":"0c6774654b7d8dbb","repo":"nikic/PHP-Parser","slug":"name-cannot-be-empty","errorCode":null,"errorMessage":"Name cannot be empty","messagePattern":"Name cannot be empty","errorType":"exception","errorClass":"LogicException","httpStatus":null,"severity":"error","filePath":"lib/PhpParser/BuilderHelpers.php","lineNumber":113,"sourceCode":"\n        throw new \\LogicException('Expected string or instance of Node\\Identifier or Node\\Expr');\n    }\n\n    /**\n     * Normalizes a name: Converts string names to Name nodes.\n     *\n     * @param Name|string $name The name to normalize\n     *\n     * @return Name The normalized name\n     */\n    public static function normalizeName($name): Name {\n        if ($name instanceof Name) {\n            return $name;\n        }\n\n        if (is_string($name)) {\n            if (!$name) {\n                throw new \\LogicException('Name cannot be empty');\n            }\n\n            if ($name[0] === '\\\\') {\n                return new Name\\FullyQualified(substr($name, 1));\n            }\n\n            if (0 === strpos($name, 'namespace\\\\')) {\n                return new Name\\Relative(substr($name, strlen('namespace\\\\')));\n            }\n\n            return new Name($name);\n        }\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.","sourceCodeStart":95,"sourceCodeEnd":131,"githubUrl":"https://github.com/nikic/PHP-Parser/blob/fbd47f7ebcbb450138d92642a0a53b72a5285dda/lib/PhpParser/BuilderHelpers.php#L95-L131","documentation":"Error \"Name cannot be empty\" thrown in nikic/PHP-Parser.","triggerScenarios":"Thrown at lib/PhpParser/BuilderHelpers.php:113 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"}