Class generated using Reflection have fully-qualified names, because Reflection return all names as FQN. But method's and function's bodies are copied without fully-qualified name.
Nikic's NodeVisitor\NameResolver resolve name, but not change node's position in file, which used for copying body.
We can use Nikic's PhpParser\PrettyPrinter for print traversed expression nodes from body. But prettyPrint() will changed original formatting, and printFormatPreserving() can work with whole file only... :(
Collect all Name Nodes from importing method/function, and replace them in extracted body's string by position. I used this way in my fork and I'll create PR little later
The text was updated successfully, but these errors were encountered:
pushed a commit
Jun 5, 2020