{"record":{"id":"19ec442b9b733580","repo":"nikic/PHP-Parser","slug":"enternode-returned-invalid-value-of-type-type","errorCode":null,"errorMessage":"enterNode() returned invalid value of type {type}","messagePattern":"enterNode\\(\\) returned invalid value of type (.+?)","errorType":"exception","errorClass":"\\LogicException","httpStatus":null,"severity":"error","filePath":"lib/PhpParser/NodeTraverser.php","lineNumber":131,"sourceCode":"            foreach ($this->visitors as $visitorIndex => $visitor) {\n                $return = $visitor->enterNode($subNode);\n                if (null !== $return) {\n                    if ($return instanceof Node) {\n                        $this->ensureReplacementReasonable($subNode, $return);\n                        $subNode = $node->$name = $return;\n                    } elseif (NodeVisitor::DONT_TRAVERSE_CHILDREN === $return) {\n                        $traverseChildren = false;\n                    } elseif (NodeVisitor::DONT_TRAVERSE_CURRENT_AND_CHILDREN === $return) {\n                        $traverseChildren = false;\n                        break;\n                    } elseif (NodeVisitor::STOP_TRAVERSAL === $return) {\n                        $this->stopTraversal = true;\n                        break 2;\n                    } elseif (NodeVisitor::REPLACE_WITH_NULL === $return) {\n                        $node->$name = null;\n                        continue 2;\n                    } else {\n                        throw new \\LogicException(\n                            'enterNode() returned invalid value of type ' . gettype($return)\n                        );\n                    }\n                }\n            }\n\n            if ($traverseChildren) {\n                $this->traverseNode($subNode);\n                if ($this->stopTraversal) {\n                    break;\n                }\n            }\n\n            for (; $visitorIndex >= 0; --$visitorIndex) {\n                $visitor = $this->visitors[$visitorIndex];\n                $return = $visitor->leaveNode($subNode);\n\n                if (null !== $return) {","sourceCodeStart":113,"sourceCodeEnd":149,"githubUrl":"https://github.com/nikic/PHP-Parser/blob/fbd47f7ebcbb450138d92642a0a53b72a5285dda/lib/PhpParser/NodeTraverser.php#L113-L149","documentation":"Error \"enterNode() returned invalid value of type {type}\" thrown in nikic/PHP-Parser.","triggerScenarios":"Thrown at lib/PhpParser/NodeTraverser.php:131 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"}