Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Looking for a way to read global functions #57

Open
BlacKCaT27 opened this issue Nov 6, 2018 · 3 comments
Open

Looking for a way to read global functions #57

BlacKCaT27 opened this issue Nov 6, 2018 · 3 comments

Comments

@BlacKCaT27
Copy link

Hello,

My team has been using this library while writing a refactoring tool and we came across an issue.

We have several legacy code files which contain global functions and/or global scope code (I know...I know....we're working on fixing it). The tool we're writing needs to ingest these files and break them up into model objects that represent a given code file.

We've tried using this libraries PhpClass::FromFile method, but this doesn't appear to capture global functions/code.

Is there any way to do so using the tools in this library? Something like a PhpFile::FromFile method?

@gossi
Copy link
Collaborator

gossi commented Nov 6, 2018

You could use version 0.4.* of this library, which still supports reading functions in through reflection. Then generate the new code of them and update the library 😁

@BlacKCaT27
Copy link
Author

Thanks for the tip! We'll try that out.

Is there a reason such functionality was removed? I could definitely see use cases that are still valid when dealing with legacy code.

@gossi
Copy link
Collaborator

gossi commented Nov 7, 2018

See #35 It is not reliable if a file has procedural or structural code. In the first case, this library cannot handle it. A file with a collection of functions though, would be manageable - true. Please comment over there.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants