zend-code icon indicating copy to clipboard operation
zend-code copied to clipboard

Use Reflection\FileReflection without including file?

Open RSully opened this issue 9 years ago • 2 comments

From zendframework/zendframework#6860 which was just closed:

It looks like FileReflection uses token_get_all(file_get_contents($file)) to actually scan the file, so I am a little lost by the requirement of includeing it.

I am trying to fix some PHP classes programmatically, all of which have the same class name in the global namespace. To do this I was planning to reflect the files, get the class reflection, and instantiate the class generator from that to make my changes. Of course, since reflecting the file requires including it, I cannot do this right now, as it would have to re-declare the classes.

/cc @sasezaki @adamlundrigan who had activity on previous issue

RSully avatar Jun 27 '16 14:06 RSully

updated link to code at this new repo: https://github.com/zendframework/zend-code/blob/ca15548f1e4f4f3228ea5d106061e8f56f62510e/src/Reflection/FileReflection.php#L88

RSully avatar Jun 27 '16 14:06 RSully

This repository has been closed and moved to laminas/laminas-code; a new issue has been opened at https://github.com/laminas/laminas-code/issues/25.

weierophinney avatar Dec 31 '19 21:12 weierophinney