Skip to content

NodeScopeResolver analysed files not as global state and optional #2122

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

Open
wants to merge 1 commit into
base: 1.9.x
Choose a base branch
from

Conversation

MartinMystikJonas
Copy link
Contributor

@MartinMystikJonas MartinMystikJonas commented Dec 18, 2022

@ondrejmirtes We discussed this on our friday call. I prepared PR that would make NodeScopeResolver usable for our use case of collecting latte templates context.

  1. analysedFiles are not global state anymore but passed as optional parameter to resolveNodes and resolveStmtNodes
  2. It is optional parameter - when omitted NodeScopeResolver will not limit what traits it resolves

I split resolveStmtNodes to public resolveStmtNodes which can set analysedFiles and private iterateStmtNodes used internally in NodeScopeResolver to avoid reseting analysedFiles or passing it arround all private methods of NodeScopeResolver

@MartinMystikJonas
Copy link
Contributor Author

Now I see this global state is used by rector. Would you preffer to just make it optional and kept as global state? It would be enough for our use case. I just want to remove global state when I was already making changes to it.

Or make setAnalysedFiles public and mark it as deprecated?

@MartinMystikJonas
Copy link
Contributor Author

I created simpler version that only makes setting analysedPaths optionsl for NodeScopeREsolver (used to limit analysis of trait outside of analysedPaths). See #2123

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

Successfully merging this pull request may close these issues.

1 participant